From: Date: July 23 2007 1:40am Subject: bk commit into 5.1 tree (cbell:1.2565) List-Archive: http://lists.mysql.com/commits/31455 Message-Id: <200707222340.l6MNei6Y014951@mail.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of cbell. When cbell does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-07-22 19:40:25-04:00, cbell@mysql_cab_desk. +11 -0 WL#3915 : (NDB) master's cols > slave Slave starts accepting and handling rows of master's tables which have more columns. The most important part of implementation is how to caclulate the amount of bytes to skip for unknown by slave column. To solve that issue this WL adopts results of WL#3228 which introduces an addon to table_map event that carries the necessary part of information about sizes of data of columns. mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test@stripped, 2007-07-22 19:40:20-04:00, cbell@mysql_cab_desk. +397 -0 WL#3915 master's cols > slave basic tests checking altering and skipping extra fields by slave. The fields can be of any possible types. mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test@stripped, 2007-07-22 19:40:20-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/r/rpl_extraColmaster_innodb.result@stripped, 2007-07-22 19:40:20-04:00, cbell@mysql_cab_desk. +272 -0 WL#3915 master's cols > slave new results mysql-test/r/rpl_extraColmaster_innodb.result@stripped, 2007-07-22 19:40:20-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/r/rpl_extraColmaster_myisam.result@stripped, 2007-07-22 19:40:20-04:00, cbell@mysql_cab_desk. +272 -0 WL#3915 master's cols > slave new results mysql-test/r/rpl_extraColmaster_myisam.result@stripped, 2007-07-22 19:40:20-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/t/rpl_extraColmaster_innodb-master.opt@stripped, 2007-07-22 19:40:21-04:00, cbell@mysql_cab_desk. +1 -0 WL#3915 master's cols > slave option for innodb mysql-test/t/rpl_extraColmaster_innodb-master.opt@stripped, 2007-07-22 19:40:21-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/t/rpl_extraColmaster_innodb-slave.opt@stripped, 2007-07-22 19:40:21-04:00, cbell@mysql_cab_desk. +1 -0 WL#3915 master's cols > slave option for innodb mysql-test/t/rpl_extraColmaster_innodb-slave.opt@stripped, 2007-07-22 19:40:21-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/t/rpl_extraColmaster_innodb.test@stripped, 2007-07-22 19:40:22-04:00, cbell@mysql_cab_desk. +14 -0 WL#3915 master's cols > slave test of innodb mysql-test/t/rpl_extraColmaster_innodb.test@stripped, 2007-07-22 19:40:22-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/t/rpl_extraColmaster_myisam.test@stripped, 2007-07-22 19:40:22-04:00, cbell@mysql_cab_desk. +13 -0 WL#3915 master's cols > slave test of myisam mysql-test/t/rpl_extraColmaster_myisam.test@stripped, 2007-07-22 19:40:22-04:00, cbell@mysql_cab_desk. +0 -0 mysql-test/t/rpl_extraColmaster_ndb.test@stripped, 2007-07-22 19:40:22-04:00, cbell@mysql_cab_desk. +11 -0 WL#3915 master's cols > slave test of ndb mysql-test/t/rpl_extraColmaster_ndb.test@stripped, 2007-07-22 19:40:22-04:00, cbell@mysql_cab_desk. +0 -0 sql/log_event.cc@stripped, 2007-07-22 19:40:18-04:00, cbell@mysql_cab_desk. +6 -13 WL#3915 master's cols > slave copying extra (slave's) fields returns early if master's table version is wider; removing assert in the way of master > slave cols. sql/rpl_record.cc@stripped, 2007-07-22 19:40:19-04:00, cbell@mysql_cab_desk. +25 -2 WL#3915 master's cols > slave adding a snippet that shift exectution curson donw the row skipping unknown by slave fields' data. sql/rpl_utility.cc@stripped, 2007-07-22 19:40:19-04:00, cbell@mysql_cab_desk. +2 -2 WL#3915 master's cols > slave do not panic if master's cols > slave. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: cbell # Host: mysql_cab_desk. # Root: C:/source/c++/mysql-5.1_WL_3915_ndb --- 1.280/sql/log_event.cc 2007-07-22 19:40:38 -04:00 +++ 1.281/sql/log_event.cc 2007-07-22 19:40:38 -04:00 @@ -7048,6 +7048,7 @@ my_size_t master_reclength, my_ptrdiff_t master_fields) { + DBUG_ENTER("copy_extra_record_fields(table, master_reclen, master_fields)"); DBUG_PRINT("info", ("Copying to 0x%lx " "from field %lu at offset %lu " "to field %d at offset %lu", @@ -7058,6 +7059,10 @@ Copying the extra fields of the slave that does not exist on master into record[0] (which are basically the default values). */ + + if (table->s->fields < (uint) master_fields) + DBUG_RETURN(0); + DBUG_ASSERT(master_reclength <= table->s->reclength); if (master_reclength < table->s->reclength) bmove_align(table->record[0] + master_reclength, @@ -7115,7 +7120,7 @@ } } } - return 0; // All OK + DBUG_RETURN(0); // All OK } #define DBUG_PRINT_BITSET(N,FRM,BS) \ @@ -7704,12 +7709,6 @@ { int error; DBUG_ASSERT(row_start && row_end); - /* - This assertion actually checks that there is at least as many - columns on the slave as on the master. - */ - DBUG_ASSERT(table->s->fields >= m_width); - error= unpack_row(rli, table, m_width, row_start, &m_cols, row_end, &m_master_reclength, table->read_set, DELETE_ROWS_EVENT); /* @@ -7878,12 +7877,6 @@ { int error; DBUG_ASSERT(row_start && row_end); - /* - This assertion actually checks that there is at least as many - columns on the slave as on the master. - */ - DBUG_ASSERT(table->s->fields >= m_width); - /* We need to perform some juggling below since unpack_row() always unpacks into table->record[0]. For more information, see the --- New file --- +++ mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test 07/07/22 19:40:20 ############################################################# # Purpose: To test having extra columns on the master WL#3915 # engine inspecific sourced part ############################################################# # TODO: partition specific # -- source include/have_partition.inc ########### Clean up ################ --disable_warnings --disable_query_log DROP TABLE IF EXISTS t1,t2,t3,t4,t31; --enable_query_log --enable_warnings # # Setup differently defined tables on master and slave # # Def on master: t (f_1 type_m_1,... f_s type_m_s, f_s1, f_m) # Def on slave: t (f_1 type_s_1,... f_s type_s_s) # where type_mi,type_si (0 < i-1 fields < size()) { DBUG_ASSERT(tsh->db.str && tsh->table_name.str); - error= 1; - slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF, + error= 0; + slave_print_msg(WARNING_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF, "Table width mismatch - " "received %u columns, %s.%s has %u columns", (uint) size(), tsh->db.str, tsh->table_name.str, --- 1.3/sql/rpl_record.cc 2007-07-22 19:40:38 -04:00 +++ 1.4/sql/rpl_record.cc 2007-07-22 19:40:38 -04:00 @@ -144,7 +144,8 @@ @param rli Relay log info @param table Table to unpack into @param colcnt Number of columns to read from record - @param row Packed row data + @param row_data + Packed row data @param cols Pointer to columns data to fill in @param row_end Pointer to variable that will hold the value of the one-after-end position for the row @@ -194,7 +195,7 @@ unsigned int null_bits= *null_ptr++; uint i= 0; table_def *tabledef= const_cast(rli)->get_tabledef(table); - for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr ; ++field_ptr) + for (field_ptr= begin_ptr ; field_ptr < end_ptr && *field_ptr; ++field_ptr) { Field *const f= *field_ptr; @@ -236,6 +237,28 @@ bitmap_set_bit(rw_set, f->field_index); null_mask <<= 1; i++; + } + } + + /* + throw away master's extra fields + */ + uint max_cols= tabledef->size(); + for (; i < cols->n_bits && i < max_cols; i++) + { + if (bitmap_is_set(cols, i)) + { + if ((null_mask & 0xFF) == 0) + { + DBUG_ASSERT(null_ptr < row_data + master_null_byte_count); + null_mask= 1U; + null_bits= *null_ptr++; + } + DBUG_ASSERT(null_mask & 0xFF); // One of the 8 LSB should be set + + if (!((null_bits & null_mask) && tabledef->maybe_null(i))) + pack_ptr+= tabledef->get_field_size(i, (uchar *) pack_ptr); + null_mask <<= 1; } }