From: Frazer Clement Date: September 19 2011 10:30am Subject: bzr push into mysql-5.1-telco-7.0 branch (frazer.clement:4535 to 4536) List-Archive: http://lists.mysql.com/commits/141030 Message-Id: <201109191030.p8JAUfML017118@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4536 Frazer Clement 2011-09-19 Commit Binlog v2 for CluB X.X modified: mysql-test/include/show_binlog_events2.inc mysql-test/include/show_binlog_using_logname.inc mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test sql/ha_ndbcluster_binlog.cc sql/log_event.cc sql/log_event.h sql/log_event_old.h sql/mysql_priv.h sql/mysqld.cc sql/rpl_constants.h sql/rpl_injector.cc sql/rpl_injector.h sql/set_var.cc sql/sql_class.cc sql/sql_class.h 4535 Jonas Oreland 2011-09-19 ndb index stat - use variable together with condition-variable, so that pthread_signal "doesn't get lost" modified: sql/ha_ndb_index_stat.cc === modified file 'mysql-test/include/show_binlog_events2.inc' --- a/mysql-test/include/show_binlog_events2.inc 2008-02-13 18:02:34 +0000 +++ b/mysql-test/include/show_binlog_events2.inc 2011-09-19 10:27:54 +0000 @@ -1,4 +1,5 @@ ---let $binlog_start=107 +#--let $binlog_start=107 +--let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) --replace_result $binlog_start --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ === modified file 'mysql-test/include/show_binlog_using_logname.inc' --- a/mysql-test/include/show_binlog_using_logname.inc 2007-06-21 19:58:59 +0000 +++ b/mysql-test/include/show_binlog_using_logname.inc 2011-09-19 10:27:54 +0000 @@ -6,8 +6,16 @@ # name is = log_name ######################################################## +if (!$start_pos) +{ + # If $start_pos is not set, we will set it as the second event's + # position. The first event(Description Event) is always ignored. For + # description event's length might be changed because of adding new events, + # 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value. + --let $start_pos= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) +} --replace_result $start_pos $end_pos ---replace_column 2 # +--replace_column 2 # 5 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ --eval show binlog events in '$log_name' from $start_pos limit $off_set,1 === modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result' --- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result 2011-05-13 07:40:50 +0000 +++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_multi.result 2011-09-19 10:27:54 +0000 @@ -32,8 +32,6 @@ master-bin.000001 # Write_rows 3 # table master-bin.000001 # Write_rows 3 # table_id: # flags: STMT_END_F master-bin.000001 # Query 3 # COMMIT set SQL_LOG_BIN=1; -@the_pos:=Position @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1) -107 master-bin.000001 include/rpl_change_topology.inc [new topology=3->2] include/start_slave.inc INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); === modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result' --- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result 2011-05-13 07:40:50 +0000 +++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_slave_restart.result 2011-09-19 10:27:54 +0000 @@ -32,12 +32,6 @@ master-bin.000001 # Write_rows 3 # table master-bin.000001 # Write_rows 3 # table_id: # flags: STMT_END_F master-bin.000001 # Query 3 # COMMIT set SQL_LOG_BIN=1; -@the_pos:=Position @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\','/'), '/', -1) -107 master-bin.000001 -CHANGE MASTER TO -master_port=, -master_log_file = 'master-bin.000001', -master_log_pos = 107 ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; === modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test' --- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test 2011-05-16 06:50:14 +0000 +++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_gap_event.test 2011-09-19 10:27:54 +0000 @@ -39,7 +39,6 @@ let $mysqld_name=mysqld.1.1; --source include/restart_mysqld.inc #show binlog events in 'master-bin.000002'; let $log_name=master-bin.000002; -let $start_pos=107; let $end_pos=143; let $off_set=0; -- source include/show_binlog_using_logname.inc === modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test' --- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test 2011-05-13 07:40:50 +0000 +++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_multi.test 2011-09-19 10:27:54 +0000 @@ -47,9 +47,11 @@ insert into t2 values (1); set SQL_LOG_BIN=1; --replace_result $the_epoch --disable_query_log +--disable_result_log eval SELECT @the_pos:=Position, @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ; +--enable_result_log --enable_query_log let $the_pos= `SELECT @the_pos` ; let $the_file= `SELECT @the_file` ; === modified file 'mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test' --- a/mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test 2011-05-13 07:40:50 +0000 +++ b/mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_restart.test 2011-09-19 10:27:54 +0000 @@ -47,10 +47,10 @@ insert into t2 values (1); set SQL_LOG_BIN=1; --replace_result $the_epoch --disable_query_log +--disable_result_log eval SELECT @the_pos:=Position, @the_file:=SUBSTRING_INDEX(REPLACE(FILE,'\\\\','/'), '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ; ---enable_query_log let $the_pos= `SELECT @the_pos` ; let $the_file= `SELECT @the_file` ; @@ -61,6 +61,8 @@ eval CHANGE MASTER TO master_port=$MASTER_MYPORT1, master_log_file = '$the_file', master_log_pos = $the_pos ; +--enable_result_log +--enable_query_log start slave; # insert some more values on the first master === modified file 'sql/ha_ndbcluster_binlog.cc' --- a/sql/ha_ndbcluster_binlog.cc 2011-09-07 22:50:01 +0000 +++ b/sql/ha_ndbcluster_binlog.cc 2011-09-19 10:27:54 +0000 @@ -48,6 +48,7 @@ extern my_bool opt_ndb_log_apply_status; extern ulong opt_ndb_extra_logging; extern st_ndb_slave_state g_ndb_slave_state; extern my_bool opt_ndb_log_transaction_id; +extern my_bool log_bin_use_v1_row_events; bool ndb_log_empty_epochs(void); @@ -3640,6 +3641,17 @@ int ndbcluster_binlog_start() DBUG_RETURN(-1); } + /* + Check that v2 events are enabled if log-transaction-id is set + */ + if (opt_ndb_log_transaction_id && + log_bin_use_v1_row_events) + { + sql_print_error("NDB: --ndb-log-transaction-id requires v2 Binlog row events " + "but server is using v1."); + DBUG_RETURN(-1); + } + pthread_mutex_init(&injector_mutex, MY_MUTEX_INIT_FAST); pthread_cond_init(&injector_cond, NULL); pthread_mutex_init(&ndb_schema_share_mutex, MY_MUTEX_INIT_FAST); @@ -6297,11 +6309,12 @@ ndb_binlog_thread_handle_data_event(THD* Get NdbApi transaction id for this event to put into Binlog */ Ndb_binlog_extra_row_info extra_row_info; + const uchar* extra_row_info_ptr = NULL; if (opt_ndb_log_transaction_id) { extra_row_info.setFlags(Ndb_binlog_extra_row_info::NDB_ERIF_TRANSID); extra_row_info.setTransactionId(pOp->getTransId()); - thd->binlog_row_event_extra_data = extra_row_info.generateBuffer(); + extra_row_info_ptr = extra_row_info.generateBuffer(); } DBUG_ASSERT(trans.good()); @@ -6359,7 +6372,8 @@ ndb_binlog_thread_handle_data_event(THD* ndb_unpack_record(table, event_data->ndb_value[0], &b, table->record[0]); ret = trans.write_row(logged_server_id, injector::transaction::table(table, true), - &b, n_fields, table->record[0]); + &b, n_fields, table->record[0], + extra_row_info_ptr); assert(ret == 0); } break; @@ -6403,7 +6417,8 @@ ndb_binlog_thread_handle_data_event(THD* DBUG_EXECUTE("info", print_records(table, table->record[n]);); ret = trans.delete_row(logged_server_id, injector::transaction::table(table, true), - &b, n_fields, table->record[n]); + &b, n_fields, table->record[n], + extra_row_info_ptr); assert(ret == 0); } break; @@ -6438,7 +6453,8 @@ ndb_binlog_thread_handle_data_event(THD* */ ret = trans.write_row(logged_server_id, injector::transaction::table(table, true), - &b, n_fields, table->record[0]);// after values + &b, n_fields, table->record[0],// after values + extra_row_info_ptr); assert(ret == 0); } else @@ -6462,7 +6478,8 @@ ndb_binlog_thread_handle_data_event(THD* injector::transaction::table(table, true), &b, n_fields, table->record[1], // before values - table->record[0]);// after values + table->record[0], // after values + extra_row_info_ptr); assert(ret == 0); } } @@ -6473,11 +6490,6 @@ ndb_binlog_thread_handle_data_event(THD* break; } - if (opt_ndb_log_transaction_id) - { - thd->binlog_row_event_extra_data = NULL; - } - if (share->flags & NSF_BLOB_FLAG) { my_free(blobs_buffer[0], MYF(MY_ALLOW_ZERO_PTR)); === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2011-09-07 22:50:01 +0000 +++ b/sql/log_event.cc 2011-09-19 10:27:54 +0000 @@ -44,7 +44,6 @@ #define FLAGSTR(V,F) ((V)&(F)?#F" ":"") - /* Size of buffer for printing a double in format %.g @@ -645,12 +644,23 @@ const char* Log_event::get_type_str(Log_ case PRE_GA_WRITE_ROWS_EVENT: return "Write_rows_event_old"; case PRE_GA_UPDATE_ROWS_EVENT: return "Update_rows_event_old"; case PRE_GA_DELETE_ROWS_EVENT: return "Delete_rows_event_old"; +#ifndef MCP_WL5353 + case WRITE_ROWS_EVENT_V1: return "Write_rows_v1"; + case UPDATE_ROWS_EVENT_V1: return "Update_rows_v1"; + case DELETE_ROWS_EVENT_V1: return "Delete_rows_v1"; +#else case WRITE_ROWS_EVENT: return "Write_rows"; case UPDATE_ROWS_EVENT: return "Update_rows"; case DELETE_ROWS_EVENT: return "Delete_rows"; +#endif case BEGIN_LOAD_QUERY_EVENT: return "Begin_load_query"; case EXECUTE_LOAD_QUERY_EVENT: return "Execute_load_query"; case INCIDENT_EVENT: return "Incident"; +#ifndef MCP_WL5353 + case WRITE_ROWS_EVENT: return "Write_rows"; + case UPDATE_ROWS_EVENT: return "Update_rows"; + case DELETE_ROWS_EVENT: return "Delete_rows"; +#endif default: return "Unknown"; /* impossible */ } } @@ -1297,6 +1307,17 @@ Log_event* Log_event::read_log_event(con case PRE_GA_DELETE_ROWS_EVENT: ev = new Delete_rows_log_event_old(buf, event_len, description_event); break; +#ifndef MCP_WL5353 + case WRITE_ROWS_EVENT_V1: + ev = new Write_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type); + break; + case UPDATE_ROWS_EVENT_V1: + ev = new Update_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type); + break; + case DELETE_ROWS_EVENT_V1: + ev = new Delete_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type); + break; +#else case WRITE_ROWS_EVENT: ev = new Write_rows_log_event(buf, event_len, description_event); break; @@ -1306,6 +1327,7 @@ Log_event* Log_event::read_log_event(con case DELETE_ROWS_EVENT: ev = new Delete_rows_log_event(buf, event_len, description_event); break; +#endif case TABLE_MAP_EVENT: ev = new Table_map_log_event(buf, event_len, description_event); break; @@ -1319,6 +1341,19 @@ Log_event* Log_event::read_log_event(con case INCIDENT_EVENT: ev = new Incident_log_event(buf, event_len, description_event); break; +#ifndef MCP_WL5353 +#if defined(HAVE_REPLICATION) + case WRITE_ROWS_EVENT: + ev = new Write_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type); + break; + case UPDATE_ROWS_EVENT: + ev = new Update_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type); + break; + case DELETE_ROWS_EVENT: + ev = new Delete_rows_log_event(buf, event_len, description_event, (Log_event_type)event_type); + break; +#endif +#endif default: DBUG_PRINT("error",("Unknown event code: %d", (int) buf[EVENT_TYPE_OFFSET])); @@ -1950,9 +1985,11 @@ void Rows_log_event::print_verbose(IO_CA Table_map_log_event *map; table_def *td; const char *sql_command, *sql_clause1, *sql_clause2; +#ifdef MCP_WL5353 Log_event_type type_code= get_type_code(); - -#ifndef MCP_WL5353 +#else + Log_event_type type_code= get_general_type_code(); + if (m_extra_row_data) { uint8 extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET]; @@ -2076,28 +2113,59 @@ void Log_event::print_base64(IO_CACHE* f if (print_event_info->verbose) { Rows_log_event *ev= NULL; + Log_event_type et= (Log_event_type) ptr[4]; - if (ptr[4] == TABLE_MAP_EVENT) + switch(et) + { + case TABLE_MAP_EVENT: { Table_map_log_event *map; map= new Table_map_log_event((const char*) ptr, size, glob_description_event); print_event_info->m_table_map.set_table(map->get_table_id(), map); + break; } - else if (ptr[4] == WRITE_ROWS_EVENT) + case WRITE_ROWS_EVENT: +#ifndef MCP_WL5353 + case WRITE_ROWS_EVENT_V1: +#endif { ev= new Write_rows_log_event((const char*) ptr, size, - glob_description_event); + glob_description_event +#ifndef MCP_WL5353 + , et +#endif + ); + break; } - else if (ptr[4] == DELETE_ROWS_EVENT) + case DELETE_ROWS_EVENT: +#ifndef MCP_WL5353 + case DELETE_ROWS_EVENT_V1: +#endif { ev= new Delete_rows_log_event((const char*) ptr, size, - glob_description_event); + glob_description_event +#ifndef MCP_WL5353 + , et +#endif + ); + break; } - else if (ptr[4] == UPDATE_ROWS_EVENT) + case UPDATE_ROWS_EVENT: +#ifndef MCP_WL5353 + case UPDATE_ROWS_EVENT_V1: +#endif { ev= new Update_rows_log_event((const char*) ptr, size, - glob_description_event); + glob_description_event +#ifndef MCP_WL5353 + , et +#endif + ); + break; + } + default: + break; } if (ev) @@ -3868,9 +3936,15 @@ Format_description_log_event(uint8 binlo post_header_len[PRE_GA_DELETE_ROWS_EVENT-1] = 0; post_header_len[TABLE_MAP_EVENT-1]= TABLE_MAP_HEADER_LEN; +#ifndef MCP_WL5353 + post_header_len[WRITE_ROWS_EVENT_V1-1]= ROWS_HEADER_LEN_V1; + post_header_len[UPDATE_ROWS_EVENT_V1-1]= ROWS_HEADER_LEN_V1; + post_header_len[DELETE_ROWS_EVENT_V1-1]= ROWS_HEADER_LEN_V1; +#else post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN; post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN; post_header_len[DELETE_ROWS_EVENT-1]= ROWS_HEADER_LEN; +#endif /* We here have the possibility to simulate a master of before we changed the table map id to be stored in 6 bytes: when it was stored in 4 @@ -3883,11 +3957,19 @@ Format_description_log_event(uint8 binlo */ DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", post_header_len[TABLE_MAP_EVENT-1]= - post_header_len[WRITE_ROWS_EVENT-1]= - post_header_len[UPDATE_ROWS_EVENT-1]= - post_header_len[DELETE_ROWS_EVENT-1]= 6;); + post_header_len[WRITE_ROWS_EVENT_V1-1]= + post_header_len[UPDATE_ROWS_EVENT_V1-1]= + post_header_len[DELETE_ROWS_EVENT_V1-1]= 6;); post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN; post_header_len[HEARTBEAT_LOG_EVENT-1]= 0; +#ifndef MCP_WL5353 + post_header_len[IGNORABLE_LOG_EVENT-1]= 0; + post_header_len[ROWS_QUERY_LOG_EVENT-1]= 0; + + post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[DELETE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; +#endif // Sanity-check that all post header lengths are initialized. IF_DBUG({ @@ -7215,12 +7297,10 @@ static uchar dbug_extra_row_data_val= 0; thread data structures which can be checked when reading the binlog. - @param thd Current thd @param arr Buffer to use */ -void set_extra_data(THD* thd, uchar* arr) +const uchar* set_extra_data(uchar* arr) { - assert(thd->binlog_row_event_extra_data == NULL); uchar val= (dbug_extra_row_data_val++) % (EXTRA_ROW_INFO_MAX_PAYLOAD + 1); /* 0 .. MAX_PAYLOAD + 1 */ arr[EXTRA_ROW_INFO_LEN_OFFSET]= val + EXTRA_ROW_INFO_HDR_BYTES; @@ -7228,7 +7308,7 @@ void set_extra_data(THD* thd, uchar* arr for (uchar i=0; ibinlog_row_event_extra_data= arr; + return arr; } #endif // #ifndef MYSQL_CLIENT @@ -7266,15 +7346,20 @@ void check_extra_data(uchar* extra_row_d #ifndef MYSQL_CLIENT Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, - MY_BITMAP const *cols, bool is_transactional) + MY_BITMAP const *cols, bool is_transactional +#ifndef MCP_WL5353 + ,Log_event_type event_type, + const uchar* extra_row_info +#endif + ) : Log_event(thd_arg, 0, is_transactional), m_row_count(0), m_table(tbl_arg), m_table_id(tid), m_width(tbl_arg ? tbl_arg->s->fields : 1), - m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0) + m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0), #ifndef MCP_WL5353 - ,m_extra_row_data(0) + m_type(event_type), m_extra_row_data(0) #endif #ifdef HAVE_REPLICATION , m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL) @@ -7298,27 +7383,23 @@ Rows_log_event::Rows_log_event(THD *thd_ uchar extra_data[255]; DBUG_EXECUTE_IF("extra_row_data_set", /* Set extra row data to a known value */ - set_extra_data(thd_arg, extra_data);); + extra_row_info = set_extra_data(extra_data);); #endif - if (thd_arg->binlog_row_event_extra_data) + if (extra_row_info) { /* Copy Extra data from thd into new event */ - uint16 extra_data_len= thd_arg->get_binlog_row_event_extra_data_len(); + uint8 extra_data_len= extra_row_info[EXTRA_ROW_INFO_LEN_OFFSET]; assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES); m_extra_row_data= (uchar*) my_malloc(extra_data_len, MYF(MY_WME)); if (likely(m_extra_row_data)) { - memcpy(m_extra_row_data, thd_arg->binlog_row_event_extra_data, + memcpy(m_extra_row_data, extra_row_info, extra_data_len); - set_flags(EXTRA_ROW_EV_DATA_F); } } - - DBUG_EXECUTE_IF("extra_row_data_set", - thd_arg->binlog_row_event_extra_data = NULL;); -#endif // #ifndef MCP_WL5353 +#endif /* if bitmap_init fails, caught in is_valid() */ if (likely(!bitmap_init(&m_cols, @@ -7350,9 +7431,9 @@ Rows_log_event::Rows_log_event(const cha #ifndef MYSQL_CLIENT m_table(NULL), #endif - m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0) + m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0), #ifndef MCP_WL5353 - ,m_extra_row_data(0) + m_type(event_type), m_extra_row_data(0) #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) , m_curr_row(NULL), m_curr_row_end(NULL), m_key(NULL) @@ -7382,34 +7463,61 @@ Rows_log_event::Rows_log_event(const cha } m_flags= uint2korr(post_start); - #ifndef MCP_WL5353 - uint16 extra_data_len= 0; - if ((m_flags & EXTRA_ROW_EV_DATA_F)) + post_start+= 2; + + uint16 var_header_len= 0; + if (post_header_len == ROWS_HEADER_LEN_V2) { - const uchar* extra_data_start= (const uchar*) post_start + 2; - extra_data_len= extra_data_start[EXTRA_ROW_INFO_LEN_OFFSET]; - assert(m_extra_row_data == 0); - assert(extra_data_len >= EXTRA_ROW_INFO_HDR_BYTES); - DBUG_PRINT("debug", ("extra_data_len = %u", - extra_data_len)); + /* + Have variable length header, check length, + which includes length bytes + */ + var_header_len= uint2korr(post_start); + assert(var_header_len >= 2); + var_header_len-= 2; - m_extra_row_data= (uchar*) my_malloc(extra_data_len, - MYF(MY_WME)); - if (likely(m_extra_row_data)) + /* Iterate over var-len header, extracting 'chunks' */ + const char* start= post_start + 2; + const char* end= start + var_header_len; + for (const char* pos= start; pos < end;) { - memcpy(m_extra_row_data, extra_data_start, extra_data_len); + switch(*pos++) + { + case RW_V_EXTRAINFO_TAG: + { + /* Have an 'extra info' section, read it in */ + assert((end - pos) >= EXTRA_ROW_INFO_HDR_BYTES); + uint8 infoLen= pos[EXTRA_ROW_INFO_LEN_OFFSET]; + assert((end - pos) >= infoLen); + /* Just store/use the first tag of this type, skip others */ + if (likely(!m_extra_row_data)) + { + m_extra_row_data= (uchar*) my_malloc(infoLen, + MYF(MY_WME)); + if (likely(m_extra_row_data)) + { + memcpy(m_extra_row_data, pos, infoLen); + } + DBUG_EXECUTE_IF("extra_row_data_check", + /* Check extra data has expected value */ + check_extra_data(m_extra_row_data);); + } + pos+= infoLen; + break; + } + default: + /* Unknown code, we will not understand anything further here */ + pos= end; /* Break loop */ + } } } - DBUG_EXECUTE_IF("extra_row_data_check", - /* Check extra data has expected value */ - check_extra_data(m_extra_row_data);); -#endif // #ifndef MCP_WL5353 +#endif uchar const *const var_start= (const uchar *)buf + common_header_len + post_header_len #ifndef MCP_WL5353 - + extra_data_len + + var_header_len #endif ; uchar const *const ptr_width= var_start; @@ -7438,7 +7546,12 @@ Rows_log_event::Rows_log_event(const cha m_cols_ai.bitmap= m_cols.bitmap; /* See explanation in is_valid() */ - if (event_type == UPDATE_ROWS_EVENT) + if ((event_type == UPDATE_ROWS_EVENT) +#ifndef MCP_WL5353 + || + (event_type == UPDATE_ROWS_EVENT_V1) +#endif + ) { DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); @@ -7498,7 +7611,11 @@ Rows_log_event::~Rows_log_event() int Rows_log_event::get_data_size() { +#ifndef MCP_WL5353 + int const type_code= get_general_type_code(); +#else int const type_code= get_type_code(); +#endif uchar buf[sizeof(m_width) + 1]; uchar *end= net_store_length(buf, m_width); @@ -7507,14 +7624,19 @@ int Rows_log_event::get_data_size() return 6 + no_bytes_in_map(&m_cols) + (end - buf) + (type_code == UPDATE_ROWS_EVENT ? no_bytes_in_map(&m_cols_ai) : 0) + (m_rows_cur - m_rows_buf);); - int data_size= ROWS_HEADER_LEN; - data_size+= no_bytes_in_map(&m_cols); - data_size+= (uint) (end - buf); + int data_size= #ifndef MCP_WL5353 + (get_type_code() > DELETE_ROWS_EVENT_V1) ? + ROWS_HEADER_LEN_V2 : + ROWS_HEADER_LEN_V1; data_size+= m_extra_row_data ? - m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET] : + RW_V_TAG_LEN + m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET] : 0; +#else + ROWS_HEADER_LEN; #endif + data_size+= no_bytes_in_map(&m_cols); + data_size+= (uint) (end - buf); if (type_code == UPDATE_ROWS_EVENT) data_size+= no_bytes_in_map(&m_cols_ai); @@ -7667,10 +7789,10 @@ int Rows_log_event::do_apply_event(Relay thd->options&= ~OPTION_RELAXED_UNIQUE_CHECKS; #ifndef MCP_WL5353 - if (get_flags(EXTRA_ROW_EV_DATA_F)) - thd->binlog_row_event_extra_data = m_extra_row_data; + if (m_extra_row_data) + thd->binlog_row_event_extra_data = m_extra_row_data; else - thd->binlog_row_event_extra_data = NULL; + thd->binlog_row_event_extra_data = NULL; #endif /* A small test to verify that objects have consistent types */ @@ -7804,7 +7926,7 @@ int Rows_log_event::do_apply_event(Relay thd->options&= ~OPTION_ALLOW_BATCH; #endif #ifndef MCP_WL5353 - if (get_flags(EXTRA_ROW_EV_DATA_F)) + if (m_extra_row_data) thd->binlog_row_event_extra_data = m_extra_row_data; else thd->binlog_row_event_extra_data = NULL; @@ -8118,7 +8240,11 @@ Rows_log_event::do_update_pos(Relay_log_ #ifndef MYSQL_CLIENT bool Rows_log_event::write_data_header(IO_CACHE *file) { - uchar buf[ROWS_HEADER_LEN]; // No need to init the buffer +#ifndef MCP_WL5353 + uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer +#else + uchar buf[ROWS_HEADER_LEN]; +#endif DBUG_ASSERT(m_table_id != ~0UL); DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", { @@ -8128,22 +8254,49 @@ bool Rows_log_event::write_data_header(I }); int6store(buf + RW_MAPID_OFFSET, (ulonglong)m_table_id); int2store(buf + RW_FLAGS_OFFSET, m_flags); + int rc = 0; #ifndef MCP_WL5353 - int rc = my_b_safe_write(file, buf, ROWS_HEADER_LEN); - - if ((rc == 0) && - (m_flags & EXTRA_ROW_EV_DATA_F)) + if (likely(!log_bin_use_v1_row_events)) { - /* Write extra row data */ - rc = my_b_safe_write(file, m_extra_row_data, - m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET]); - } + /* + v2 event, with variable header portion. + Determine length of variable header payload + */ + uint16 vhlen= 2; + uint16 vhpayloadlen= 0; + uint16 extra_data_len= 0; + if (m_extra_row_data) + { + extra_data_len= m_extra_row_data[EXTRA_ROW_INFO_LEN_OFFSET]; + vhpayloadlen= RW_V_TAG_LEN + extra_data_len; + } - /* Function returns bool, where false(0) is success :( */ - return (rc != 0); + /* Var-size header len includes len itself */ + int2store(buf + RW_VHLEN_OFFSET, vhlen + vhpayloadlen); + rc= my_b_safe_write(file, buf, ROWS_HEADER_LEN_V2); + + /* Write var-sized payload, if any */ + if ((vhpayloadlen > 0) && + (rc == 0)) + { + /* Add tag and extra row info */ + uchar type_code= RW_V_EXTRAINFO_TAG; + rc= my_b_safe_write(file, &type_code, RW_V_TAG_LEN); + if (rc==0) + rc= my_b_safe_write(file, m_extra_row_data, extra_data_len); + } + } + else +#endif + rc= my_b_safe_write(file, buf, +#ifndef MCP_WL5353 + ROWS_HEADER_LEN_V1 #else - return (my_b_safe_write(file, buf, ROWS_HEADER_LEN)); + ROWS_HEADER_LEN #endif + ); + + return (rc != 0); } bool Rows_log_event::write_data_body(IO_CACHE*file) @@ -8167,7 +8320,13 @@ bool Rows_log_event::write_data_body(IO_ /* TODO[refactor write]: Remove the "down cast" here (and elsewhere). */ - if (get_type_code() == UPDATE_ROWS_EVENT) + if ( +#ifndef MCP_WL5353 + get_general_type_code() +#else + get_type_code() +#endif + == UPDATE_ROWS_EVENT) { DBUG_DUMP("m_cols_ai", (uchar*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai)); @@ -8702,8 +8861,19 @@ void Table_map_log_event::print(FILE *, Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid_arg, MY_BITMAP const *cols, - bool is_transactional) - : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional) + bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) + : Rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional +#ifndef MCP_WL5353 + ,log_bin_use_v1_row_events? + WRITE_ROWS_EVENT_V1: + WRITE_ROWS_EVENT, + extra_row_info +#endif + ) { } #endif @@ -8714,8 +8884,18 @@ Write_rows_log_event::Write_rows_log_eve #ifdef HAVE_REPLICATION Write_rows_log_event::Write_rows_log_event(const char *buf, uint event_len, const Format_description_log_event - *description_event) -: Rows_log_event(buf, event_len, WRITE_ROWS_EVENT, description_event) + *description_event +#ifndef MCP_WL5353 + ,Log_event_type event_type +#endif + ) +: Rows_log_event(buf, event_len, +#ifndef MCP_WL5353 + event_type, +#else + WRITE_ROW_EVENT +#endif + description_event) { } #endif @@ -9573,8 +9753,19 @@ err: #ifndef MYSQL_CLIENT Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, MY_BITMAP const *cols, - bool is_transactional) - : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional) + bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) + : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional +#ifndef MCP_WL5353 + ,log_bin_use_v1_row_events? + DELETE_ROWS_EVENT_V1: + DELETE_ROWS_EVENT, + extra_row_info +#endif + ) { } #endif /* #if !defined(MYSQL_CLIENT) */ @@ -9585,8 +9776,18 @@ Delete_rows_log_event::Delete_rows_log_e #ifdef HAVE_REPLICATION Delete_rows_log_event::Delete_rows_log_event(const char *buf, uint event_len, const Format_description_log_event - *description_event) - : Rows_log_event(buf, event_len, DELETE_ROWS_EVENT, description_event) + *description_event +#ifndef MCP_WL5353 + ,Log_event_type event_type +#endif + ) + : Rows_log_event(buf, event_len, +#ifndef MCP_WL5353 + event_type, +#else + DELETE_ROWS_EVENT +#endif + description_event) { } #endif @@ -9665,8 +9866,19 @@ Update_rows_log_event::Update_rows_log_e ulong tid, MY_BITMAP const *cols_bi, MY_BITMAP const *cols_ai, - bool is_transactional) -: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional) + bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) +: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional +#ifndef MCP_WL5353 + ,log_bin_use_v1_row_events? + UPDATE_ROWS_EVENT_V1: + UPDATE_ROWS_EVENT, + extra_row_info +#endif + ) { init(cols_ai); } @@ -9674,8 +9886,19 @@ Update_rows_log_event::Update_rows_log_e Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, MY_BITMAP const *cols, - bool is_transactional) -: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional) + bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) +: Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional +#ifndef MCP_WL5353 + ,log_bin_use_v1_row_events? + UPDATE_ROWS_EVENT_V1: + UPDATE_ROWS_EVENT, + extra_row_info +#endif + ) { init(cols); } @@ -9714,8 +9937,18 @@ Update_rows_log_event::~Update_rows_log_ Update_rows_log_event::Update_rows_log_event(const char *buf, uint event_len, const Format_description_log_event - *description_event) - : Rows_log_event(buf, event_len, UPDATE_ROWS_EVENT, description_event) + *description_event +#ifndef MCP_WL5353 + ,Log_event_type event_type +#endif + ) + : Rows_log_event(buf, event_len, +#ifndef MCP_WL5353 + event_type, +#else + UPDATE_ROWS_EVENT, +#endif + description_event) { } #endif === modified file 'sql/log_event.h' --- a/sql/log_event.h 2011-09-07 22:50:01 +0000 +++ b/sql/log_event.h 2011-09-19 10:27:54 +0000 @@ -247,12 +247,19 @@ struct sql_ex_info #define FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES) #define XID_HEADER_LEN 0 #define BEGIN_LOAD_QUERY_HEADER_LEN APPEND_BLOCK_HEADER_LEN +#ifndef MCP_WL5353 +#define ROWS_HEADER_LEN_V1 8 +#else #define ROWS_HEADER_LEN 8 +#endif #define TABLE_MAP_HEADER_LEN 8 #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) #define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN) #define INCIDENT_HEADER_LEN 2 #define HEARTBEAT_HEADER_LEN 0 +#ifndef MCP_WL5353 +#define ROWS_HEADER_LEN_V2 10 +#endif /* Max number of possible extra bytes in a replication event compared to a packet (i.e. a query) sent from client to master; @@ -393,6 +400,11 @@ struct sql_ex_info /* RW = "RoWs" */ #define RW_MAPID_OFFSET 0 #define RW_FLAGS_OFFSET 6 +#ifndef MCP_WL5353 +#define RW_VHLEN_OFFSET 8 +#define RW_V_TAG_LEN 1 +#define RW_V_EXTRAINFO_TAG 0 +#endif /* ELQ = "Execute Load Query" */ #define ELQ_FILE_ID_OFFSET QUERY_HEADER_LEN @@ -591,9 +603,15 @@ enum Log_event_type /* These event numbers are used from 5.1.16 and forward */ +#ifndef MCP_WL5353 + WRITE_ROWS_EVENT_V1 = 23, + UPDATE_ROWS_EVENT_V1 = 24, + DELETE_ROWS_EVENT_V1 = 25, +#else WRITE_ROWS_EVENT = 23, UPDATE_ROWS_EVENT = 24, DELETE_ROWS_EVENT = 25, +#endif /* Something out of the ordinary happened on the master @@ -606,6 +624,21 @@ enum Log_event_type */ HEARTBEAT_LOG_EVENT= 27, +#ifndef MCP_WL5353 + /* + These event numbers are used in later releases (but not here) + */ + IGNORABLE_LOG_EVENT= 28, + ROWS_QUERY_LOG_EVENT= 29, + + /* + These event numbers are used in MySQL Cluster 5.1-telco-* + */ + WRITE_ROWS_EVENT = 30, + UPDATE_ROWS_EVENT = 31, + DELETE_ROWS_EVENT = 32, +#endif + /* Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never change their numbers @@ -3509,13 +3542,6 @@ public: values for all columns of the table. */ COMPLETE_ROWS_F = (1U << 3) - -#ifndef MCP_WL5353 - /** - Indicates that additional information was appended to the event. - */ - ,EXTRA_ROW_EV_DATA_F = (1U << 4) -#endif }; typedef uint16 flag_set; @@ -3532,6 +3558,11 @@ public: void clear_flags(flag_set flags_arg) { m_flags &= ~flags_arg; } flag_set get_flags(flag_set flags_arg) const { return m_flags & flags_arg; } +#ifndef MCP_WL5353 + Log_event_type get_type_code() { return m_type; } /* Specific type (_V1 etc) */ + virtual Log_event_type get_general_type_code() = 0; /* General type */ +#endif + #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) virtual void pack_info(Protocol *protocol); #endif @@ -3590,7 +3621,12 @@ protected: */ #ifndef MYSQL_CLIENT Rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); + MY_BITMAP const *cols, bool is_transactional, + Log_event_type event_type +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); #endif Rows_log_event(const char *row_data, uint event_len, Log_event_type event_type, @@ -3632,6 +3668,8 @@ protected: flag_set m_flags; /* Flags for row-level events */ #ifndef MCP_WL5353 + Log_event_type m_type; /* Actual event type */ + uchar *m_extra_row_data; /* Pointer to extra row data if any */ /* If non null, first byte is length */ #endif @@ -3739,15 +3777,26 @@ public: { /* Support interface to THD::binlog_prepare_pending_rows_event */ TYPE_CODE = WRITE_ROWS_EVENT +#ifndef MCP_WL5353 + ,TYPE_CODE_V1 = WRITE_ROWS_EVENT_V1 +#endif }; #if !defined(MYSQL_CLIENT) Write_rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); + MY_BITMAP const *cols, bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); #endif #ifdef HAVE_REPLICATION Write_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); + const Format_description_log_event *description_event +#ifndef MCP_WL5353 + ,Log_event_type event_type +#endif + ); #endif #if !defined(MYSQL_CLIENT) static bool binlog_row_logging_function(THD *thd, TABLE *table, @@ -3759,12 +3808,20 @@ public: const uchar *after_record) { return thd->binlog_write_row(table, is_transactional, - cols, fields, after_record); + cols, fields, after_record +#ifndef MCP_WL5353 + , NULL +#endif + ); } #endif private: +#ifndef MCP_WL5353 + virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } +#else virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } +#endif #ifdef MYSQL_CLIENT void print(FILE *file, PRINT_EVENT_INFO *print_event_info); @@ -3797,17 +3854,28 @@ public: { /* Support interface to THD::binlog_prepare_pending_rows_event */ TYPE_CODE = UPDATE_ROWS_EVENT +#ifndef MCP_WL5353 + ,TYPE_CODE_V1 = UPDATE_ROWS_EVENT_V1 +#endif }; #ifndef MYSQL_CLIENT Update_rows_log_event(THD*, TABLE*, ulong table_id, MY_BITMAP const *cols_bi, MY_BITMAP const *cols_ai, - bool is_transactional); + bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); Update_rows_log_event(THD*, TABLE*, ulong table_id, MY_BITMAP const *cols, - bool is_transactional); + bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); void init(MY_BITMAP const *cols); #endif @@ -3816,7 +3884,11 @@ public: #ifdef HAVE_REPLICATION Update_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); + const Format_description_log_event *description_event +#ifndef MCP_WL5353 + ,Log_event_type event_type +#endif + ); #endif #if !defined(MYSQL_CLIENT) @@ -3828,7 +3900,11 @@ public: const uchar *after_record) { return thd->binlog_update_row(table, is_transactional, - cols, fields, before_record, after_record); + cols, fields, before_record, after_record +#ifndef MCP_WL5353 + , NULL +#endif + ); } #endif @@ -3838,7 +3914,11 @@ public: } protected: +#ifndef MCP_WL5353 + virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } +#else virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } +#endif #ifdef MYSQL_CLIENT void print(FILE *file, PRINT_EVENT_INFO *print_event_info); @@ -3878,15 +3958,26 @@ public: { /* Support interface to THD::binlog_prepare_pending_rows_event */ TYPE_CODE = DELETE_ROWS_EVENT +#ifndef MCP_WL5353 + ,TYPE_CODE_V1 = DELETE_ROWS_EVENT_V1 +#endif }; #ifndef MYSQL_CLIENT Delete_rows_log_event(THD*, TABLE*, ulong, - MY_BITMAP const *cols, bool is_transactional); + MY_BITMAP const *cols, bool is_transactional +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); #endif #ifdef HAVE_REPLICATION Delete_rows_log_event(const char *buf, uint event_len, - const Format_description_log_event *description_event); + const Format_description_log_event *description_event +#ifndef MCP_WL5353 + ,Log_event_type event_type +#endif + ); #endif #if !defined(MYSQL_CLIENT) static bool binlog_row_logging_function(THD *thd, TABLE *table, @@ -3898,12 +3989,20 @@ public: __attribute__((unused))) { return thd->binlog_delete_row(table, is_transactional, - cols, fields, before_record); + cols, fields, before_record +#ifndef MCP_WL5353 + , NULL +#endif + ); } #endif protected: +#ifndef MCP_WL5353 + virtual Log_event_type get_general_type_code() { return (Log_event_type)TYPE_CODE; } +#else virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } +#endif #ifdef MYSQL_CLIENT void print(FILE *file, PRINT_EVENT_INFO *print_event_info); === modified file 'sql/log_event_old.h' --- a/sql/log_event_old.h 2009-05-26 18:53:34 +0000 +++ b/sql/log_event_old.h 2011-09-19 10:27:54 +0000 @@ -44,6 +44,9 @@ but we keep them this way for now. /Sven */ +#ifndef MCP_WL5353 +#define ROWS_HEADER_LEN ROWS_HEADER_LEN_V1 +#endif /** @class Old_rows_log_event @@ -377,7 +380,11 @@ public: const uchar *after_record) { return thd->binlog_write_row(table, is_transactional, - cols, fields, after_record); + cols, fields, after_record +#ifndef MCP_WL5353 + , NULL +#endif + ); } #endif @@ -453,7 +460,11 @@ public: const uchar *after_record) { return thd->binlog_update_row(table, is_transactional, - cols, fields, before_record, after_record); + cols, fields, before_record, after_record +#ifndef MCP_WL5353 + , NULL +#endif + ); } #endif @@ -528,7 +539,11 @@ public: __attribute__((unused))) { return thd->binlog_delete_row(table, is_transactional, - cols, fields, before_record); + cols, fields, before_record +#ifndef MCP_WL5353 + , NULL +#endif + ); } #endif === modified file 'sql/mysql_priv.h' --- a/sql/mysql_priv.h 2011-06-30 15:59:25 +0000 +++ b/sql/mysql_priv.h 2011-09-19 10:27:54 +0000 @@ -1965,6 +1965,9 @@ extern my_bool slave_allow_batching; #endif extern ulong slave_net_timeout, slave_trans_retries; extern uint max_user_connections; +#ifndef MCP_WL5353 +extern my_bool log_bin_use_v1_row_events; +#endif extern ulong what_to_log,flush_time; extern ulong query_buff_size; extern ulong max_prepared_stmt_count, prepared_stmt_count; === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2011-06-30 15:59:25 +0000 +++ b/sql/mysqld.cc 2011-09-19 10:27:54 +0000 @@ -561,6 +561,9 @@ ulong specialflag=0; ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; ulong max_connections, max_connect_errors; uint max_user_connections= 0; +#ifndef MCP_WL5353 +my_bool log_bin_use_v1_row_events= 0; +#endif /** Limit of the total number of prepared statements in the server. Is necessary to protect the server against out-of-memory attacks. @@ -5852,6 +5855,9 @@ enum options_mysqld OPT_IGNORE_BUILTIN_INNODB, OPT_BINLOG_DIRECT_NON_TRANS_UPDATE, OPT_DEFAULT_CHARACTER_SET_OLD +#ifndef MCP_WL5353 + ,OPT_LOG_BIN_USE_V1_ROW_EVENTS +#endif }; @@ -6134,6 +6140,15 @@ each time the SQL thread starts.", "break, so you can safely set this to 1." ,&trust_function_creators, &trust_function_creators, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#ifndef MCP_WL5353 + {"log-bin-use-v1-row-events", OPT_LOG_BIN_USE_V1_ROW_EVENTS, + "If equal to 1 then version 1 row events are written to a row based " + "binary log. If equal to 0, then the latest version of events are " + "written. " + "This option is useful during some upgrades.", + &log_bin_use_v1_row_events, &log_bin_use_v1_row_events, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"log-error", OPT_ERROR_LOG_FILE, "Error log file.", &log_error_file_ptr, &log_error_file_ptr, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, === modified file 'sql/rpl_constants.h' --- a/sql/rpl_constants.h 2011-09-07 22:50:01 +0000 +++ b/sql/rpl_constants.h 2011-09-19 10:27:54 +0000 @@ -71,6 +71,6 @@ enum ExtraRowInfoFormat { #define EXTRA_ROW_INFO_HDR_BYTES 2 #define EXTRA_ROW_INFO_MAX_PAYLOAD (255 - EXTRA_ROW_INFO_HDR_BYTES) -#endif // #ifndef MCP_WL5353 +#endif #endif /* RPL_CONSTANTS_H */ === modified file 'sql/rpl_injector.cc' --- a/sql/rpl_injector.cc 2011-06-30 15:59:25 +0000 +++ b/sql/rpl_injector.cc 2011-09-19 10:27:54 +0000 @@ -122,7 +122,11 @@ int injector::transaction::use_table(ser int injector::transaction::write_row (server_id_type sid, table tbl, MY_BITMAP const* cols, size_t colcnt, - record_type record) + record_type record +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) { DBUG_ENTER("injector::transaction::write_row(...)"); @@ -133,15 +137,31 @@ int injector::transaction::write_row (se server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); error= m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(), - cols, colcnt, record); + cols, colcnt, record +#ifndef MCP_WL5353 + , extra_row_info +#endif + ); m_thd->set_server_id(save_id); DBUG_RETURN(error); } +#ifndef MCP_WL5353 +int injector::transaction::write_row (server_id_type sid, table tbl, + MY_BITMAP const* cols, size_t colcnt, + record_type record) +{ + return write_row(sid, tbl, cols, colcnt, record, NULL); +} +#endif int injector::transaction::delete_row(server_id_type sid, table tbl, MY_BITMAP const* cols, size_t colcnt, - record_type record) + record_type record +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) { DBUG_ENTER("injector::transaction::delete_row(...)"); @@ -152,15 +172,31 @@ int injector::transaction::delete_row(se server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); error= m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(), - cols, colcnt, record); + cols, colcnt, record +#ifndef MCP_WL5353 + , extra_row_info +#endif + ); m_thd->set_server_id(save_id); DBUG_RETURN(error); } +#ifndef MCP_WL5353 +int injector::transaction::delete_row(server_id_type sid, table tbl, + MY_BITMAP const* cols, size_t colcnt, + record_type record) +{ + return delete_row(sid, tbl, cols, colcnt, record, NULL); +} +#endif int injector::transaction::update_row(server_id_type sid, table tbl, MY_BITMAP const* cols, size_t colcnt, - record_type before, record_type after) + record_type before, record_type after +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) { DBUG_ENTER("injector::transaction::update_row(...)"); @@ -171,11 +207,23 @@ int injector::transaction::update_row(se server_id_type save_id= m_thd->server_id; m_thd->set_server_id(sid); error= m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(), - cols, colcnt, before, after); + cols, colcnt, before, after +#ifndef MCP_WL5353 + , extra_row_info +#endif + ); m_thd->set_server_id(save_id); DBUG_RETURN(error); } +#ifndef MCP_WL5353 +int injector::transaction::update_row(server_id_type sid, table tbl, + MY_BITMAP const* cols, size_t colcnt, + record_type before, record_type after) +{ + return update_row(sid, tbl, cols, colcnt, before, after, NULL); +} +#endif injector::transaction::binlog_pos injector::transaction::start_pos() const { === modified file 'sql/rpl_injector.h' --- a/sql/rpl_injector.h 2011-06-30 15:59:25 +0000 +++ b/sql/rpl_injector.h 2011-09-19 10:27:54 +0000 @@ -188,6 +188,12 @@ public: /* Add a 'write row' entry to the transaction. */ +#ifndef MCP_WL5353 + int write_row (server_id_type sid, table tbl, + MY_BITMAP const *cols, size_t colcnt, + record_type record, + const uchar* extra_row_info); +#endif int write_row (server_id_type sid, table tbl, MY_BITMAP const *cols, size_t colcnt, record_type record); @@ -195,17 +201,28 @@ public: /* Add a 'delete row' entry to the transaction. */ +#ifndef MCP_WL5353 int delete_row(server_id_type sid, table tbl, MY_BITMAP const *cols, size_t colcnt, + record_type record, + const uchar* extra_row_info); +#endif + int delete_row(server_id_type sid, table tbl, + MY_BITMAP const *cols, size_t colcnt, record_type record); /* Add an 'update row' entry to the transaction. */ +#ifndef MCP_WL5353 int update_row(server_id_type sid, table tbl, MY_BITMAP const *cols, size_t colcnt, + record_type before, record_type after, + const uchar* extra_row_info); +#endif + int update_row(server_id_type sid, table tbl, + MY_BITMAP const *cols, size_t colcnt, record_type before, record_type after); - /* Commit a transaction. === modified file 'sql/set_var.cc' --- a/sql/set_var.cc 2011-06-30 15:59:25 +0000 +++ b/sql/set_var.cc 2011-09-19 10:27:54 +0000 @@ -354,6 +354,11 @@ sys_trust_routine_creators(&vars, "log_b static sys_var_bool_ptr sys_trust_function_creators(&vars, "log_bin_trust_function_creators", &trust_function_creators); +#ifndef MCP_WL5353 +static sys_var_const sys_log_bin_use_v1_row_events(&vars, "log_bin_use_v1_row_events", + OPT_GLOBAL, SHOW_MY_BOOL, + (uchar*) &log_bin_use_v1_row_events); +#endif static sys_var_const sys_log_error(&vars, "log_error", OPT_GLOBAL, SHOW_CHAR, (uchar*) log_error_file); === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2011-09-07 22:50:01 +0000 +++ b/sql/sql_class.cc 2011-09-19 10:27:54 +0000 @@ -3515,7 +3515,11 @@ THD::binlog_prepare_pending_rows_event(T size_t colcnt, size_t needed, bool is_transactional, - RowsEventT *hint __attribute__((unused))) + RowsEventT *hint __attribute__((unused)) +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) { DBUG_ENTER("binlog_prepare_pending_rows_event"); /* Pre-conditions */ @@ -3556,14 +3560,17 @@ THD::binlog_prepare_pending_rows_event(T #ifndef MCP_WL5353 || !binlog_row_event_extra_data_eq(pending->get_extra_row_data(), - binlog_row_event_extra_data) + extra_row_info) #endif ) { /* Create a new RowsEventT... */ Rows_log_event* const - ev= new RowsEventT(this, table, table->s->table_map_id, cols, - is_transactional); + ev= new RowsEventT(this, table, table->s->table_map_id, cols, is_transactional +#ifndef MCP_WL5353 + , extra_row_info +#endif + ); if (unlikely(!ev)) DBUG_RETURN(NULL); ev->server_id= serv_id; // I don't like this, it's too easy to forget. @@ -3590,17 +3597,29 @@ THD::binlog_prepare_pending_rows_event(T template Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, size_t, size_t, bool, - Write_rows_log_event*); + Write_rows_log_event* +#ifndef MCP_WL5353 + ,const uchar* +#endif + ); template Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, size_t colcnt, size_t, bool, - Delete_rows_log_event *); + Delete_rows_log_event * +#ifndef MCP_WL5353 + ,const uchar* +#endif + ); template Rows_log_event* THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, size_t colcnt, size_t, bool, - Update_rows_log_event *); + Update_rows_log_event * +#ifndef MCP_WL5353 + ,const uchar* +#endif + ); #endif #ifdef NOT_USED @@ -3792,7 +3811,11 @@ namespace { int THD::binlog_write_row(TABLE* table, bool is_trans, MY_BITMAP const* cols, size_t colcnt, - uchar const *record) + uchar const *record +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) { DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); @@ -3811,7 +3834,11 @@ int THD::binlog_write_row(TABLE* table, Rows_log_event* const ev= binlog_prepare_pending_rows_event(table, server_id, cols, colcnt, len, is_trans, - static_cast(0)); + static_cast(0) +#ifndef MCP_WL5353 + ,extra_row_info +#endif + ); if (unlikely(ev == 0)) return HA_ERR_OUT_OF_MEM; @@ -3822,7 +3849,11 @@ int THD::binlog_write_row(TABLE* table, int THD::binlog_update_row(TABLE* table, bool is_trans, MY_BITMAP const* cols, size_t colcnt, const uchar *before_record, - const uchar *after_record) + const uchar *after_record +#ifndef MCP_WL5353 + ,const uchar *extra_row_info +#endif + ) { DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); @@ -3855,7 +3886,11 @@ int THD::binlog_update_row(TABLE* table, Rows_log_event* const ev= binlog_prepare_pending_rows_event(table, server_id, cols, colcnt, before_size + after_size, is_trans, - static_cast(0)); + static_cast(0) +#ifndef MCP_WL5353 + ,extra_row_info +#endif + ); if (unlikely(ev == 0)) return HA_ERR_OUT_OF_MEM; @@ -3867,7 +3902,11 @@ int THD::binlog_update_row(TABLE* table, int THD::binlog_delete_row(TABLE* table, bool is_trans, MY_BITMAP const* cols, size_t colcnt, - uchar const *record) + uchar const *record +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ) { DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open()); @@ -3886,7 +3925,11 @@ int THD::binlog_delete_row(TABLE* table, Rows_log_event* const ev= binlog_prepare_pending_rows_event(table, server_id, cols, colcnt, len, is_trans, - static_cast(0)); + static_cast(0) +#ifndef MCP_WL5353 + ,extra_row_info +#endif + ); if (unlikely(ev == 0)) return HA_ERR_OUT_OF_MEM; @@ -4079,29 +4122,6 @@ int THD::binlog_query(THD::enum_binlog_q #ifndef MCP_WL5353 /** - get_binlog_row_event_extra_data_len - - Returns the length in bytes of the current thread's - binlog row event extra data, if present. - The length is stored at some offset from the extra - data ptr. - Note that this length is the length of the whole extra - data structure, including the fixed length header - of size EXTRA_ROW_INFO_HDR_BYTES - - @return - Length in bytes of the extra data. - Zero is valid. Maximum is 255 -*/ -uint8 -THD::get_binlog_row_event_extra_data_len() const -{ - return (binlog_row_event_extra_data? - binlog_row_event_extra_data[EXTRA_ROW_INFO_LEN_OFFSET]: - 0); -}; - -/** binlog_row_event_extra_data_eq Comparator for two binlog row event extra data @@ -4132,8 +4152,7 @@ THD::binlog_row_event_extra_data_eq(cons (memcmp(a, b, a[EXTRA_ROW_INFO_LEN_OFFSET]) == 0))); } - -#endif // #ifndef MCP_WL5353 +#endif bool Discrete_intervals_list::append(ulonglong start, ulonglong val, ulonglong incr) === modified file 'sql/sql_class.h' --- a/sql/sql_class.h 2011-09-07 22:50:01 +0000 +++ b/sql/sql_class.h 2011-09-19 10:27:54 +0000 @@ -1442,7 +1442,6 @@ public: */ uchar* binlog_row_event_extra_data; - uint8 get_binlog_row_event_extra_data_len() const; static bool binlog_row_event_extra_data_eq(const uchar* a, const uchar* b); #endif @@ -1458,13 +1457,25 @@ public: int binlog_write_table_map(TABLE *table, bool is_transactional); int binlog_write_row(TABLE* table, bool is_transactional, MY_BITMAP const* cols, size_t colcnt, - const uchar *buf); + const uchar *buf +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); int binlog_delete_row(TABLE* table, bool is_transactional, MY_BITMAP const* cols, size_t colcnt, - const uchar *buf); + const uchar *buf +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); int binlog_update_row(TABLE* table, bool is_transactional, MY_BITMAP const* cols, size_t colcnt, - const uchar *old_data, const uchar *new_data); + const uchar *old_data, const uchar *new_data +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); void set_server_id(uint32 sid) { server_id = sid; } @@ -1477,7 +1488,11 @@ public: size_t colcnt, size_t needed, bool is_transactional, - RowsEventT* hint); + RowsEventT* hint +#ifndef MCP_WL5353 + ,const uchar* extra_row_info +#endif + ); Rows_log_event* binlog_get_pending_rows_event() const; void binlog_set_pending_rows_event(Rows_log_event* ev); int binlog_flush_pending_rows_event(bool stmt_end); No bundle (reason: useless for push emails).