summaryrefslogtreecommitdiff
path: root/sql/rpl_injector.cc
diff options
context:
space:
mode:
authorunknown <mats@mysql.com>2006-02-24 16:19:55 +0100
committerunknown <mats@mysql.com>2006-02-24 16:19:55 +0100
commit613fb54f95f440baa02ba31fbc317c2a880f3513 (patch)
treee45e91976dfa93a26c07b19e063f5073126ba2d2 /sql/rpl_injector.cc
parent738a1ca08db810aa37069da149aa21590292caac (diff)
downloadmariadb-git-613fb54f95f440baa02ba31fbc317c2a880f3513.tar.gz
WL#3023 (RBR: Use locks in a statement-like manner):
Adaptions to make it work with NDB. mysql-test/extra/binlog_tests/binlog.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/blackhole.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/ctype_cp932.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/ctype_cp932_binlog.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/drop_temp_table.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/insert_select-binlog.test: Using replace_regex to remove table id. mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: Using replace_regex to remove table id. mysql-test/extra/rpl_tests/rpl_flsh_tbls.test: Using replace_regex to remove table id. mysql-test/extra/rpl_tests/rpl_log.test: Using replace_regex to remove table id. mysql-test/extra/rpl_tests/rpl_multi_query.test: Using replace_regex to remove table id. mysql-test/extra/rpl_tests/rpl_row_charset.test: Using replace_regex to remove table id. mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test: Using replace_regex to remove table id. mysql-test/extra/rpl_tests/rpl_stm_charset.test: Using replace_regex to remove table id. mysql-test/include/rpl_row_basic.inc: Removing sync with master on cleanup since there are engines that does not work in a "syncronized" fashion on dropping tables. mysql-test/r/binlog_row_binlog.result: Result change mysql-test/r/binlog_row_blackhole.result: Result change mysql-test/r/binlog_row_ctype_cp932.result: Result change mysql-test/r/binlog_row_ctype_ucs.result: Result change mysql-test/r/binlog_row_insert_select.result: Result change mysql-test/r/binlog_row_mix_innodb_myisam.result: Result change mysql-test/r/ctype_cp932_binlog_row.result: Result change mysql-test/r/rpl_row_basic_11bugs.result: Result change mysql-test/r/rpl_row_basic_2myisam.result: Result change mysql-test/r/rpl_row_basic_3innodb.result: Result change mysql-test/r/rpl_row_charset.result: Result change mysql-test/r/rpl_row_create_table.result: Result change mysql-test/r/rpl_row_delayed_ins.result: Result change mysql-test/r/rpl_row_log.result: Result change mysql-test/r/rpl_row_log_innodb.result: Result change mysql-test/r/rpl_row_max_relay_size.result: Result change mysql-test/r/rpl_row_sp008.result: Result change mysql-test/t/binlog_stm_binlog.test: Using replace_regex to remove table id. mysql-test/t/ndb_binlog_ddl_multi.test: Using replace_regex to remove table id. mysql-test/t/ndb_binlog_ignore_db.test: Using replace_regex to remove table id. mysql-test/t/rpl_heap.test: Using replace_regex to remove table id. mysql-test/t/rpl_loaddata_s.test: Using replace_regex to remove table id. mysql-test/t/rpl_ndb_blob.test: Using replace_regex to remove table id. mysql-test/t/rpl_ndb_disk.test: Using replace_regex to remove table id. mysql-test/t/rpl_row_basic_11bugs.test: Using replace_regex to remove table id. mysql-test/t/rpl_row_create_table.test: Using replace_regex to remove table id. mysql-test/t/rpl_row_drop.test: Using replace_regex to remove table id. mysql-test/t/rpl_row_sp008.test: Using replace_regex to remove table id. mysql-test/t/rpl_sp.test: Using replace_regex to remove table id. mysql-test/t/sp.test: Using replace_regex to remove table id. mysql-test/t/sp_notembedded.test: Using replace_regex to remove table id. mysql-test/t/user_var-binlog.test: Using replace_regex to remove table id. sql/ha_ndbcluster_binlog.cc: Assign_new_table_id() now takes table share. Removed gratuitous friend declaration of ndb_add_binlog_index(). Turning of binlogging during execution of ndb_add_binlog_index(). sql/handler.h: Removed gratuitous friend declaration of ndb_add_binlog_index(). sql/log.cc: Adding debug printout. sql/log_event.cc: Closing thread tables on dummy event. sql/rpl_injector.cc: Added support for new locking scheme. sql/rpl_injector.h: Added support for new locking scheme.
Diffstat (limited to 'sql/rpl_injector.cc')
-rw-r--r--sql/rpl_injector.cc29
1 files changed, 28 insertions, 1 deletions
diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc
index a69dea9a158..a69cfc2b75f 100644
--- a/sql/rpl_injector.cc
+++ b/sql/rpl_injector.cc
@@ -26,7 +26,7 @@
/* inline since it's called below */
inline
injector::transaction::transaction(MYSQL_LOG *log, THD *thd)
- : m_thd(thd)
+ : m_state(START_STATE), m_thd(thd)
{
/*
Default initialization of m_start_pos (which initializes it to garbage).
@@ -64,12 +64,31 @@ int injector::transaction::commit()
DBUG_RETURN(0);
}
+int injector::transaction::use_table(server_id_type sid, table tbl)
+{
+ DBUG_ENTER("injector::transaction::use_table");
+
+ int error;
+
+ if ((error= check_state(TABLE_STATE)))
+ DBUG_RETURN(error);
+
+ m_thd->set_server_id(sid);
+ error= m_thd->binlog_write_table_map(tbl.get_table(),
+ tbl.is_transactional());
+ DBUG_RETURN(error);
+}
+
int injector::transaction::write_row (server_id_type sid, table tbl,
MY_BITMAP const* cols, size_t colcnt,
record_type record)
{
DBUG_ENTER("injector::transaction::write_row(...)");
+
+ if (int error= check_state(ROW_STATE))
+ DBUG_RETURN(error);
+
m_thd->set_server_id(sid);
m_thd->binlog_write_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
@@ -82,6 +101,10 @@ int injector::transaction::delete_row(server_id_type sid, table tbl,
record_type record)
{
DBUG_ENTER("injector::transaction::delete_row(...)");
+
+ if (int error= check_state(ROW_STATE))
+ DBUG_RETURN(error);
+
m_thd->set_server_id(sid);
m_thd->binlog_delete_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, record);
@@ -94,6 +117,10 @@ int injector::transaction::update_row(server_id_type sid, table tbl,
record_type before, record_type after)
{
DBUG_ENTER("injector::transaction::update_row(...)");
+
+ if (int error= check_state(ROW_STATE))
+ DBUG_RETURN(error);
+
m_thd->set_server_id(sid);
m_thd->binlog_update_row(tbl.get_table(), tbl.is_transactional(),
cols, colcnt, before, after);