From: magnus.blaudd Date: November 15 2011 2:47pm Subject: bzr push into mysql-5.5-cluster branch (magnus.blaudd:3647 to 3648) List-Archive: http://lists.mysql.com/commits/141974 Message-Id: <201111151447.pAFEleGj009795@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3648 magnus.blaudd@stripped 2011-11-15 MCP - backport latest version of "slave rbwr optimization" to 5.5-cluster modified: sql/ha_ndbcluster.cc sql/handler.h sql/log_event.cc 3647 magnus.blaudd@stripped 2011-11-15 WL#5881 - improve the slave_allow_batching patch after review comments - add test case added: mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result mysql-test/suite/rpl/t/rpl_row_basic_allow_batching.test modified: sql/log_event.cc sql/sys_vars.cc === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2011-11-14 12:31:17 +0000 +++ b/sql/ha_ndbcluster.cc 2011-11-15 14:45:16 +0000 @@ -13034,6 +13034,7 @@ ulonglong ha_ndbcluster::table_flags(voi #ifndef NDB_WITHOUT_ONLINE_ALTER HA_ONLINE_ALTER | #endif + HA_READ_BEFORE_WRITE_REMOVAL | 0; /* === modified file 'sql/handler.h' --- a/sql/handler.h 2011-09-28 18:45:32 +0000 +++ b/sql/handler.h 2011-11-15 14:45:16 +0000 @@ -232,6 +232,14 @@ typedef Bitmap HA_AL */ #define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE) +#ifndef MCP_WL5906 +/* + The handler supports read before write removal optimization +*/ +#define HA_READ_BEFORE_WRITE_REMOVAL (LL(1) << 38) +#endif + + /* bits in index_flags(index_number) for what you can do with index */ #define HA_READ_NEXT 1 /* TODO really use this flag */ #define HA_READ_PREV 2 /* supports ::index_prev */ === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2011-11-15 14:25:58 +0000 +++ b/sql/log_event.cc 2011-11-15 14:45:16 +0000 @@ -9757,6 +9757,25 @@ int Rows_log_event::find_row(const Relay if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) && table->s->primary_key < MAX_KEY) { + +#ifndef MCP_SLAVE_RBWR_OPTIMIZATION + if ((table->file->ha_table_flags() & HA_READ_BEFORE_WRITE_REMOVAL)) + { + /* + Read removal is possible since the engine supports write without + previous read using full primary key + */ + DBUG_PRINT("info", ("using read before write removal")); + + /* + Tell the handler to ignore if key exists or not, since it's + not yet known if the key does exist(when using rbwr) + */ + table->file->extra(HA_EXTRA_IGNORE_NO_KEY); + DBUG_RETURN(0); + } +#endif + /* Use a more efficient method to fetch the record given by table->record[0] if the engine allows it. We first compute a @@ -9776,23 +9795,6 @@ int Rows_log_event::find_row(const Relay */ -#ifndef MCP_WL3733 - /* - Ndb does not need read before delete/update (and no updates are sent) - if primary key specified - - (Actually uniquekey will also do, but pk will be in each - row if table has pk) - - Also set ignore no key, as we don't really know if row exists... - */ - if (table->file->ht->db_type == DB_TYPE_NDBCLUSTER) - { - table->file->extra(HA_EXTRA_IGNORE_NO_KEY); - DBUG_RETURN(0); - } -#endif - DBUG_PRINT("info",("locating record using primary key (position)")); int error= table->file->rnd_pos_by_record(table->record[0]); if (error) No bundle (reason: useless for push emails).