summaryrefslogtreecommitdiff
path: root/sql/rpl_utility.cc
diff options
context:
space:
mode:
authorcbell/Chuck@mysql_cab_desk. <>2007-08-10 12:48:01 -0400
committercbell/Chuck@mysql_cab_desk. <>2007-08-10 12:48:01 -0400
commite8ea4b84c0fd98d0ed312f10cc07fef145ff9c38 (patch)
treed3ef511f255d489f7a8ebaf7ce57c0512a4a2607 /sql/rpl_utility.cc
parentac1767df0942f44ebc3db69c1005ee975804fff4 (diff)
downloadmariadb-git-e8ea4b84c0fd98d0ed312f10cc07fef145ff9c38.tar.gz
BUG#22086 : Extra Slave Col: Char(5) on slave and Char(10) on master cause mysqld crash
This patch adds functionality to row-based replication to ensure the slave's column sizes are >= to that of the master. It also includes some refactoring for the code from WL#3228.
Diffstat (limited to 'sql/rpl_utility.cc')
-rw-r--r--sql/rpl_utility.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 40937e98b27..7ea94fda39f 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -156,6 +156,25 @@ table_def::compatible_with(RELAY_LOG_INFO const *rli_arg, TABLE *table)
rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
}
+ /*
+ Check the slave's field size against that of the master.
+ */
+ if (!error &&
+ !table->field[col]->compatible_field_size(field_metadata(col)))
+ {
+ error= 1;
+ char buf[256];
+ my_snprintf(buf, sizeof(buf), "Column %d size mismatch - "
+ "master has size %d, %s.%s on slave has size %d."
+ " Master's column size should be <= the slave's "
+ "column size.", col,
+ table->field[col]->pack_length_from_metadata(
+ m_field_metadata[col]),
+ tsh->db.str, tsh->table_name.str,
+ table->field[col]->row_pack_length());
+ rli->report(ERROR_LEVEL, ER_BINLOG_ROW_WRONG_TABLE_DEF,
+ ER(ER_BINLOG_ROW_WRONG_TABLE_DEF), buf);
+ }
}
return error;