Commit b97d63a4 authored by unknown's avatar unknown

Changed mysql.apply_status, mysql.binlog_index, and mysql.schema to...

Changed mysql.apply_status, mysql.binlog_index, and mysql.schema to mysql.ndb_apply_status, mysql.ndb_binlog_index, and mysql.ndb_schema

parent 70c70c15
# #
# now setup replication to continue from last epoch # now setup replication to continue from last epoch
# 1. get apply_status epoch from slave # 1. get ndb_apply_status epoch from slave
# 2. get corresponding _next_ binlog postition from master # 2. get corresponding _next_ binlog postition from master
# 3. change master on slave # 3. change master on slave
# 1. # 1.
--connection slave --connection slave
--replace_column 1 <the_epoch> --replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
--let $the_epoch= `select @the_epoch` --let $the_epoch= `select @the_epoch`
# 2. # 2.
...@@ -15,7 +15,7 @@ SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; ...@@ -15,7 +15,7 @@ SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status;
--replace_result $the_epoch <the_epoch> --replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos> --replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1; FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
--let $the_pos= `SELECT @the_pos` --let $the_pos= `SELECT @the_pos`
--let $the_file= `SELECT @the_file` --let $the_file= `SELECT @the_file`
......
...@@ -634,4 +634,4 @@ CREATE TABLE event ( ...@@ -634,4 +634,4 @@ CREATE TABLE event (
PRIMARY KEY (db, name) PRIMARY KEY (db, name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
CREATE TABLE IF NOT EXISTS mysql.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; CREATE TABLE IF NOT EXISTS mysql.ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
...@@ -2456,8 +2456,8 @@ sub ndbcluster_start ($$) { ...@@ -2456,8 +2456,8 @@ sub ndbcluster_start ($$) {
sub rm_ndbcluster_tables ($) { sub rm_ndbcluster_tables ($) {
my $dir= shift; my $dir= shift;
foreach my $bin ( glob("$dir/mysql/apply_status*"), foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
glob("$dir/mysql/schema*")) glob("$dir/mysql/ndb_schema*"))
{ {
unlink($bin); unlink($bin);
} }
...@@ -4127,12 +4127,12 @@ sub run_testcase_start_servers($) { ...@@ -4127,12 +4127,12 @@ sub run_testcase_start_servers($) {
# tables ok FIXME This is a workaround so that only one mysqld # tables ok FIXME This is a workaround so that only one mysqld
# create the tables # create the tables
if ( ! sleep_until_file_created( if ( ! sleep_until_file_created(
"$master->[0]->{'path_myddir'}/mysql/apply_status.ndb", "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
$master->[0]->{'start_timeout'}, $master->[0]->{'start_timeout'},
$master->[0]->{'pid'})) $master->[0]->{'pid'}))
{ {
$tinfo->{'comment'}= "Failed to create 'mysql/apply_status' table"; $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
return 1; return 1;
} }
} }
......
...@@ -5,7 +5,6 @@ mysql ...@@ -5,7 +5,6 @@ mysql
test test
show tables in mysql; show tables in mysql;
Tables_in_mysql Tables_in_mysql
binlog_index
columns_priv columns_priv
db db
event event
...@@ -16,6 +15,7 @@ help_keyword ...@@ -16,6 +15,7 @@ help_keyword
help_relation help_relation
help_topic help_topic
host host
ndb_binlog_index
plugin plugin
proc proc
procs_priv procs_priv
......
drop table if exists t1,t2; drop table if exists t1,t2;
show tables; show tables;
Tables_in_mysql Tables_in_mysql
binlog_index
columns_priv columns_priv
db db
event event
...@@ -12,6 +11,7 @@ help_keyword ...@@ -12,6 +11,7 @@ help_keyword
help_relation help_relation
help_topic help_topic
host host
ndb_binlog_index
plugin plugin
proc proc
procs_priv procs_priv
...@@ -33,7 +33,6 @@ grant ALL on *.* to test@localhost identified by "gambling"; ...@@ -33,7 +33,6 @@ grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables; show tables;
Tables_in_mysql Tables_in_mysql
binlog_index
columns_priv columns_priv
db db
event event
...@@ -44,6 +43,7 @@ help_keyword ...@@ -44,6 +43,7 @@ help_keyword
help_relation help_relation
help_topic help_topic
host host
ndb_binlog_index
plugin plugin
proc proc
procs_priv procs_priv
...@@ -73,7 +73,6 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number ...@@ -73,7 +73,6 @@ ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;
Tables_in_mysql Tables_in_mysql
binlog_index
columns_priv columns_priv
db db
event event
...@@ -84,6 +83,7 @@ help_keyword ...@@ -84,6 +83,7 @@ help_keyword
help_relation help_relation
help_topic help_topic
host host
ndb_binlog_index
plugin plugin
proc proc
procs_priv procs_priv
......
...@@ -33,7 +33,7 @@ create table t3(a int, KEY a_data (a)); ...@@ -33,7 +33,7 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int); create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key); create table t5 (id int auto_increment primary key);
insert into t5 values (10); insert into t5 values (10);
create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status'; create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status';
select * from v1; select * from v1;
c c
CHARACTER_SETS CHARACTER_SETS
...@@ -849,7 +849,7 @@ VIEWS TABLE_NAME select ...@@ -849,7 +849,7 @@ VIEWS TABLE_NAME select
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4';
flush privileges; flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status' GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*) table_schema count(*)
information_schema 27 information_schema 27
mysql 21 mysql 21
......
...@@ -280,9 +280,9 @@ create table general_log_new like general_log; ...@@ -280,9 +280,9 @@ create table general_log_new like general_log;
create table slow_log_new like slow_log; create table slow_log_new like slow_log;
show tables like "%log%"; show tables like "%log%";
Tables_in_mysql (%log%) Tables_in_mysql (%log%)
binlog_index
general_log general_log
general_log_new general_log_new
ndb_binlog_index
slow_log slow_log
slow_log_new slow_log_new
drop table slow_log_new, general_log_new; drop table slow_log_new, general_log_new;
......
...@@ -2,7 +2,6 @@ drop database if exists client_test_db; ...@@ -2,7 +2,6 @@ drop database if exists client_test_db;
DROP SCHEMA test; DROP SCHEMA test;
CREATE SCHEMA test; CREATE SCHEMA test;
use test; use test;
mysql.binlog_index OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
...@@ -14,6 +13,7 @@ mysql.help_keyword OK ...@@ -14,6 +13,7 @@ mysql.help_keyword OK
mysql.help_relation OK mysql.help_relation OK
mysql.help_topic OK mysql.help_topic OK
mysql.host OK mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK mysql.plugin OK
mysql.proc OK mysql.proc OK
mysql.procs_priv OK mysql.procs_priv OK
...@@ -26,7 +26,6 @@ mysql.time_zone_name OK ...@@ -26,7 +26,6 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.user OK mysql.user OK
mysql.binlog_index OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
...@@ -38,6 +37,7 @@ mysql.help_keyword OK ...@@ -38,6 +37,7 @@ mysql.help_keyword OK
mysql.help_relation OK mysql.help_relation OK
mysql.help_topic OK mysql.help_topic OK
mysql.host OK mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK mysql.plugin OK
mysql.proc OK mysql.proc OK
mysql.procs_priv OK mysql.procs_priv OK
......
...@@ -6,7 +6,7 @@ drop database mysqltest; ...@@ -6,7 +6,7 @@ drop database mysqltest;
use test; use test;
create table t1 (a int primary key) engine=ndb; create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select @max_epoch:=max(epoch)-1 from mysql.binlog_index; select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
@max_epoch:=max(epoch)-1 @max_epoch:=max(epoch)-1
# #
delete from t1; delete from t1;
...@@ -19,19 +19,19 @@ update t2 set b=1 where a=3; ...@@ -19,19 +19,19 @@ update t2 set b=1 where a=3;
delete from t2 where a=4; delete from t2 where a=4;
commit; commit;
drop table t2; drop table t2;
select inserts from mysql.binlog_index where epoch > @max_epoch and inserts > 5; select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5;
inserts inserts
10 10
select deletes from mysql.binlog_index where epoch > @max_epoch and deletes > 5; select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5;
deletes deletes
10 10
select inserts,updates,deletes from select inserts,updates,deletes from
mysql.binlog_index where epoch > @max_epoch and updates > 0; mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0;
inserts updates deletes inserts updates deletes
2 1 1 2 1 1
flush logs; flush logs;
purge master logs before now(); purge master logs before now();
select count(*) from mysql.binlog_index; select count(*) from mysql.ndb_binlog_index;
count(*) count(*)
0 0
create table t1 (a int primary key, b int) engine=ndb; create table t1 (a int primary key, b int) engine=ndb;
...@@ -40,12 +40,12 @@ use mysqltest; ...@@ -40,12 +40,12 @@ use mysqltest;
create table t1 (c int, d int primary key) engine=ndb; create table t1 (c int, d int primary key) engine=ndb;
use test; use test;
insert into mysqltest.t1 values (2,1),(2,2); insert into mysqltest.t1 values (2,1),(2,2);
select @max_epoch:=max(epoch)-1 from mysql.binlog_index; select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
@max_epoch:=max(epoch)-1 @max_epoch:=max(epoch)-1
# #
drop table t1; drop table t1;
drop database mysqltest; drop database mysqltest;
select inserts,updates,deletes from select inserts,updates,deletes from
mysql.binlog_index where epoch > @max_epoch and inserts > 0; mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;
inserts updates deletes inserts updates deletes
2 0 0 2 0 0
...@@ -44,7 +44,7 @@ show binlog events from <binlog_start>; ...@@ -44,7 +44,7 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # table_id: # (test.t2) master-bin1.000001 # Table_map # # table_id: # (test.t2)
master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
...@@ -180,14 +180,14 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -180,14 +180,14 @@ 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 t1 (a int key) engine=ndb
master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # table_id: # (test.t1) master-bin1.000001 # Table_map # # table_id: # (test.t1)
master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2` master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # table_id: # (test.t2) master-bin1.000001 # Table_map # # table_id: # (test.t2)
master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
......
...@@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -11,7 +11,7 @@ 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 # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # table_id: # (test.t2) master-bin1.000001 # Table_map # # table_id: # (test.t2)
master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
...@@ -20,7 +20,7 @@ a b ...@@ -20,7 +20,7 @@ a b
1 1 1 1
2 2 2 2
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
mysql.binlog_index ORDER BY epoch DESC LIMIT 1; mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch:=epoch inserts updates deletes schemaops @the_epoch:=epoch inserts updates deletes schemaops
<the_epoch> 2 0 0 0 <the_epoch> 2 0 0 0
SELECT * FROM t2 ORDER BY a; SELECT * FROM t2 ORDER BY a;
...@@ -33,13 +33,13 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -33,13 +33,13 @@ 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 # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t2 master-bin.000001 # Query # # use `test`; DROP TABLE t2
SELECT inserts,updates,deletes,schemaops FROM SELECT inserts,updates,deletes,schemaops FROM
mysql.binlog_index WHERE epoch=<the_epoch>; mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops inserts updates deletes schemaops
2 0 0 0 2 0 0 0
reset master; reset master;
...@@ -51,16 +51,16 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -51,16 +51,16 @@ 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 # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # table_id: # (test.t1) master-bin1.000001 # Table_map # # table_id: # (test.t1)
master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
mysql.binlog_index ORDER BY epoch DESC LIMIT 1; mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch2:=epoch inserts updates deletes schemaops @the_epoch2:=epoch inserts updates deletes schemaops
<the_epoch2> 2 0 0 0 <the_epoch2> 2 0 0 0
SELECT inserts,updates,deletes,schemaops FROM SELECT inserts,updates,deletes,schemaops FROM
mysql.binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
inserts updates deletes schemaops inserts updates deletes schemaops
2 0 0 0 2 0 0 0
drop table t1; drop table t1;
...@@ -69,12 +69,12 @@ Log_name Pos Event_type Server_id End_log_pos Info ...@@ -69,12 +69,12 @@ 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 # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # table_id: # (test.t1) master-bin1.000001 # Table_map # # table_id: # (test.t1)
master-bin1.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; drop table t1 master-bin1.000001 # Query # # use `test`; drop table t1
SELECT inserts,updates,deletes,schemaops FROM SELECT inserts,updates,deletes,schemaops FROM
mysql.binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>; mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
inserts updates deletes schemaops inserts updates deletes schemaops
2 0 0 0 2 0 0 0
...@@ -44,7 +44,7 @@ SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; ...@@ -44,7 +44,7 @@ SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SYSTEM_VALUES_ID VALUE SYSTEM_VALUES_ID VALUE
0 2039 0 2039
1 3 1 3
SELECT * FROM mysql.apply_status WHERE server_id=0; SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
server_id epoch server_id epoch
0 151 0 151
TRUNCATE GL; TRUNCATE GL;
...@@ -98,7 +98,7 @@ SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; ...@@ -98,7 +98,7 @@ SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SYSTEM_VALUES_ID VALUE SYSTEM_VALUES_ID VALUE
0 2297 0 2297
1 5 1 5
SELECT * FROM mysql.apply_status WHERE server_id=0; SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
server_id epoch server_id epoch
0 331 0 331
DROP DATABASE BANK; DROP DATABASE BANK;
...@@ -57,7 +57,7 @@ tablespace ts1 storage disk ...@@ -57,7 +57,7 @@ tablespace ts1 storage disk
engine ndb engine ndb
master-bin.000001 # Query # # BEGIN master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Table_map # # table_id: # (mysql.apply_status) 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 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # COMMIT
......
...@@ -9,14 +9,14 @@ INSERT INTO t1 VALUES ("row1","will go away",1); ...@@ -9,14 +9,14 @@ INSERT INTO t1 VALUES ("row1","will go away",1);
SELECT * FROM t1 ORDER BY c3; SELECT * FROM t1 ORDER BY c3;
c1 c2 c3 c1 c2 c3
row1 will go away 1 row1 will go away 1
SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
@the_epoch:=MAX(epoch) @the_epoch:=MAX(epoch)
<the_epoch> <the_epoch>
SELECT * FROM t1 ORDER BY c3; SELECT * FROM t1 ORDER BY c3;
c1 c2 c3 c1 c2 c3
row1 will go away 1 row1 will go away 1
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.binlog_index WHERE epoch = <the_epoch> ; FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
<the_pos> master-bin.000001 <the_pos> master-bin.000001
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
......
...@@ -22,7 +22,7 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 ...@@ -22,7 +22,7 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) 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 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # COMMIT
...@@ -30,7 +30,7 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 ...@@ -30,7 +30,7 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) 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 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # COMMIT
...@@ -61,7 +61,7 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 ...@@ -61,7 +61,7 @@ master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) 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 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # COMMIT
...@@ -69,7 +69,7 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 ...@@ -69,7 +69,7 @@ master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Table_map 1 # table_id: # (mysql.apply_status) 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 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # COMMIT
...@@ -81,18 +81,18 @@ master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB ...@@ -81,18 +81,18 @@ master-bin.000002 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB
master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
master-bin.000002 # Query 1 # BEGIN master-bin.000002 # Query 1 # BEGIN
master-bin.000002 # Table_map 1 # table_id: # (test.t2) master-bin.000002 # Table_map 1 # table_id: # (test.t2)
master-bin.000002 # Table_map 1 # table_id: # (mysql.apply_status) 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: #
master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000002 # Query 1 # COMMIT master-bin.000002 # Query 1 # COMMIT
show binary logs; show binary logs;
Log_name File_size Log_name File_size
master-bin.000001 1694 master-bin.000001 1702
master-bin.000002 589 master-bin.000002 593
start slave; start slave;
show binary logs; show binary logs;
Log_name File_size Log_name File_size
slave-bin.000001 1789 slave-bin.000001 1797
slave-bin.000002 198 slave-bin.000002 198
show binlog events in 'slave-bin.000001' from 4; show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
...@@ -100,7 +100,7 @@ slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 ...@@ -100,7 +100,7 @@ slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB slave-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # table_id: # (test.t1) slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
slave-bin.000001 # Table_map 2 # table_id: # (mysql.apply_status) slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
slave-bin.000001 # Write_rows 2 # table_id: # slave-bin.000001 # Write_rows 2 # table_id: #
slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 2 # COMMIT slave-bin.000001 # Query 2 # COMMIT
...@@ -108,7 +108,7 @@ slave-bin.000001 # Query 1 # use `test`; drop table t1 ...@@ -108,7 +108,7 @@ slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # table_id: # (test.t1) slave-bin.000001 # Table_map 2 # table_id: # (test.t1)
slave-bin.000001 # Table_map 2 # table_id: # (mysql.apply_status) slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
slave-bin.000001 # Write_rows 2 # table_id: # slave-bin.000001 # Write_rows 2 # table_id: #
slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 2 # COMMIT slave-bin.000001 # Query 2 # COMMIT
...@@ -120,13 +120,13 @@ slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 ...@@ -120,13 +120,13 @@ slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=NDB
slave-bin.000002 # Query 2 # BEGIN slave-bin.000002 # Query 2 # BEGIN
slave-bin.000002 # Table_map 2 # table_id: # (test.t2) slave-bin.000002 # Table_map 2 # table_id: # (test.t2)
slave-bin.000002 # Table_map 2 # table_id: # (mysql.apply_status) slave-bin.000002 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
slave-bin.000002 # Write_rows 2 # table_id: # slave-bin.000002 # Write_rows 2 # table_id: #
slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F
slave-bin.000002 # Query 2 # COMMIT slave-bin.000002 # Query 2 # COMMIT
show slave status; show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 589 # # master-bin.000002 Yes Yes # 0 0 589 # None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000002 593 # # master-bin.000002 Yes Yes # 0 0 593 # None 0 No #
show binlog events in 'slave-bin.000005' from 4; show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1; DROP TABLE t1;
......
...@@ -16,7 +16,7 @@ row1 will go away 1 ...@@ -16,7 +16,7 @@ row1 will go away 1
SELECT * FROM t1 ORDER BY c3; SELECT * FROM t1 ORDER BY c3;
c1 c2 c3 c1 c2 c3
row1 will go away 1 row1 will go away 1
SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
@the_epoch:=MAX(epoch) @the_epoch:=MAX(epoch)
<the_epoch> <the_epoch>
SELECT * FROM t1 ORDER BY c3; SELECT * FROM t1 ORDER BY c3;
...@@ -24,7 +24,7 @@ c1 c2 c3 ...@@ -24,7 +24,7 @@ c1 c2 c3
row1 will go away 1 row1 will go away 1
stop slave; stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.binlog_index WHERE epoch = <the_epoch> ; FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
102 master-bin1.000001 102 master-bin1.000001
CHANGE MASTER TO CHANGE MASTER TO
......
...@@ -33,12 +33,12 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 ...@@ -33,12 +33,12 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 219 Query 1 283 BEGIN master-bin.000001 219 Query 1 283 BEGIN
master-bin.000001 283 Table_map 1 40 table_id: # (test.t1) master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 323 Table_map 1 91 table_id: # (mysql.apply_status) master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
master-bin.000001 374 Write_rows 1 133 table_id: # master-bin.000001 378 Write_rows 1 137 table_id: #
master-bin.000001 416 Write_rows 1 180 table_id: # flags: STMT_END_F master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
master-bin.000001 463 Query 1 528 COMMIT master-bin.000001 467 Query 1 532 COMMIT
master-bin.000001 528 Query 1 608 use `test`; TRUNCATE TABLE t1 master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
master-bin.000001 608 Query 1 684 use `test`; DROP TABLE t1 master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
**** On Master **** **** On Master ****
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
INSERT INTO t1 VALUES (1,1), (2,2); INSERT INTO t1 VALUES (1,1), (2,2);
...@@ -69,23 +69,23 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 ...@@ -69,23 +69,23 @@ master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4
master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 219 Query 1 283 BEGIN master-bin.000001 219 Query 1 283 BEGIN
master-bin.000001 283 Table_map 1 40 table_id: # (test.t1) master-bin.000001 283 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 323 Table_map 1 91 table_id: # (mysql.apply_status) master-bin.000001 323 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
master-bin.000001 374 Write_rows 1 133 table_id: # master-bin.000001 378 Write_rows 1 137 table_id: #
master-bin.000001 416 Write_rows 1 180 table_id: # flags: STMT_END_F master-bin.000001 420 Write_rows 1 184 table_id: # flags: STMT_END_F
master-bin.000001 463 Query 1 528 COMMIT master-bin.000001 467 Query 1 532 COMMIT
master-bin.000001 528 Query 1 608 use `test`; TRUNCATE TABLE t1 master-bin.000001 532 Query 1 612 use `test`; TRUNCATE TABLE t1
master-bin.000001 608 Query 1 684 use `test`; DROP TABLE t1 master-bin.000001 612 Query 1 688 use `test`; DROP TABLE t1
master-bin.000001 684 Query 1 801 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB master-bin.000001 688 Query 1 805 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB
master-bin.000001 801 Query 1 865 BEGIN master-bin.000001 805 Query 1 869 BEGIN
master-bin.000001 865 Table_map 1 40 table_id: # (test.t1) master-bin.000001 869 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 905 Table_map 1 91 table_id: # (mysql.apply_status) master-bin.000001 909 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
master-bin.000001 956 Write_rows 1 133 table_id: # master-bin.000001 964 Write_rows 1 137 table_id: #
master-bin.000001 998 Write_rows 1 180 table_id: # flags: STMT_END_F master-bin.000001 1006 Write_rows 1 184 table_id: # flags: STMT_END_F
master-bin.000001 1045 Query 1 1110 COMMIT master-bin.000001 1053 Query 1 1118 COMMIT
master-bin.000001 1110 Query 1 1174 BEGIN master-bin.000001 1118 Query 1 1182 BEGIN
master-bin.000001 1174 Table_map 1 40 table_id: # (test.t1) master-bin.000001 1182 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 1214 Table_map 1 91 table_id: # (mysql.apply_status) master-bin.000001 1222 Table_map 1 95 table_id: # (mysql.ndb_apply_status)
master-bin.000001 1265 Write_rows 1 133 table_id: # master-bin.000001 1277 Write_rows 1 137 table_id: #
master-bin.000001 1307 Delete_rows 1 172 table_id: # flags: STMT_END_F master-bin.000001 1319 Delete_rows 1 176 table_id: # flags: STMT_END_F
master-bin.000001 1346 Query 1 1411 COMMIT master-bin.000001 1358 Query 1 1423 COMMIT
master-bin.000001 1411 Query 1 1487 use `test`; DROP TABLE t1 master-bin.000001 1423 Query 1 1499 use `test`; DROP TABLE t1
drop table if exists t1,t1aa,t2aa; drop table if exists t1,t1aa,t2aa;
show tables; show tables;
Tables_in_db Tables_in_db
binlog_index
columns_priv columns_priv
db db
event event
...@@ -12,6 +11,7 @@ help_keyword ...@@ -12,6 +11,7 @@ help_keyword
help_relation help_relation
help_topic help_topic
host host
ndb_binlog_index
plugin plugin
proc proc
procs_priv procs_priv
......
...@@ -37,7 +37,7 @@ create table t3(a int, KEY a_data (a)); ...@@ -37,7 +37,7 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int); create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key); create table t5 (id int auto_increment primary key);
insert into t5 values (10); insert into t5 values (10);
create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status'; create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status';
select * from v1; select * from v1;
select c,table_name from v1 select c,table_name from v1
...@@ -528,7 +528,7 @@ flush privileges; ...@@ -528,7 +528,7 @@ flush privileges;
# Bug #9404 information_schema: Weird error messages # Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries # with SELECT SUM() ... GROUP BY queries
# #
SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'binlog_index' AND table_name<>'apply_status' GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
# #
......
...@@ -41,7 +41,7 @@ select * from t2 order by a limit 3; ...@@ -41,7 +41,7 @@ select * from t2 order by a limit 3;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
# to ensure mysqld has connected again, and recreated system tables # to ensure mysqld has connected again, and recreated system tables
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster apply_status >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT
sleep 2; sleep 2;
--connection server2 --connection server2
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
...@@ -60,7 +60,7 @@ reset master; ...@@ -60,7 +60,7 @@ reset master;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
# to ensure mysqld has connected again, and recreated system tables # to ensure mysqld has connected again, and recreated system tables
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster apply_status >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT
sleep 2; sleep 2;
--connection server1 --connection server1
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
......
...@@ -12,14 +12,14 @@ use test; ...@@ -12,14 +12,14 @@ use test;
# #
# basic insert, update, delete test, alter, rename, drop # basic insert, update, delete test, alter, rename, drop
# check that binlog_index gets the right info # check that ndb_binlog_index gets the right info
# #
create table t1 (a int primary key) engine=ndb; create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
save_master_pos; save_master_pos;
--replace_column 1 # --replace_column 1 #
select @max_epoch:=max(epoch)-1 from mysql.binlog_index; select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
delete from t1; delete from t1;
alter table t1 add (b int); alter table t1 add (b int);
...@@ -38,18 +38,18 @@ drop table t2; ...@@ -38,18 +38,18 @@ drop table t2;
# (save_master_pos waits for last gcp to complete, ensuring that we have # (save_master_pos waits for last gcp to complete, ensuring that we have
# the expected data in the binlog) # the expected data in the binlog)
save_master_pos; save_master_pos;
select inserts from mysql.binlog_index where epoch > @max_epoch and inserts > 5; select inserts from mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 5;
select deletes from mysql.binlog_index where epoch > @max_epoch and deletes > 5; select deletes from mysql.ndb_binlog_index where epoch > @max_epoch and deletes > 5;
select inserts,updates,deletes from select inserts,updates,deletes from
mysql.binlog_index where epoch > @max_epoch and updates > 0; mysql.ndb_binlog_index where epoch > @max_epoch and updates > 0;
# #
# check that purge clears the binlog_index # check that purge clears the ndb_binlog_index
# #
flush logs; flush logs;
--sleep 1 --sleep 1
purge master logs before now(); purge master logs before now();
select count(*) from mysql.binlog_index; select count(*) from mysql.ndb_binlog_index;
# #
# several tables in different databases # several tables in different databases
...@@ -64,9 +64,9 @@ use test; ...@@ -64,9 +64,9 @@ use test;
insert into mysqltest.t1 values (2,1),(2,2); insert into mysqltest.t1 values (2,1),(2,2);
save_master_pos; save_master_pos;
--replace_column 1 # --replace_column 1 #
select @max_epoch:=max(epoch)-1 from mysql.binlog_index; select @max_epoch:=max(epoch)-1 from mysql.ndb_binlog_index;
drop table t1; drop table t1;
drop database mysqltest; drop database mysqltest;
select inserts,updates,deletes from select inserts,updates,deletes from
mysql.binlog_index where epoch > @max_epoch and inserts > 0; mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;
...@@ -38,7 +38,7 @@ INSERT INTO t2 VALUES (1,1),(2,2); ...@@ -38,7 +38,7 @@ INSERT INTO t2 VALUES (1,1),(2,2);
select * from t2 order by a; select * from t2 order by a;
--replace_column 1 <the_epoch> --replace_column 1 <the_epoch>
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
mysql.binlog_index ORDER BY epoch DESC LIMIT 1; mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
let $the_epoch= `SELECT @the_epoch`; let $the_epoch= `SELECT @the_epoch`;
# see if we got something on server1 # see if we got something on server1
...@@ -50,7 +50,7 @@ DROP TABLE t2; ...@@ -50,7 +50,7 @@ DROP TABLE t2;
--source include/show_binlog_events.inc --source include/show_binlog_events.inc
--replace_result $the_epoch <the_epoch> --replace_result $the_epoch <the_epoch>
eval SELECT inserts,updates,deletes,schemaops FROM eval SELECT inserts,updates,deletes,schemaops FROM
mysql.binlog_index WHERE epoch=$the_epoch; mysql.ndb_binlog_index WHERE epoch=$the_epoch;
# reset for next test # reset for next test
connection server1; connection server1;
...@@ -65,12 +65,12 @@ INSERT INTO t1 VALUES (1),(2); ...@@ -65,12 +65,12 @@ INSERT INTO t1 VALUES (1),(2);
--source include/show_binlog_events.inc --source include/show_binlog_events.inc
--replace_column 1 <the_epoch2> --replace_column 1 <the_epoch2>
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
mysql.binlog_index ORDER BY epoch DESC LIMIT 1; mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
let $the_epoch2= `SELECT @the_epoch2`; let $the_epoch2= `SELECT @the_epoch2`;
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2> --replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM eval SELECT inserts,updates,deletes,schemaops FROM
mysql.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
# now see that we have the events on the other server # now see that we have the events on the other server
connection server2; connection server2;
...@@ -80,4 +80,4 @@ drop table t1; ...@@ -80,4 +80,4 @@ drop table t1;
--source include/show_binlog_events.inc --source include/show_binlog_events.inc
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2> --replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM eval SELECT inserts,updates,deletes,schemaops FROM
mysql.binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2; mysql.ndb_binlog_index WHERE epoch > $the_epoch AND epoch <= $the_epoch2;
...@@ -21,7 +21,7 @@ SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; ...@@ -21,7 +21,7 @@ SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
SELECT COUNT(*) FROM TRANSACTION; SELECT COUNT(*) FROM TRANSACTION;
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SELECT * FROM mysql.apply_status WHERE server_id=0; SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
# #
# verify restore of 5.0 backup # verify restore of 5.0 backup
...@@ -39,5 +39,5 @@ SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE; ...@@ -39,5 +39,5 @@ SELECT * FROM GL ORDER BY TIME,ACCOUNT_TYPE;
SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID; SELECT * FROM ACCOUNT ORDER BY ACCOUNT_ID;
SELECT COUNT(*) FROM TRANSACTION; SELECT COUNT(*) FROM TRANSACTION;
SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID; SELECT * FROM SYSTEM_VALUES ORDER BY SYSTEM_VALUES_ID;
SELECT * FROM mysql.apply_status WHERE server_id=0; SELECT * FROM mysql.ndb_apply_status WHERE server_id=0;
DROP DATABASE BANK; DROP DATABASE BANK;
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Currently test only works with ndb since it retrieves "old" # Currently test only works with ndb since it retrieves "old"
# binlog positions with mysql.binlog_index and apply_status; # binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
# #
# create a table with one row # create a table with one row
...@@ -15,7 +15,7 @@ SELECT * FROM t1 ORDER BY c3; ...@@ -15,7 +15,7 @@ SELECT * FROM t1 ORDER BY c3;
# sync slave and retrieve epoch # sync slave and retrieve epoch
sync_slave_with_master; sync_slave_with_master;
--replace_column 1 <the_epoch> --replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
let $the_epoch= `select @the_epoch` ; let $the_epoch= `select @the_epoch` ;
SELECT * FROM t1 ORDER BY c3; SELECT * FROM t1 ORDER BY c3;
...@@ -24,7 +24,7 @@ connection master; ...@@ -24,7 +24,7 @@ connection master;
--replace_result $the_epoch <the_epoch> --replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos> --replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.binlog_index WHERE epoch = $the_epoch ; FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
let $the_pos= `SELECT @the_pos` ; let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ; let $the_file= `SELECT @the_file` ;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# Currently test only works with ndb since it retrieves "old" # Currently test only works with ndb since it retrieves "old"
# binlog positions with mysql.binlog_index and apply_status; # binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
# #
# create a table with one row, and make sure the other "master" gets it # create a table with one row, and make sure the other "master" gets it
...@@ -25,7 +25,7 @@ SELECT * FROM t1 ORDER BY c3; ...@@ -25,7 +25,7 @@ SELECT * FROM t1 ORDER BY c3;
connection master; connection master;
sync_slave_with_master; sync_slave_with_master;
--replace_column 1 <the_epoch> --replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM mysql.apply_status; SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
let $the_epoch= `select @the_epoch` ; let $the_epoch= `select @the_epoch` ;
SELECT * FROM t1 ORDER BY c3; SELECT * FROM t1 ORDER BY c3;
stop slave; stop slave;
...@@ -34,7 +34,7 @@ stop slave; ...@@ -34,7 +34,7 @@ stop slave;
connection server2; connection server2;
--replace_result $the_epoch <the_epoch> --replace_result $the_epoch <the_epoch>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.binlog_index WHERE epoch = $the_epoch ; FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
let $the_pos= `SELECT @the_pos` ; let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ; let $the_file= `SELECT @the_file` ;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# #
# Currently test only works with ndb since it retrieves "old" # Currently test only works with ndb since it retrieves "old"
# binlog positions with mysql.binlog_index and apply_status; # binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
# #
# stop the save # stop the save
...@@ -94,11 +94,11 @@ STOP SLAVE; ...@@ -94,11 +94,11 @@ STOP SLAVE;
--connection master --connection master
reset master; reset master;
# should now contain nothing # should now contain nothing
select * from mysql.binlog_index; select * from mysql.ndb_binlog_index;
--connection slave --connection slave
reset slave; reset slave;
# should now contain nothing # should now contain nothing
select * from mysql.apply_status; select * from mysql.ndb_apply_status;
# End 5.1 Test # End 5.1 Test
...@@ -96,7 +96,7 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N',' ...@@ -96,7 +96,7 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv,
procs_priv, help_category, help_keyword, help_relation, help_topic, proc, procs_priv, help_category, help_keyword, help_relation, help_topic, proc,
time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition,
time_zone_transition_type, general_log, slow_log, event, binlog_index; time_zone_transition_type, general_log, slow_log, event, ndb_binlog_index;
-- enable_query_log -- enable_query_log
......
...@@ -874,7 +874,7 @@ $c_pp ...@@ -874,7 +874,7 @@ $c_pp
$c_gl $c_gl
$c_sl $c_sl
$c_ev $c_ev
CREATE TABLE IF NOT EXISTS mysql.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; CREATE TABLE IF NOT EXISTS mysql.ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
END_OF_DATA END_OF_DATA
...@@ -687,7 +687,7 @@ ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete ...@@ -687,7 +687,7 @@ ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete
UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
CREATE TABLE IF NOT EXISTS binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
# Activate the new, possible modified privilege tables # Activate the new, possible modified privilege tables
# This should not be needed, but gives us some extra testing that the above # This should not be needed, but gives us some extra testing that the above
......
...@@ -4769,7 +4769,7 @@ int ha_ndbcluster::create(const char *name, ...@@ -4769,7 +4769,7 @@ int ha_ndbcluster::create(const char *name,
schema distribution table is setup schema distribution table is setup
( unless it is a creation of the schema dist table itself ) ( unless it is a creation of the schema dist table itself )
*/ */
if (!schema_share && if (!ndb_schema_share &&
!(strcmp(m_dbname, NDB_REP_DB) == 0 && !(strcmp(m_dbname, NDB_REP_DB) == 0 &&
strcmp(m_tabname, NDB_SCHEMA_TABLE) == 0)) strcmp(m_tabname, NDB_SCHEMA_TABLE) == 0))
{ {
...@@ -4974,7 +4974,7 @@ int ha_ndbcluster::create(const char *name, ...@@ -4974,7 +4974,7 @@ int ha_ndbcluster::create(const char *name,
ndb_rep_event_name(&event_name,m_dbname,m_tabname); ndb_rep_event_name(&event_name,m_dbname,m_tabname);
int do_event_op= ndb_binlog_running; int do_event_op= ndb_binlog_running;
if (!schema_share && if (!ndb_schema_share &&
strcmp(share->db, NDB_REP_DB) == 0 && strcmp(share->db, NDB_REP_DB) == 0 &&
strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0) strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0)
do_event_op= 1; do_event_op= 1;
...@@ -5464,7 +5464,7 @@ ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb, ...@@ -5464,7 +5464,7 @@ ha_ndbcluster::delete_table(ha_ndbcluster *h, Ndb *ndb,
Don't allow drop table unless Don't allow drop table unless
schema distribution table is setup schema distribution table is setup
*/ */
if (!schema_share) if (!ndb_schema_share)
{ {
DBUG_PRINT("info", ("Schema distribution table not setup")); DBUG_PRINT("info", ("Schema distribution table not setup"));
DBUG_RETURN(HA_ERR_NO_CONNECTION); DBUG_RETURN(HA_ERR_NO_CONNECTION);
...@@ -5623,7 +5623,7 @@ int ha_ndbcluster::delete_table(const char *name) ...@@ -5623,7 +5623,7 @@ int ha_ndbcluster::delete_table(const char *name)
Don't allow drop table unless Don't allow drop table unless
schema distribution table is setup schema distribution table is setup
*/ */
if (!schema_share) if (!ndb_schema_share)
{ {
DBUG_PRINT("info", ("Schema distribution table not setup")); DBUG_PRINT("info", ("Schema distribution table not setup"));
DBUG_RETURN(HA_ERR_NO_CONNECTION); DBUG_RETURN(HA_ERR_NO_CONNECTION);
...@@ -6189,7 +6189,7 @@ static void ndbcluster_drop_database(handlerton *hton, char *path) ...@@ -6189,7 +6189,7 @@ static void ndbcluster_drop_database(handlerton *hton, char *path)
Don't allow drop database unless Don't allow drop database unless
schema distribution table is setup schema distribution table is setup
*/ */
if (!schema_share) if (!ndb_schema_share)
{ {
DBUG_PRINT("info", ("Schema distribution table not setup")); DBUG_PRINT("info", ("Schema distribution table not setup"));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
...@@ -8407,7 +8407,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) ...@@ -8407,7 +8407,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
#ifdef HAVE_NDB_BINLOG #ifdef HAVE_NDB_BINLOG
/* /*
Check that the apply_status_share and schema_share has been created. Check that the ndb_apply_status_share and ndb_schema_share
have been created.
If not try to create it If not try to create it
*/ */
if (!ndb_binlog_tables_inited) if (!ndb_binlog_tables_inited)
......
...@@ -94,8 +94,8 @@ static ulonglong ndb_latest_applied_binlog_epoch= 0; ...@@ -94,8 +94,8 @@ static ulonglong ndb_latest_applied_binlog_epoch= 0;
static ulonglong ndb_latest_handled_binlog_epoch= 0; static ulonglong ndb_latest_handled_binlog_epoch= 0;
static ulonglong ndb_latest_received_binlog_epoch= 0; static ulonglong ndb_latest_received_binlog_epoch= 0;
NDB_SHARE *apply_status_share= 0; NDB_SHARE *ndb_apply_status_share= 0;
NDB_SHARE *schema_share= 0; NDB_SHARE *ndb_schema_share= 0;
/* Schema object distribution handling */ /* Schema object distribution handling */
HASH ndb_schema_objects; HASH ndb_schema_objects;
...@@ -116,9 +116,9 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, ...@@ -116,9 +116,9 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object,
static Uint64 *p_latest_trans_gci= 0; static Uint64 *p_latest_trans_gci= 0;
/* /*
Global variables for holding the binlog_index table reference Global variables for holding the ndb_binlog_index table reference
*/ */
static TABLE *binlog_index= 0; static TABLE *ndb_binlog_index= 0;
static TABLE_LIST binlog_tables; static TABLE_LIST binlog_tables;
/* /*
...@@ -215,8 +215,8 @@ static void dbug_print_table(const char *info, TABLE *table) ...@@ -215,8 +215,8 @@ static void dbug_print_table(const char *info, TABLE *table)
Run a query through mysql_parse Run a query through mysql_parse
Used to: Used to:
- purging the binlog_index - purging the ndb_binlog_index
- creating the apply_status table - creating the ndb_apply_status table
*/ */
static void run_query(THD *thd, char *buf, char *end, static void run_query(THD *thd, char *buf, char *end,
my_bool print_error, my_bool disable_binlog) my_bool print_error, my_bool disable_binlog)
...@@ -254,10 +254,10 @@ static void run_query(THD *thd, char *buf, char *end, ...@@ -254,10 +254,10 @@ static void run_query(THD *thd, char *buf, char *end,
if (thd == injector_thd) if (thd == injector_thd)
{ {
/* /*
running the query will close all tables, including the binlog_index running the query will close all tables, including the ndb_binlog_index
used in injector_thd used in injector_thd
*/ */
binlog_index= 0; ndb_binlog_index= 0;
} }
} }
...@@ -363,7 +363,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table) ...@@ -363,7 +363,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
share->op= 0; share->op= 0;
share->table= 0; share->table= 0;
if (!schema_share && if (!ndb_schema_share &&
strcmp(share->db, NDB_REP_DB) == 0 && strcmp(share->db, NDB_REP_DB) == 0 &&
strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0) strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0)
do_event_op= 1; do_event_op= 1;
...@@ -677,18 +677,18 @@ void ndbcluster_binlog_init_handlerton() ...@@ -677,18 +677,18 @@ void ndbcluster_binlog_init_handlerton()
/* /*
check the availability af the apply_status share check the availability af the ndb_apply_status share
- return share, but do not increase refcount - return share, but do not increase refcount
- return 0 if there is no share - return 0 if there is no share
*/ */
static NDB_SHARE *ndbcluster_check_apply_status_share() static NDB_SHARE *ndbcluster_check_ndb_apply_status_share()
{ {
pthread_mutex_lock(&ndbcluster_mutex); pthread_mutex_lock(&ndbcluster_mutex);
void *share= hash_search(&ndbcluster_open_tables, void *share= hash_search(&ndbcluster_open_tables,
NDB_APPLY_TABLE_FILE, NDB_APPLY_TABLE_FILE,
sizeof(NDB_APPLY_TABLE_FILE) - 1); sizeof(NDB_APPLY_TABLE_FILE) - 1);
DBUG_PRINT("info",("ndbcluster_check_apply_status_share %s 0x%lx", DBUG_PRINT("info",("ndbcluster_check_ndb_apply_status_share %s 0x%lx",
NDB_APPLY_TABLE_FILE, (long) share)); NDB_APPLY_TABLE_FILE, (long) share));
pthread_mutex_unlock(&ndbcluster_mutex); pthread_mutex_unlock(&ndbcluster_mutex);
return (NDB_SHARE*) share; return (NDB_SHARE*) share;
...@@ -699,25 +699,25 @@ static NDB_SHARE *ndbcluster_check_apply_status_share() ...@@ -699,25 +699,25 @@ static NDB_SHARE *ndbcluster_check_apply_status_share()
- return share, but do not increase refcount - return share, but do not increase refcount
- return 0 if there is no share - return 0 if there is no share
*/ */
static NDB_SHARE *ndbcluster_check_schema_share() static NDB_SHARE *ndbcluster_check_ndb_schema_share()
{ {
pthread_mutex_lock(&ndbcluster_mutex); pthread_mutex_lock(&ndbcluster_mutex);
void *share= hash_search(&ndbcluster_open_tables, void *share= hash_search(&ndbcluster_open_tables,
NDB_SCHEMA_TABLE_FILE, NDB_SCHEMA_TABLE_FILE,
sizeof(NDB_SCHEMA_TABLE_FILE) - 1); sizeof(NDB_SCHEMA_TABLE_FILE) - 1);
DBUG_PRINT("info",("ndbcluster_check_schema_share %s 0x%lx", DBUG_PRINT("info",("ndbcluster_check_ndb_schema_share %s 0x%lx",
NDB_SCHEMA_TABLE_FILE, (long) share)); NDB_SCHEMA_TABLE_FILE, (long) share));
pthread_mutex_unlock(&ndbcluster_mutex); pthread_mutex_unlock(&ndbcluster_mutex);
return (NDB_SHARE*) share; return (NDB_SHARE*) share;
} }
/* /*
Create the apply_status table Create the ndb_apply_status table
*/ */
static int ndbcluster_create_apply_status_table(THD *thd) static int ndbcluster_create_ndb_apply_status_table(THD *thd)
{ {
DBUG_ENTER("ndbcluster_create_apply_status_table"); DBUG_ENTER("ndbcluster_create_ndb_apply_status_table");
/* /*
Check if we already have the apply status table. Check if we already have the apply status table.
...@@ -725,7 +725,7 @@ static int ndbcluster_create_apply_status_table(THD *thd) ...@@ -725,7 +725,7 @@ static int ndbcluster_create_apply_status_table(THD *thd)
and thus have a share and thus have a share
*/ */
if (ndbcluster_check_apply_status_share()) if (ndbcluster_check_ndb_apply_status_share())
DBUG_RETURN(0); DBUG_RETURN(0);
if (g_ndb_cluster_connection->get_no_ready() <= 0) if (g_ndb_cluster_connection->get_no_ready() <= 0)
...@@ -774,7 +774,7 @@ static int ndbcluster_create_schema_table(THD *thd) ...@@ -774,7 +774,7 @@ static int ndbcluster_create_schema_table(THD *thd)
and thus have a share and thus have a share
*/ */
if (ndbcluster_check_schema_share()) if (ndbcluster_check_ndb_schema_share())
DBUG_RETURN(0); DBUG_RETURN(0);
if (g_ndb_cluster_connection->get_no_ready() <= 0) if (g_ndb_cluster_connection->get_no_ready() <= 0)
...@@ -818,30 +818,30 @@ static int ndbcluster_create_schema_table(THD *thd) ...@@ -818,30 +818,30 @@ static int ndbcluster_create_schema_table(THD *thd)
int ndbcluster_setup_binlog_table_shares(THD *thd) int ndbcluster_setup_binlog_table_shares(THD *thd)
{ {
if (!schema_share && if (!ndb_schema_share &&
ndbcluster_check_schema_share() == 0) ndbcluster_check_ndb_schema_share() == 0)
{ {
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_SCHEMA_TABLE); ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_SCHEMA_TABLE);
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
if (!schema_share) if (!ndb_schema_share)
{ {
ndbcluster_create_schema_table(thd); ndbcluster_create_schema_table(thd);
// always make sure we create the 'schema' first // always make sure we create the 'schema' first
if (!schema_share) if (!ndb_schema_share)
return 1; return 1;
} }
} }
if (!apply_status_share && if (!ndb_apply_status_share &&
ndbcluster_check_apply_status_share() == 0) ndbcluster_check_ndb_apply_status_share() == 0)
{ {
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_APPLY_TABLE); ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_APPLY_TABLE);
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
if (!apply_status_share) if (!ndb_apply_status_share)
{ {
ndbcluster_create_apply_status_table(thd); ndbcluster_create_ndb_apply_status_table(thd);
if (!apply_status_share) if (!ndb_apply_status_share)
return 1; return 1;
} }
} }
...@@ -1003,7 +1003,7 @@ ndbcluster_update_slock(THD *thd, ...@@ -1003,7 +1003,7 @@ ndbcluster_update_slock(THD *thd,
const char *table_name) const char *table_name)
{ {
DBUG_ENTER("ndbcluster_update_slock"); DBUG_ENTER("ndbcluster_update_slock");
if (!schema_share) if (!ndb_schema_share)
{ {
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1194,7 +1194,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1194,7 +1194,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
DBUG_PRINT("enter", DBUG_PRINT("enter",
("query: %s db: %s table_name: %s thd_ndb->options: %d", ("query: %s db: %s table_name: %s thd_ndb->options: %d",
query, db, table_name, thd_ndb->options)); query, db, table_name, thd_ndb->options));
if (!schema_share || thd_ndb->options & TNO_NO_LOG_SCHEMA_OP) if (!ndb_schema_share || thd_ndb->options & TNO_NO_LOG_SCHEMA_OP)
{ {
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -1268,10 +1268,10 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1268,10 +1268,10 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
int no_storage_nodes= g_ndb_cluster_connection->no_db_nodes(); int no_storage_nodes= g_ndb_cluster_connection->no_db_nodes();
bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE); bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE);
bitmap_set_all(&schema_subscribers); bitmap_set_all(&schema_subscribers);
(void) pthread_mutex_lock(&schema_share->mutex); (void) pthread_mutex_lock(&ndb_schema_share->mutex);
for (i= 0; i < no_storage_nodes; i++) for (i= 0; i < no_storage_nodes; i++)
{ {
MY_BITMAP *table_subscribers= &schema_share->subscriber_bitmap[i]; MY_BITMAP *table_subscribers= &ndb_schema_share->subscriber_bitmap[i];
if (!bitmap_is_clear_all(table_subscribers)) if (!bitmap_is_clear_all(table_subscribers))
{ {
bitmap_intersect(&schema_subscribers, bitmap_intersect(&schema_subscribers,
...@@ -1279,7 +1279,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1279,7 +1279,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
updated= 1; updated= 1;
} }
} }
(void) pthread_mutex_unlock(&schema_share->mutex); (void) pthread_mutex_unlock(&ndb_schema_share->mutex);
if (updated) if (updated)
{ {
bitmap_clear_bit(&schema_subscribers, node_id); bitmap_clear_bit(&schema_subscribers, node_id);
...@@ -1475,15 +1475,15 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share, ...@@ -1475,15 +1475,15 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
&abstime); &abstime);
if (thd->killed) if (thd->killed)
break; break;
(void) pthread_mutex_lock(&schema_share->mutex); (void) pthread_mutex_lock(&ndb_schema_share->mutex);
for (i= 0; i < no_storage_nodes; i++) for (i= 0; i < no_storage_nodes; i++)
{ {
/* remove any unsubscribed from schema_subscribers */ /* remove any unsubscribed from schema_subscribers */
MY_BITMAP *tmp= &schema_share->subscriber_bitmap[i]; MY_BITMAP *tmp= &ndb_schema_share->subscriber_bitmap[i];
if (!bitmap_is_clear_all(tmp)) if (!bitmap_is_clear_all(tmp))
bitmap_intersect(&schema_subscribers, tmp); bitmap_intersect(&schema_subscribers, tmp);
} }
(void) pthread_mutex_unlock(&schema_share->mutex); (void) pthread_mutex_unlock(&ndb_schema_share->mutex);
/* remove any unsubscribed from ndb_schema_object->slock */ /* remove any unsubscribed from ndb_schema_object->slock */
bitmap_intersect(&ndb_schema_object->slock_bitmap, &schema_subscribers); bitmap_intersect(&ndb_schema_object->slock_bitmap, &schema_subscribers);
...@@ -1733,7 +1733,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb, ...@@ -1733,7 +1733,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
{ {
DBUG_ENTER("ndb_binlog_thread_handle_schema_event"); DBUG_ENTER("ndb_binlog_thread_handle_schema_event");
NDB_SHARE *tmp_share= (NDB_SHARE *)pOp->getCustomData(); NDB_SHARE *tmp_share= (NDB_SHARE *)pOp->getCustomData();
if (tmp_share && schema_share == tmp_share) if (tmp_share && ndb_schema_share == tmp_share)
{ {
NDBEVENT::TableEvent ev_type= pOp->getEventType(); NDBEVENT::TableEvent ev_type= pOp->getEventType();
DBUG_PRINT("enter", ("%s.%s ev_type: %d", DBUG_PRINT("enter", ("%s.%s ev_type: %d",
...@@ -1900,15 +1900,15 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb, ...@@ -1900,15 +1900,15 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
case NDBEVENT::TE_CLUSTER_FAILURE: case NDBEVENT::TE_CLUSTER_FAILURE:
if (ndb_extra_logging) if (ndb_extra_logging)
sql_print_information("NDB Binlog: cluster failure for %s at epoch %u.", sql_print_information("NDB Binlog: cluster failure for %s at epoch %u.",
schema_share->key, (unsigned) pOp->getGCI()); ndb_schema_share->key, (unsigned) pOp->getGCI());
// fall through // fall through
case NDBEVENT::TE_DROP: case NDBEVENT::TE_DROP:
if (ndb_extra_logging && if (ndb_extra_logging &&
ndb_binlog_tables_inited && ndb_binlog_running) ndb_binlog_tables_inited && ndb_binlog_running)
sql_print_information("NDB Binlog: ndb tables initially " sql_print_information("NDB Binlog: ndb tables initially "
"read only on reconnect."); "read only on reconnect.");
free_share(&schema_share); free_share(&ndb_schema_share);
schema_share= 0; ndb_schema_share= 0;
close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0, FALSE); close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0, FALSE);
// fall through // fall through
case NDBEVENT::TE_ALTER: case NDBEVENT::TE_ALTER:
...@@ -2134,15 +2134,15 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd, ...@@ -2134,15 +2134,15 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd,
/********************************************************************* /*********************************************************************
Internal helper functions for handeling of the cluster replication tables Internal helper functions for handeling of the cluster replication tables
- binlog_index - ndb_binlog_index
- apply_status - ndb_apply_status
*********************************************************************/ *********************************************************************/
/* /*
struct to hold the data to be inserted into the struct to hold the data to be inserted into the
binlog_index table ndb_binlog_index table
*/ */
struct Binlog_index_row { struct ndb_binlog_index_row {
ulonglong gci; ulonglong gci;
const char *master_log_file; const char *master_log_file;
ulonglong master_log_pos; ulonglong master_log_pos;
...@@ -2153,10 +2153,10 @@ struct Binlog_index_row { ...@@ -2153,10 +2153,10 @@ struct Binlog_index_row {
}; };
/* /*
Open the binlog_index table Open the ndb_binlog_index table
*/ */
static int open_binlog_index(THD *thd, TABLE_LIST *tables, static int open_ndb_binlog_index(THD *thd, TABLE_LIST *tables,
TABLE **binlog_index) TABLE **ndb_binlog_index)
{ {
static char repdb[]= NDB_REP_DB; static char repdb[]= NDB_REP_DB;
static char reptable[]= NDB_REP_TABLE; static char reptable[]= NDB_REP_TABLE;
...@@ -2172,26 +2172,26 @@ static int open_binlog_index(THD *thd, TABLE_LIST *tables, ...@@ -2172,26 +2172,26 @@ static int open_binlog_index(THD *thd, TABLE_LIST *tables,
thd->clear_error(); thd->clear_error();
if (open_tables(thd, &tables, &counter, MYSQL_LOCK_IGNORE_FLUSH)) if (open_tables(thd, &tables, &counter, MYSQL_LOCK_IGNORE_FLUSH))
{ {
sql_print_error("NDB Binlog: Opening binlog_index: %d, '%s'", sql_print_error("NDB Binlog: Opening ndb_binlog_index: %d, '%s'",
thd->net.last_errno, thd->net.last_errno,
thd->net.last_error ? thd->net.last_error : ""); thd->net.last_error ? thd->net.last_error : "");
thd->proc_info= save_proc_info; thd->proc_info= save_proc_info;
return -1; return -1;
} }
*binlog_index= tables->table; *ndb_binlog_index= tables->table;
thd->proc_info= save_proc_info; thd->proc_info= save_proc_info;
(*binlog_index)->use_all_columns(); (*ndb_binlog_index)->use_all_columns();
return 0; return 0;
} }
/* /*
Insert one row in the binlog_index Insert one row in the ndb_binlog_index
*/ */
int ndb_add_binlog_index(THD *thd, void *_row) int ndb_add_ndb_binlog_index(THD *thd, void *_row)
{ {
Binlog_index_row &row= *(Binlog_index_row *) _row; ndb_binlog_index_row &row= *(ndb_binlog_index_row *) _row;
int error= 0; int error= 0;
bool need_reopen; bool need_reopen;
/* /*
...@@ -2203,10 +2203,10 @@ int ndb_add_binlog_index(THD *thd, void *_row) ...@@ -2203,10 +2203,10 @@ int ndb_add_binlog_index(THD *thd, void *_row)
for ( ; ; ) /* loop for need_reopen */ for ( ; ; ) /* loop for need_reopen */
{ {
if (!binlog_index && open_binlog_index(thd, &binlog_tables, &binlog_index)) if (!ndb_binlog_index && open_ndb_binlog_index(thd, &binlog_tables, &ndb_binlog_index))
{ {
error= -1; error= -1;
goto add_binlog_index_err; goto add_ndb_binlog_index_err;
} }
if (lock_tables(thd, &binlog_tables, 1, &need_reopen)) if (lock_tables(thd, &binlog_tables, 1, &need_reopen))
...@@ -2215,43 +2215,43 @@ int ndb_add_binlog_index(THD *thd, void *_row) ...@@ -2215,43 +2215,43 @@ int ndb_add_binlog_index(THD *thd, void *_row)
{ {
TABLE_LIST *p_binlog_tables= &binlog_tables; TABLE_LIST *p_binlog_tables= &binlog_tables;
close_tables_for_reopen(thd, &p_binlog_tables); close_tables_for_reopen(thd, &p_binlog_tables);
binlog_index= 0; ndb_binlog_index= 0;
continue; continue;
} }
sql_print_error("NDB Binlog: Unable to lock table binlog_index"); sql_print_error("NDB Binlog: Unable to lock table ndb_binlog_index");
error= -1; error= -1;
goto add_binlog_index_err; goto add_ndb_binlog_index_err;
} }
break; break;
} }
// Set all fields non-null. // Set all fields non-null.
if(binlog_index->s->null_bytes > 0) if(ndb_binlog_index->s->null_bytes > 0)
bzero(binlog_index->record[0], binlog_index->s->null_bytes); bzero(ndb_binlog_index->record[0], ndb_binlog_index->s->null_bytes);
binlog_index->field[0]->store(row.master_log_pos); ndb_binlog_index->field[0]->store(row.master_log_pos);
binlog_index->field[1]->store(row.master_log_file, ndb_binlog_index->field[1]->store(row.master_log_file,
strlen(row.master_log_file), strlen(row.master_log_file),
&my_charset_bin); &my_charset_bin);
binlog_index->field[2]->store(row.gci); ndb_binlog_index->field[2]->store(row.gci);
binlog_index->field[3]->store(row.n_inserts); ndb_binlog_index->field[3]->store(row.n_inserts);
binlog_index->field[4]->store(row.n_updates); ndb_binlog_index->field[4]->store(row.n_updates);
binlog_index->field[5]->store(row.n_deletes); ndb_binlog_index->field[5]->store(row.n_deletes);
binlog_index->field[6]->store(row.n_schemaops); ndb_binlog_index->field[6]->store(row.n_schemaops);
if ((error= binlog_index->file->ha_write_row(binlog_index->record[0]))) if ((error= ndb_binlog_index->file->ha_write_row(ndb_binlog_index->record[0])))
{ {
sql_print_error("NDB Binlog: Writing row to binlog_index: %d", error); sql_print_error("NDB Binlog: Writing row to ndb_binlog_index: %d", error);
error= -1; error= -1;
goto add_binlog_index_err; goto add_ndb_binlog_index_err;
} }
mysql_unlock_tables(thd, thd->lock); mysql_unlock_tables(thd, thd->lock);
thd->lock= 0; thd->lock= 0;
thd->options= saved_options; thd->options= saved_options;
return 0; return 0;
add_binlog_index_err: add_ndb_binlog_index_err:
close_thread_tables(thd); close_thread_tables(thd);
binlog_index= 0; ndb_binlog_index= 0;
thd->options= saved_options; thd->options= saved_options;
return error; return error;
} }
...@@ -2428,7 +2428,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, ...@@ -2428,7 +2428,7 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
"allocating table share for %s failed", key); "allocating table share for %s failed", key);
} }
if (!schema_share && if (!ndb_schema_share &&
strcmp(share->db, NDB_REP_DB) == 0 && strcmp(share->db, NDB_REP_DB) == 0 &&
strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0) strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0)
do_event_op= 1; do_event_op= 1;
...@@ -2559,7 +2559,7 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab, ...@@ -2559,7 +2559,7 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
} }
else else
{ {
if (schema_share || strcmp(share->db, NDB_REP_DB) || if (ndb_schema_share || strcmp(share->db, NDB_REP_DB) ||
strcmp(share->table_name, NDB_SCHEMA_TABLE)) strcmp(share->table_name, NDB_SCHEMA_TABLE))
{ {
my_event.setReport(NDBEVENT::ER_UPDATED); my_event.setReport(NDBEVENT::ER_UPDATED);
...@@ -2696,13 +2696,13 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2696,13 +2696,13 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
int do_schema_share= 0, do_apply_status_share= 0; int do_ndb_schema_share= 0, do_ndb_apply_status_share= 0;
if (!schema_share && strcmp(share->db, NDB_REP_DB) == 0 && if (!ndb_schema_share && strcmp(share->db, NDB_REP_DB) == 0 &&
strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0) strcmp(share->table_name, NDB_SCHEMA_TABLE) == 0)
do_schema_share= 1; do_ndb_schema_share= 1;
else if (!apply_status_share && strcmp(share->db, NDB_REP_DB) == 0 && else if (!ndb_apply_status_share && strcmp(share->db, NDB_REP_DB) == 0 &&
strcmp(share->table_name, NDB_APPLY_TABLE) == 0) strcmp(share->table_name, NDB_APPLY_TABLE) == 0)
do_apply_status_share= 1; do_ndb_apply_status_share= 1;
else if (!binlog_filter->db_ok(share->db)) else if (!binlog_filter->db_ok(share->db))
{ {
share->flags|= NSF_NO_BINLOG; share->flags|= NSF_NO_BINLOG;
...@@ -2726,7 +2726,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2726,7 +2726,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
{ {
pthread_mutex_lock(&injector_mutex); pthread_mutex_lock(&injector_mutex);
Ndb *ndb= injector_ndb; Ndb *ndb= injector_ndb;
if (do_schema_share) if (do_ndb_schema_share)
ndb= schema_ndb; ndb= schema_ndb;
if (ndb == 0) if (ndb == 0)
...@@ -2736,7 +2736,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2736,7 +2736,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
} }
NdbEventOperation* op; NdbEventOperation* op;
if (do_schema_share) if (do_ndb_schema_share)
op= ndb->createEventOperation(event_name); op= ndb->createEventOperation(event_name);
else else
{ {
...@@ -2858,14 +2858,14 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab, ...@@ -2858,14 +2858,14 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
} }
get_share(share); get_share(share);
if (do_apply_status_share) if (do_ndb_apply_status_share)
{ {
apply_status_share= get_share(share); ndb_apply_status_share= get_share(share);
(void) pthread_cond_signal(&injector_cond); (void) pthread_cond_signal(&injector_cond);
} }
else if (do_schema_share) else if (do_ndb_schema_share)
{ {
schema_share= get_share(share); ndb_schema_share= get_share(share);
(void) pthread_cond_signal(&injector_cond); (void) pthread_cond_signal(&injector_cond);
} }
...@@ -2988,7 +2988,7 @@ ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name, ...@@ -2988,7 +2988,7 @@ ndbcluster_handle_drop_table(Ndb *ndb, const char *event_name,
Handle error states on events from the storage nodes Handle error states on events from the storage nodes
*/ */
static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp, static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp,
Binlog_index_row &row) ndb_binlog_index_row &row)
{ {
NDB_SHARE *share= (NDB_SHARE *)pOp->getCustomData(); NDB_SHARE *share= (NDB_SHARE *)pOp->getCustomData();
DBUG_ENTER("ndb_binlog_thread_handle_error"); DBUG_ENTER("ndb_binlog_thread_handle_error");
...@@ -2997,7 +2997,7 @@ static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp, ...@@ -2997,7 +2997,7 @@ static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp,
if (overrun) if (overrun)
{ {
/* /*
ToDo: this error should rather clear the binlog_index... ToDo: this error should rather clear the ndb_binlog_index...
and continue and continue
*/ */
sql_print_error("NDB Binlog: Overrun in event buffer, " sql_print_error("NDB Binlog: Overrun in event buffer, "
...@@ -3010,7 +3010,7 @@ static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp, ...@@ -3010,7 +3010,7 @@ static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp,
if (!pOp->isConsistent()) if (!pOp->isConsistent())
{ {
/* /*
ToDo: this error should rather clear the binlog_index... ToDo: this error should rather clear the ndb_binlog_index...
and continue and continue
*/ */
sql_print_error("NDB Binlog: Not Consistent. Cannot " sql_print_error("NDB Binlog: Not Consistent. Cannot "
...@@ -3030,7 +3030,7 @@ static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp, ...@@ -3030,7 +3030,7 @@ static int ndb_binlog_thread_handle_error(Ndb *ndb, NdbEventOperation *pOp,
static int static int
ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb, ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb,
NdbEventOperation *pOp, NdbEventOperation *pOp,
Binlog_index_row &row) ndb_binlog_index_row &row)
{ {
NDB_SHARE *share= (NDB_SHARE *)pOp->getCustomData(); NDB_SHARE *share= (NDB_SHARE *)pOp->getCustomData();
NDBEVENT::TableEvent type= pOp->getEventType(); NDBEVENT::TableEvent type= pOp->getEventType();
...@@ -3046,14 +3046,14 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb, ...@@ -3046,14 +3046,14 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb,
if (ndb_extra_logging) if (ndb_extra_logging)
sql_print_information("NDB Binlog: cluster failure for %s at epoch %u.", sql_print_information("NDB Binlog: cluster failure for %s at epoch %u.",
share->key, (unsigned) pOp->getGCI()); share->key, (unsigned) pOp->getGCI());
if (apply_status_share == share) if (ndb_apply_status_share == share)
{ {
if (ndb_extra_logging && if (ndb_extra_logging &&
ndb_binlog_tables_inited && ndb_binlog_running) ndb_binlog_tables_inited && ndb_binlog_running)
sql_print_information("NDB Binlog: ndb tables initially " sql_print_information("NDB Binlog: ndb tables initially "
"read only on reconnect."); "read only on reconnect.");
free_share(&apply_status_share); free_share(&ndb_apply_status_share);
apply_status_share= 0; ndb_apply_status_share= 0;
} }
DBUG_PRINT("error", ("CLUSTER FAILURE EVENT: " DBUG_PRINT("error", ("CLUSTER FAILURE EVENT: "
"%s received share: 0x%lx op: 0x%lx share op: 0x%lx " "%s received share: 0x%lx op: 0x%lx share op: 0x%lx "
...@@ -3062,14 +3062,14 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb, ...@@ -3062,14 +3062,14 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb,
(long) share->op, (long) share->op_old)); (long) share->op, (long) share->op_old));
break; break;
case NDBEVENT::TE_DROP: case NDBEVENT::TE_DROP:
if (apply_status_share == share) if (ndb_apply_status_share == share)
{ {
if (ndb_extra_logging && if (ndb_extra_logging &&
ndb_binlog_tables_inited && ndb_binlog_running) ndb_binlog_tables_inited && ndb_binlog_running)
sql_print_information("NDB Binlog: ndb tables initially " sql_print_information("NDB Binlog: ndb tables initially "
"read only on reconnect."); "read only on reconnect.");
free_share(&apply_status_share); free_share(&ndb_apply_status_share);
apply_status_share= 0; ndb_apply_status_share= 0;
} }
/* ToDo: remove printout */ /* ToDo: remove printout */
if (ndb_extra_logging) if (ndb_extra_logging)
...@@ -3105,11 +3105,11 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb, ...@@ -3105,11 +3105,11 @@ ndb_binlog_thread_handle_non_data_event(THD *thd, Ndb *ndb,
*/ */
static int static int
ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp, ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
Binlog_index_row &row, ndb_binlog_index_row &row,
injector::transaction &trans) injector::transaction &trans)
{ {
NDB_SHARE *share= (NDB_SHARE*) pOp->getCustomData(); NDB_SHARE *share= (NDB_SHARE*) pOp->getCustomData();
if (share == apply_status_share) if (share == ndb_apply_status_share)
return 0; return 0;
TABLE *table= share->table; TABLE *table= share->table;
...@@ -3380,7 +3380,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3380,7 +3380,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
Ndb *i_ndb= 0; Ndb *i_ndb= 0;
Ndb *s_ndb= 0; Ndb *s_ndb= 0;
Thd_ndb *thd_ndb=0; Thd_ndb *thd_ndb=0;
int ndb_update_binlog_index= 1; int ndb_update_ndb_binlog_index= 1;
injector *inj= injector::instance(); injector *inj= injector::instance();
#ifdef RUN_NDB_BINLOG_TIMER #ifdef RUN_NDB_BINLOG_TIMER
...@@ -3502,8 +3502,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3502,8 +3502,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
thd->proc_info= "Waiting for ndbcluster to start"; thd->proc_info= "Waiting for ndbcluster to start";
pthread_mutex_lock(&injector_mutex); pthread_mutex_lock(&injector_mutex);
while (!schema_share || while (!ndb_schema_share ||
(ndb_binlog_running && !apply_status_share)) (ndb_binlog_running && !ndb_apply_status_share))
{ {
/* ndb not connected yet */ /* ndb not connected yet */
struct timespec abstime; struct timespec abstime;
...@@ -3591,7 +3591,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3591,7 +3591,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
static char db[]= ""; static char db[]= "";
thd->db= db; thd->db= db;
if (ndb_binlog_running) if (ndb_binlog_running)
open_binlog_index(thd, &binlog_tables, &binlog_index); open_ndb_binlog_index(thd, &binlog_tables, &ndb_binlog_index);
thd->db= db; thd->db= db;
} }
do_ndbcluster_binlog_close_connection= BCCC_running; do_ndbcluster_binlog_close_connection= BCCC_running;
...@@ -3647,12 +3647,12 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3647,12 +3647,12 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
!ndb_binlog_running)) !ndb_binlog_running))
break; /* Shutting down server */ break; /* Shutting down server */
if (binlog_index && binlog_index->s->version < refresh_version) if (ndb_binlog_index && ndb_binlog_index->s->version < refresh_version)
{ {
if (binlog_index->s->version < refresh_version) if (ndb_binlog_index->s->version < refresh_version)
{ {
close_thread_tables(thd); close_thread_tables(thd);
binlog_index= 0; ndb_binlog_index= 0;
} }
} }
...@@ -3716,7 +3716,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3716,7 +3716,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
DBUG_PRINT("info", ("pollEvents res: %d", res)); DBUG_PRINT("info", ("pollEvents res: %d", res));
thd->proc_info= "Processing events"; thd->proc_info= "Processing events";
NdbEventOperation *pOp= i_ndb->nextEvent(); NdbEventOperation *pOp= i_ndb->nextEvent();
Binlog_index_row row; ndb_binlog_index_row row;
while (pOp != NULL) while (pOp != NULL)
{ {
#ifdef RUN_NDB_BINLOG_TIMER #ifdef RUN_NDB_BINLOG_TIMER
...@@ -3763,7 +3763,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3763,7 +3763,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
gci_op->getEvent()->getTable()->getName())); gci_op->getEvent()->getTable()->getName()));
continue; continue;
} }
if (share == apply_status_share) if (share == ndb_apply_status_share)
{ {
// skip this table, it is handled specially // skip this table, it is handled specially
continue; continue;
...@@ -3792,9 +3792,9 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3792,9 +3792,9 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
} }
if (trans.good()) if (trans.good())
{ {
if (apply_status_share) if (ndb_apply_status_share)
{ {
TABLE *table= apply_status_share->table; TABLE *table= ndb_apply_status_share->table;
const LEX_STRING& name=table->s->table_name; const LEX_STRING& name=table->s->table_name;
DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
...@@ -3920,8 +3920,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3920,8 +3920,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
row.master_log_pos= start.file_pos(); row.master_log_pos= start.file_pos();
DBUG_PRINT("info", ("COMMIT gci: %lu", (ulong) gci)); DBUG_PRINT("info", ("COMMIT gci: %lu", (ulong) gci));
if (ndb_update_binlog_index) if (ndb_update_ndb_binlog_index)
ndb_add_binlog_index(thd, &row); ndb_add_ndb_binlog_index(thd, &row);
ndb_latest_applied_binlog_epoch= gci; ndb_latest_applied_binlog_epoch= gci;
} }
ndb_latest_handled_binlog_epoch= gci; ndb_latest_handled_binlog_epoch= gci;
...@@ -3949,7 +3949,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3949,7 +3949,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
{ {
ndb_binlog_tables_inited= FALSE; ndb_binlog_tables_inited= FALSE;
close_thread_tables(thd); close_thread_tables(thd);
binlog_index= 0; ndb_binlog_index= 0;
goto restart; goto restart;
} }
err: err:
...@@ -3992,15 +3992,15 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -3992,15 +3992,15 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
10*sleep_cnt, g_ndb_cluster_connection->get_active_ndb_objects(), 10*sleep_cnt, g_ndb_cluster_connection->get_active_ndb_objects(),
ndb_obj_cnt); ndb_obj_cnt);
if (apply_status_share) if (ndb_apply_status_share)
{ {
free_share(&apply_status_share); free_share(&ndb_apply_status_share);
apply_status_share= 0; ndb_apply_status_share= 0;
} }
if (schema_share) if (ndb_schema_share)
{ {
free_share(&schema_share); free_share(&ndb_schema_share);
schema_share= 0; ndb_schema_share= 0;
} }
/* remove all event operations */ /* remove all event operations */
......
...@@ -157,11 +157,11 @@ int ndbcluster_binlog_start(); ...@@ -157,11 +157,11 @@ int ndbcluster_binlog_start();
pthread_handler_t ndb_binlog_thread_func(void *arg); pthread_handler_t ndb_binlog_thread_func(void *arg);
/* /*
table cluster_replication.apply_status table mysql.ndb_apply_status
*/ */
int ndbcluster_setup_binlog_table_shares(THD *thd); int ndbcluster_setup_binlog_table_shares(THD *thd);
extern NDB_SHARE *apply_status_share; extern NDB_SHARE *ndb_apply_status_share;
extern NDB_SHARE *schema_share; extern NDB_SHARE *ndb_schema_share;
extern THD *injector_thd; extern THD *injector_thd;
extern my_bool ndb_binlog_running; extern my_bool ndb_binlog_running;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#define NDB_REP_DB "mysql" #define NDB_REP_DB "mysql"
#define NDB_REP_TABLE "binlog_index" #define NDB_REP_TABLE "ndb_binlog_index"
#define NDB_APPLY_TABLE "apply_status" #define NDB_APPLY_TABLE "ndb_apply_status"
#define NDB_SCHEMA_TABLE "schema" #define OLD_NDB_APPLY_TABLE "apply_status"
#define NDB_SCHEMA_TABLE "ndb_schema"
...@@ -305,8 +305,8 @@ RestoreMetaData::markSysTables() ...@@ -305,8 +305,8 @@ RestoreMetaData::markSysTables()
before we changed the database name of the tables from before we changed the database name of the tables from
"cluster_replication" -> "cluster" -> "mysql" "cluster_replication" -> "cluster" -> "mysql"
*/ */
strcmp(tableName, "cluster_replication/def/" NDB_APPLY_TABLE) == 0 || strcmp(tableName, "cluster_replication/def/" OLD_NDB_APPLY_TABLE) == 0 ||
strcmp(tableName, "cluster/def/" NDB_APPLY_TABLE) == 0 || strcmp(tableName, "cluster/def/" OLD_NDB_APPLY_TABLE) == 0 ||
strcmp(tableName, NDB_REP_DB "/def/" NDB_APPLY_TABLE) == 0 || strcmp(tableName, NDB_REP_DB "/def/" NDB_APPLY_TABLE) == 0 ||
strcmp(tableName, NDB_REP_DB "/def/" NDB_SCHEMA_TABLE)== 0 ) strcmp(tableName, NDB_REP_DB "/def/" NDB_SCHEMA_TABLE)== 0 )
table->isSysTable = true; table->isSysTable = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment