Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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-04-18 16:02:20+02:00, tomas@stripped +9 -0
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
mysql-test/include/show_binlog_events.inc@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +1 -1
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
mysql-test/r/ndb_binlog_ddl_multi.result@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +55 -55
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
mysql-test/r/ndb_binlog_discover.result@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +8 -8
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
mysql-test/r/ndb_binlog_ignore_db.result@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +1 -1
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
mysql-test/r/ndb_binlog_multi.result@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +34 -34
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
sql/ha_ndbcluster.cc@stripped, 2007-04-18 16:02:18+02:00, tomas@stripped +56
-21
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
sql/ha_ndbcluster.h@stripped, 2007-04-18 16:02:18+02:00, tomas@stripped +3
-1
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
sql/ha_ndbcluster_binlog.cc@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +61 -19
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
sql/ha_ndbcluster_binlog.h@stripped, 2007-04-18 16:02:18+02:00,
tomas@stripped +4 -0
Bug #27076 Cluster does not honor SQL_LOG_BIN flag
- both for data schema operations
- also make sure schema events vet the right server id when injected into the binlog
- use same mechanism to signal server_id in bug#17095, and reserve some "id's" for
flagging special conditions on the event, in this case do not log it
- enable printing of server ids in the testcases to show that we cot it right
# 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: tomas
# Host: whalegate.ndb.mysql.com
# Root: /home/tomas/mysql-5.1-new-rpl
--- 1.435/sql/ha_ndbcluster.cc 2007-04-12 10:05:48 +02:00
+++ 1.436/sql/ha_ndbcluster.cc 2007-04-18 16:02:18 +02:00
@@ -350,7 +350,7 @@
count= 0;
all= NULL;
stmt= NULL;
- error= 0;
+ m_error= FALSE;
query_state&= NDB_QUERY_NORMAL;
options= 0;
(void) hash_init(&open_tables, &my_charset_bin, 5, 0, 0,
@@ -385,7 +385,7 @@
Thd_ndb::init_open_tables()
{
count= 0;
- error= 0;
+ m_error= FALSE;
my_hash_reset(&open_tables);
}
@@ -461,7 +461,7 @@
}
THD *thd= current_thd;
- if (get_thd_ndb(thd)->error)
+ if (get_thd_ndb(thd)->m_error)
local_info->no_uncommitted_rows_count= 0;
DBUG_RETURN(retval + local_info->no_uncommitted_rows_count);
@@ -492,7 +492,7 @@
}
{
THD *thd= current_thd;
- if (get_thd_ndb(thd)->error)
+ if (get_thd_ndb(thd)->m_error)
local_info->no_uncommitted_rows_count= 0;
}
if (result == 0)
@@ -505,7 +505,7 @@
if (m_ha_not_exact_count)
return;
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_execute_failure");
- get_thd_ndb(current_thd)->error= 1;
+ get_thd_ndb(current_thd)->m_error= TRUE;
DBUG_VOID_RETURN;
}
@@ -529,7 +529,7 @@
DBUG_ENTER("ha_ndbcluster::no_uncommitted_rows_reset");
Thd_ndb *thd_ndb= get_thd_ndb(thd);
thd_ndb->count++;
- thd_ndb->error= 0;
+ thd_ndb->m_error= FALSE;
DBUG_VOID_RETURN;
}
@@ -2713,9 +2713,13 @@
op->setValue(no_fields, part_func_value);
}
- if (thd->slave_thread)
- op->setAnyValue(thd->server_id);
-
+ if (unlikely(m_slow_path))
+ {
+ if (!(thd->options & OPTION_BIN_LOG))
+ op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
+ else if (thd->slave_thread)
+ op->setAnyValue(thd->server_id);
+ }
m_rows_changed++;
/*
@@ -2997,9 +3001,13 @@
op->setValue(no_fields, part_func_value);
}
- if (thd->slave_thread)
- op->setAnyValue(thd->server_id);
-
+ if (unlikely(m_slow_path))
+ {
+ if (!(thd->options & OPTION_BIN_LOG))
+ op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
+ else if (thd->slave_thread)
+ op->setAnyValue(thd->server_id);
+ }
/*
Execute update operation if we are not doing a scan for update
and there exist UPDATE AFTER triggers
@@ -3060,9 +3068,15 @@
no_uncommitted_rows_update(-1);
- if (thd->slave_thread)
- ((NdbOperation
*)trans->getLastDefinedOperation())->setAnyValue(thd->server_id);
-
+ if (unlikely(m_slow_path))
+ {
+ if (!(thd->options & OPTION_BIN_LOG))
+ ((NdbOperation *)trans->getLastDefinedOperation())->
+ setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
+ else if (thd->slave_thread)
+ ((NdbOperation *)trans->getLastDefinedOperation())->
+ setAnyValue(thd->server_id);
+ }
if (!(m_primary_key_update || m_delete_cannot_batch))
// If deleting from cursor, NoCommit will be handled in next_result
DBUG_RETURN(0);
@@ -3093,8 +3107,13 @@
DBUG_RETURN(error);
}
- if (thd->slave_thread)
- op->setAnyValue(thd->server_id);
+ if (unlikely(m_slow_path))
+ {
+ if (!(thd->options & OPTION_BIN_LOG))
+ op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
+ else if (thd->slave_thread)
+ op->setAnyValue(thd->server_id);
+ }
}
// Execute delete operation
@@ -4268,6 +4287,10 @@
thd_ndb->stmt= trans;
thd_ndb->query_state&= NDB_QUERY_NORMAL;
thd_ndb->trans_options= 0;
+ thd_ndb->m_slow_path= FALSE;
+ if (thd->slave_thread ||
+ !(thd->options & OPTION_BIN_LOG))
+ thd_ndb->m_slow_path= TRUE;
trans_register_ha(thd, FALSE, ndbcluster_hton);
}
else
@@ -4285,6 +4308,10 @@
thd_ndb->all= trans;
thd_ndb->query_state&= NDB_QUERY_NORMAL;
thd_ndb->trans_options= 0;
+ thd_ndb->m_slow_path= FALSE;
+ if (thd->slave_thread ||
+ !(thd->options & OPTION_BIN_LOG))
+ thd_ndb->m_slow_path= TRUE;
trans_register_ha(thd, TRUE, ndbcluster_hton);
/*
@@ -4325,9 +4352,13 @@
// Start of transaction
m_rows_changed= 0;
m_ops_pending= 0;
+ m_slow_path= thd_ndb->m_slow_path;
#ifdef HAVE_NDB_BINLOG
- if (m_share == ndb_apply_status_share && thd->slave_thread)
- thd_ndb->trans_options|= TNTO_INJECTED_APPLY_STATUS;
+ if (unlikely(m_slow_path))
+ {
+ if (m_share == ndb_apply_status_share && thd->slave_thread)
+ thd_ndb->trans_options|= TNTO_INJECTED_APPLY_STATUS;
+ }
#endif
// TODO remove double pointers...
m_thd_ndb_share= thd_ndb->get_open_table(thd, m_table);
@@ -4474,8 +4505,12 @@
DBUG_RETURN(0);
#ifdef HAVE_NDB_BINLOG
- if (thd->slave_thread)
- ndbcluster_update_apply_status(thd, thd_ndb->trans_options &
TNTO_INJECTED_APPLY_STATUS);
+ if (unlikely(thd_ndb->m_slow_path))
+ {
+ if (thd->slave_thread)
+ ndbcluster_update_apply_status
+ (thd, thd_ndb->trans_options & TNTO_INJECTED_APPLY_STATUS);
+ }
#endif /* HAVE_NDB_BINLOG */
if (execute_commit(thd,trans) != 0)
--- 1.175/sql/ha_ndbcluster.h 2007-04-10 18:26:08 +02:00
+++ 1.176/sql/ha_ndbcluster.h 2007-04-18 16:02:18 +02:00
@@ -623,7 +623,8 @@
uint lock_count;
NdbTransaction *all;
NdbTransaction *stmt;
- int error;
+ bool m_error;
+ bool m_slow_path;
uint32 options;
uint32 trans_options;
List<NDB_SHARE> changed_tables;
@@ -969,6 +970,7 @@
ha_rows m_ops_pending;
bool m_skip_auto_increment;
bool m_blobs_pending;
+ bool m_slow_path;
my_ptrdiff_t m_blobs_offset;
// memory for blobs in one tuple
char *m_blobs_buffer;
--- 1.5/mysql-test/include/show_binlog_events.inc 2007-03-30 10:27:00 +02:00
+++ 1.6/mysql-test/include/show_binlog_events.inc 2007-04-18 16:02:18 +02:00
@@ -1,5 +1,5 @@
--let $binlog_start=106
--replace_result $binlog_start <binlog_start>
---replace_column 2 # 4 # 5 #
+--replace_column 2 # 5 #
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
--eval show binlog events from $binlog_start
--- 1.16/mysql-test/r/ndb_binlog_ddl_multi.result 2006-12-01 15:48:23 +01:00
+++ 1.17/mysql-test/r/ndb_binlog_ddl_multi.result 2007-04-18 16:02:18 +02:00
@@ -10,30 +10,30 @@
create table t2 (a int primary key) engine=ndb;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # create database mysqltest
-master-bin1.000001 # Query # # use `mysqltest`; create table t1 (a int primary key)
engine=ndb
-master-bin1.000001 # Query # # use `test`; create table t2 (a int primary key) engine=ndb
+master-bin1.000001 # Query 1 # create database mysqltest
+master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key)
engine=ndb
+master-bin1.000001 # Query 102 # use `test`; create table t2 (a int primary key)
engine=ndb
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # create database mysqltest
-master-bin.000001 # Query # # use `mysqltest`; create table t1 (a int primary key)
engine=ndb
-master-bin.000001 # Query # # use `test`; create table t2 (a int primary key) engine=ndb
+master-bin.000001 # Query 1 # create database mysqltest
+master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key)
engine=ndb
+master-bin.000001 # Query 102 # use `test`; create table t2 (a int primary key)
engine=ndb
reset master;
reset master;
alter table t2 add column (b int);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; alter table t2 add column (b int)
+master-bin.000001 # Query 102 # use `test`; alter table t2 add column (b int)
reset master;
reset master;
ALTER DATABASE mysqltest CHARACTER SET latin1;
drop table mysqltest.t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1
+master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1
+master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1
reset master;
reset master;
use test;
@@ -42,14 +42,14 @@
create table t1 (a int primary key) engine=ndb;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # BEGIN
-master-bin1.000001 # Table_map # # table_id: # (test.t2)
-master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query # # COMMIT
-master-bin1.000001 # Query # # drop database mysqltest
-master-bin1.000001 # Query # # use `test`; create table t1 (a int primary key) engine=ndb
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 1 # drop database mysqltest
+master-bin1.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb
drop table t2;
reset master;
reset master;
@@ -83,63 +83,63 @@
ENGINE =NDB;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # CREATE LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB
-master-bin1.000001 # Query # # ALTER LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # CREATE TABLESPACE ts1
+master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # DROP TABLESPACE ts1
+master-bin1.000001 # Query 1 # DROP TABLESPACE ts1
ENGINE = NDB
-master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1
ENGINE =NDB
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # CREATE LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB
-master-bin1.000001 # Query # # ALTER LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # CREATE TABLESPACE ts1
+master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # ALTER TABLESPACE ts1
+master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB
-master-bin1.000001 # Query # # DROP TABLESPACE ts1
+master-bin1.000001 # Query 1 # DROP TABLESPACE ts1
ENGINE = NDB
-master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
+master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1
ENGINE =NDB
drop table t1;
reset master;
@@ -154,13 +154,13 @@
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
-master-bin1.000001 # Query # # use `test`; create table t2 (a int key) engine=ndb
-master-bin1.000001 # Query # # use `test`; create table t3 (a int key) engine=ndb
-master-bin1.000001 # Query # # use `test`; rename table `test.t3` to `test.t4`
-master-bin1.000001 # Query # # use `test`; rename table `test.t2` to `test.t3`
-master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
-master-bin1.000001 # Query # # use `test`; rename table `test.t4` to `test.t1`
+master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
+master-bin1.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb
+master-bin1.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4`
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3`
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1`
drop table t1;
drop table t2;
drop table t3;
@@ -177,18 +177,18 @@
drop table t2;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
-master-bin1.000001 # Query # # BEGIN
-master-bin1.000001 # Table_map # # table_id: # (test.t1)
-master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query # # COMMIT
-master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
-master-bin1.000001 # Query # # BEGIN
-master-bin1.000001 # Table_map # # table_id: # (test.t2)
-master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query # # COMMIT
-master-bin1.000001 # Query # # use `test`; drop table t2
+master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 102 # use `test`; drop table t2
--- 1.5/mysql-test/r/ndb_binlog_discover.result 2007-04-03 14:49:54 +02:00
+++ 1.6/mysql-test/r/ndb_binlog_discover.result 2007-04-18 16:02:18 +02:00
@@ -3,15 +3,15 @@
reset master;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Incident # # #1 (LOST_EVENTS)
-master-bin.000001 # Rotate # # master-bin.000002;pos=4
+master-bin.000001 # Incident 1 # #1 (LOST_EVENTS)
+master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
PURGE MASTER LOGS TO 'master-bin.000002';
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query # # BEGIN
-master-bin.000002 # Table_map # # table_id: # (test.t1)
-master-bin.000002 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin.000002 # Write_rows # # table_id: #
-master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000002 # Query # # COMMIT
+master-bin.000002 # Query 1 # BEGIN
+master-bin.000002 # Table_map 1 # table_id: # (test.t1)
+master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+master-bin.000002 # Write_rows 1 # table_id: #
+master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000002 # Query 1 # COMMIT
drop table t1;
--- 1.5/mysql-test/r/ndb_binlog_ignore_db.result 2007-01-07 00:40:41 +01:00
+++ 1.6/mysql-test/r/ndb_binlog_ignore_db.result 2007-04-18 16:02:18 +02:00
@@ -7,5 +7,5 @@
insert into t1 values (1, 1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; drop table if exists t1
+master-bin.000001 # Query 1 # use `test`; drop table if exists t1
drop database mysqltest;
--- 1.8/mysql-test/r/ndb_binlog_multi.result 2007-03-20 08:51:54 +01:00
+++ 1.9/mysql-test/r/ndb_binlog_multi.result 2007-04-18 16:02:18 +02:00
@@ -8,14 +8,14 @@
INSERT INTO t2 VALUES (1,1),(2,2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int)
ENGINE = NDB
-master-bin1.000001 # Query # # BEGIN
-master-bin1.000001 # Table_map # # table_id: # (test.t2)
-master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query # # COMMIT
+master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int)
ENGINE = NDB
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
select * from t2 order by a;
a b
1 1
@@ -31,15 +31,15 @@
DROP TABLE t2;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int)
ENGINE = NDB
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t2)
-master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; DROP TABLE t2
+master-bin.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int)
ENGINE = NDB
+master-bin.000001 # Query 1 # BEGIN
+master-bin.000001 # Table_map 1 # table_id: # (test.t2)
+master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: #
+master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Query 1 # use `test`; DROP TABLE t2
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops
@@ -50,14 +50,14 @@
INSERT INTO t1 VALUES (1),(2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE =
NDB
-master-bin1.000001 # Query # # BEGIN
-master-bin1.000001 # Table_map # # table_id: # (test.t1)
-master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query # # COMMIT
+master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE =
NDB
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch2:=epoch inserts updates deletes schemaops
@@ -69,15 +69,15 @@
drop table t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE =
NDB
-master-bin1.000001 # Query # # BEGIN
-master-bin1.000001 # Table_map # # table_id: # (test.t1)
-master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: #
-master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query # # COMMIT
-master-bin1.000001 # Query # # use `test`; drop table t1
+master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE =
NDB
+master-bin1.000001 # Query 102 # BEGIN
+master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
+master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: #
+master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
+master-bin1.000001 # Query 102 # COMMIT
+master-bin1.000001 # Query 102 # use `test`; drop table t1
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <=
<the_epoch2>;
inserts updates deletes schemaops
--- 1.111/sql/ha_ndbcluster_binlog.cc 2007-04-10 18:26:08 +02:00
+++ 1.112/sql/ha_ndbcluster_binlog.cc 2007-04-18 16:02:18 +02:00
@@ -872,6 +872,7 @@
uint32 id;
uint32 version;
uint32 type;
+ uint32 any_value;
};
/*
@@ -1392,6 +1393,12 @@
/* type */
r|= op->setValue(SCHEMA_TYPE_I, log_type);
DBUG_ASSERT(r == 0);
+ /* any value */
+ if (!(thd->options & OPTION_BIN_LOG))
+ r|= op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING);
+ else
+ r|= op->setAnyValue(thd->server_id);
+ DBUG_ASSERT(r == 0);
if (log_db != new_db && new_db && new_table_name)
{
log_db= new_db;
@@ -1737,6 +1744,31 @@
DBUG_RETURN(0);
}
+static void ndb_binlog_query(THD *thd, Cluster_schema *schema)
+{
+ if (schema->any_value & NDB_ANYVALUE_RESERVED)
+ {
+ if (schema->any_value != NDB_ANYVALUE_FOR_NOLOGGING)
+ sql_print_warning("NDB: unknown value for binlog signalling 0x%X, "
+ "query not logged",
+ schema->any_value);
+ return;
+ }
+ uint32 thd_server_id_save= thd->server_id;
+ DBUG_ASSERT(sizeof(thd_server_id_save) == sizeof(thd->server_id));
+ char *thd_db_save= thd->db;
+ if (schema->any_value == 0)
+ thd->server_id= ::server_id;
+ else
+ thd->server_id= schema->any_value;
+ thd->db= schema->db;
+ thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query,
+ schema->query_length, FALSE,
+ schema->name[0] == 0 || thd->db[0] == 0);
+ thd->server_id= thd_server_id_save;
+ thd->db= thd_db_save;
+}
+
static int
ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
NdbEventOperation *pOp,
@@ -1761,7 +1793,10 @@
MY_BITMAP slock;
bitmap_init(&slock, schema->slock, 8*SCHEMA_SLOCK_SIZE, FALSE);
uint node_id= g_ndb_cluster_connection->node_id();
- ndbcluster_get_schema(tmp_share, schema);
+ {
+ ndbcluster_get_schema(tmp_share, schema);
+ schema->any_value= pOp->getAnyValue();
+ }
enum SCHEMA_OP_TYPE schema_type= (enum SCHEMA_OP_TYPE)schema->type;
DBUG_PRINT("info",
("%s.%s: log query_length: %d query: '%s' type: %d",
@@ -1885,7 +1920,8 @@
run_query(thd, schema->query,
schema->query + schema->query_length,
TRUE, /* print error */
- FALSE); /* binlog the query */
+ TRUE); /* don't binlog the query */
+ log_query= 1;
break;
case SOT_TABLESPACE:
case SOT_LOGFILE_GROUP:
@@ -1895,14 +1931,7 @@
abort();
}
if (log_query && ndb_binlog_running)
- {
- char *thd_db_save= thd->db;
- thd->db= schema->db;
- thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query,
- schema->query_length, FALSE,
- schema->name[0] == 0 || thd->db[0] == 0);
- thd->db= thd_db_save;
- }
+ ndb_binlog_query(thd, schema);
/* signal that schema operation has been handled */
DBUG_DUMP("slock", (char*)schema->slock, schema->slock_length);
if (bitmap_is_set(&slock, node_id))
@@ -2160,14 +2189,7 @@
}
}
if (ndb_binlog_running && log_query)
- {
- char *thd_db_save= thd->db;
- thd->db= schema->db;
- thd->binlog_query(THD::STMT_QUERY_TYPE, schema->query,
- schema->query_length, FALSE,
- schema->name[0] == 0);
- thd->db= thd_db_save;
- }
+ ndb_binlog_query(thd, schema);
}
while ((schema= post_epoch_unlock_list->pop()))
{
@@ -2323,6 +2345,18 @@
{
DBUG_ENTER("ndbcluster_binlog_start");
+ if (::server_id == 0)
+ {
+ sql_print_warning("NDB: server id set to zero will cause any other mysqld "
+ "with bin log to log with wrong server id");
+ }
+ else if (::server_id & 0x1 << 31)
+ {
+ sql_print_error("NDB: server id's with high bit set is reserved for internal "
+ "purposes");
+ 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);
@@ -3192,9 +3226,17 @@
if (share == ndb_apply_status_share)
return 0;
- uint originating_server_id= pOp->getAnyValue();
+ uint32 originating_server_id= pOp->getAnyValue();
if (originating_server_id == 0)
originating_server_id= ::server_id;
+ else if (originating_server_id & NDB_ANYVALUE_RESERVED)
+ {
+ if (originating_server_id != NDB_ANYVALUE_FOR_NOLOGGING)
+ sql_print_warning("NDB: unknown value for binlog signalling 0x%X, "
+ "event not logged",
+ originating_server_id);
+ return 0;
+ }
TABLE *table= share->table;
DBUG_ASSERT(trans.good());
--- 1.23/sql/ha_ndbcluster_binlog.h 2007-04-03 07:20:52 +02:00
+++ 1.24/sql/ha_ndbcluster_binlog.h 2007-04-18 16:02:18 +02:00
@@ -30,6 +30,10 @@
#define NDB_INVALID_SCHEMA_OBJECT 241
+/* server id's with high bit set is reservered */
+#define NDB_ANYVALUE_FOR_NOLOGGING 0xFFFFFFFF
+#define NDB_ANYVALUE_RESERVED 0x80000000
+
extern handlerton *ndbcluster_hton;
/*
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2563) BUG#27076 | tomas | 18 Apr |