Bug #14035 Optimizing check_table_replication_row_based()
| Submitted: | 14 Oct 2005 18:02 | Modified: | 18 Mar 2006 18:03 |
|---|---|---|---|
| Reporter: | Mats Kindahl | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
| Version: | 5.0-wl1012 | OS: | Any (ALL) |
| Assigned to: | Mats Kindahl | CPU Architecture: | Any |
[18 Mar 2006 17:38]
Mats Kindahl
The patch is pushed into the current 5.1 clone. There is nothing to document since the patch only affects internal behaviour.
[18 Mar 2006 18:03]
Paul DuBois
No changelog entry needed.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Situation --------- The thread keeps a pending RBR event available, where new rows can be added on execution of ``ha_*_row()`` functions. Each time a row is about to be added, the ``check_table_replication_row_based()`` function is called to check if the current pending event needs to be flushed to the binary log and a new pending event constructed. The function definition in it's entirety is:: static bool check_table_replication_row_based(TABLE *table) { return opt_binlog_row_based_logging && table->s->tmp_table == NO_TMP_TABLE && rpl_filter->db_ok(table->s->db) && rpl_filter->db_ok_with_wild_table(table->s->db) && strcmp(table->s->db, "mysql") != 0; } Problem ------- This function is called each time a row is added, which is a lot of times. Especially note that all condition are evaluated whenever the row *can* be added to the current pending event, so there's a lot of cycles wasted here. How to repeat: Run with --binlog-format=row --debug and inspect execution trace. Suggested fix: The following solution was suggested by Guilhem: since the test is entirely based on the status of the table, the result of one execution of the function can be cached in the table structure [e.g., as ``table->rbr_cond_checked`` /Matz].