Commit 371c9867 authored by msvensson@shellback.(none)'s avatar msvensson@shellback.(none)

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  shellback.(none):/home/msvensson/mysql/mysql-5.1
parents 7c523830 44e54ed1
......@@ -634,5 +634,5 @@ CREATE TABLE event (
PRIMARY KEY (definer, db, name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
CREATE DATABASE IF NOT EXISTS cluster_replication;
CREATE TABLE IF NOT EXISTS cluster_replication.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 DATABASE IF NOT EXISTS cluster;
CREATE TABLE IF NOT EXISTS cluster.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;
......@@ -1508,8 +1508,8 @@ sub ndbcluster_start ($) {
sub rm_ndbcluster_tables ($) {
my $dir= shift;
foreach my $bin ( glob("$dir/cluster_replication/apply_status*"),
glob("$dir/cluster_replication/schema*") )
foreach my $bin ( glob("$dir/cluster/apply_status*"),
glob("$dir/cluster/schema*") )
{
unlink($bin);
}
......
......@@ -1326,8 +1326,8 @@ start_ndbcluster()
rm_ndbcluster_tables()
{
$RM -f $1/cluster_replication/apply_status*
$RM -f $1/cluster_replication/schema*
$RM -f $1/cluster/apply_status*
$RM -f $1/cluster/schema*
}
stop_ndbcluster()
......
......@@ -47,7 +47,7 @@ create database mysqltest;
show databases;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest
test
......@@ -59,7 +59,7 @@ drop database mysqltest;
show databases;
Database
information_schema
cluster_replication
cluster
mysql
test
drop database mysqltest;
......
......@@ -14,7 +14,7 @@ NULL test latin1 latin1_swedish_ci NULL
select schema_name from information_schema.schemata;
schema_name
information_schema
cluster_replication
cluster
mysql
test
show databases like 't%';
......@@ -23,7 +23,7 @@ test
show databases;
Database
information_schema
cluster_replication
cluster
mysql
test
show databases where `database` = 't%';
......@@ -339,7 +339,7 @@ create view v0 (c) as select schema_name from information_schema.schemata;
select * from v0;
c
information_schema
cluster_replication
cluster
mysql
test
explain select * from v0;
......@@ -835,7 +835,7 @@ delete from mysql.db where user='mysqltest_4';
flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
table_schema count(*)
cluster_replication 1
cluster 1
information_schema 22
mysql 21
create table t1 (i int, j int);
......
DROP SCHEMA test;
CREATE SCHEMA test;
cluster_replication.binlog_index OK
cluster.binlog_index OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
......
......@@ -6,7 +6,7 @@ drop database mysqltest;
use test;
create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select @max_epoch:=max(epoch)-1 from cluster_replication.binlog_index;
select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
@max_epoch:=max(epoch)-1
#
delete from t1;
......@@ -19,25 +19,25 @@ update t2 set b=1 where a=3;
delete from t2 where a=4;
commit;
drop table t2;
select inserts from cluster_replication.binlog_index where epoch > @max_epoch and inserts > 5;
select inserts from cluster.binlog_index where epoch > @max_epoch and inserts > 5;
inserts
10
select deletes from cluster_replication.binlog_index where epoch > @max_epoch and deletes > 5;
select deletes from cluster.binlog_index where epoch > @max_epoch and deletes > 5;
deletes
10
select inserts,updates,deletes from
cluster_replication.binlog_index where epoch > @max_epoch and updates > 0;
cluster.binlog_index where epoch > @max_epoch and updates > 0;
inserts updates deletes
2 1 1
select schemaops from
cluster_replication.binlog_index where epoch > @max_epoch and schemaops > 0;
cluster.binlog_index where epoch > @max_epoch and schemaops > 0;
schemaops
1
1
1
flush logs;
purge master logs before now();
select count(*) from cluster_replication.binlog_index;
select count(*) from cluster.binlog_index;
count(*)
0
create table t1 (a int primary key, b int) engine=ndb;
......@@ -46,17 +46,17 @@ use mysqltest;
create table t1 (c int, d int primary key) engine=ndb;
use test;
insert into mysqltest.t1 values (2,1),(2,2);
select @max_epoch:=max(epoch)-1 from cluster_replication.binlog_index;
select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
@max_epoch:=max(epoch)-1
#
drop table t1;
drop database mysqltest;
select inserts,updates,deletes from
cluster_replication.binlog_index where epoch > @max_epoch and inserts > 0;
cluster.binlog_index where epoch > @max_epoch and inserts > 0;
inserts updates deletes
2 0 0
select schemaops from
cluster_replication.binlog_index where epoch > @max_epoch and schemaops > 0;
cluster.binlog_index where epoch > @max_epoch and schemaops > 0;
schemaops
1
1
......@@ -24,7 +24,7 @@ alter table t2 add column (b int);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster_replication.apply_status
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; alter table t2 add column (b int)
......@@ -36,7 +36,7 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # ALTER DATABASE mysqltest CHARACTER SET latin1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # cluster_replication.apply_status
master-bin.000001 # Table_map # # cluster.apply_status
master-bin.000001 # Write_rows # #
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `mysqltest`; drop table `t1`
......@@ -49,7 +49,7 @@ create table t1 (a int primary key) engine=ndb;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster_replication.apply_status
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Table_map # # test.t2
master-bin1.000001 # Write_rows # #
......@@ -119,7 +119,7 @@ ENGINE = NDB
master-bin1.000001 # Query # # DROP LOGFILE GROUP lg1
ENGINE =NDB
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster_replication.apply_status
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; drop table `t1`
......@@ -12,7 +12,7 @@ a b
1 1
2 2
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index ORDER BY epoch DESC LIMIT 1;
cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch:=epoch inserts updates deletes schemaops
<the_epoch> 2 0 0 0
SELECT * FROM t2 ORDER BY a;
......@@ -20,24 +20,24 @@ a b
1 1
2 2
SELECT inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index WHERE epoch=<the_epoch>;
cluster.binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops
2 0 0 0
DROP TABLE t2;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
INSERT INTO t1 VALUES (1),(2);
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index ORDER BY epoch DESC LIMIT 1;
cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch2:=epoch inserts updates deletes schemaops
<the_epoch2> 2 0 0 0
SELECT inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index WHERE epoch > <the_epoch> AND epoch < <the_epoch2>;
cluster.binlog_index WHERE epoch > <the_epoch> AND epoch < <the_epoch2>;
inserts updates deletes schemaops
0 0 0 1
drop table t1;
SHOW TABLES;
Tables_in_test
SELECT inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index WHERE epoch > <the_epoch> AND epoch < <the_epoch2>;
cluster.binlog_index WHERE epoch > <the_epoch> AND epoch < <the_epoch2>;
inserts updates deletes schemaops
0 0 0 1
......@@ -159,13 +159,15 @@ a2 TEXT NOT NULL,
a3 BIT NOT NULL,
a4 DECIMAL(8,3),
a5 INT NOT NULL,
a6 VARCHAR(255),
a6 INT,
PRIMARY KEY(a1))
TABLESPACE ts1 STORAGE DISK ENGINE=NDB
PARTITION BY LIST (a1)
(PARTITION p0 VALUES IN (1,2,3,4,5),
PARTITION p1 VALUES IN (6,7,8,9, 10),
PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
ALTER TABLE test.t1 DROP COLUMN a6;
ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
SELECT COUNT(*) FROM test.t1;
COUNT(*)
15
......@@ -221,3 +223,41 @@ SELECT * FROM t1;
id b1 vc bc d f total y t
2 NULL NULL NULL NULL NULL NULL NULL NULL
DROP TABLE t1;
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null)
partition by list(a)
partitions 2
(partition x123 values in (1,5,6),
partition x234 values in (4,7,8));
INSERT into t1 VALUES (5,1,1);
select * from t1;
a b c
5 1 1
UPDATE t1 SET a=8 WHERE a=5 AND b=1;
select * from t1;
a b c
8 1 1
drop table t1;
CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
PARTITION BY RANGE(f1)
( PARTITION part1 VALUES LESS THAN (2),
PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');
select * from t1;
f1 f2
1 ---1---
2 ---2---
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
select * from t1;
f1 f2
1 ---1---
6 ---2---
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
select * from t1;
f1 f2
5 ---1---
6 ---2---
drop table t1;
......@@ -259,7 +259,7 @@ prepare stmt4 from ' show databases ';
execute stmt4;
Database
information_schema
cluster_replication
cluster
mysql
test
prepare stmt4 from ' show tables from test like ''t2%'' ';
......
......@@ -23,7 +23,7 @@ ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest_bob
mysqltest_prometheus
......@@ -32,7 +32,7 @@ test
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest_prometheus
mysqltest_sisyfos
......@@ -47,7 +47,7 @@ CREATE TABLE t2 (a INT);
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest_bob
mysqltest_prometheus
......@@ -56,7 +56,7 @@ test
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest_prometheus
mysqltest_sisyfos
......
......@@ -33,7 +33,7 @@ create database mysqltest;
show databases;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest
mysqltest2
......@@ -51,7 +51,7 @@ set sql_log_bin = 1;
show databases;
Database
information_schema
cluster_replication
cluster
mysql
test
create database mysqltest2;
......@@ -71,7 +71,7 @@ load data from master;
show databases;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest
mysqltest2
......
......@@ -21,7 +21,7 @@ COUNT(*)
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
mysqltest
test
......
......@@ -47,17 +47,17 @@ CREATE DATABASE IF NOT EXISTS BANK;
DROP DATABASE BANK;
CREATE DATABASE BANK;
RESET MASTER;
CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
CREATE TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM cluster.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
FROM cluster.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
<the_pos> master-bin.000001
CHANGE MASTER TO
......
......@@ -86,41 +86,41 @@ a int not null primary key,
b text not null
) engine=ndb
master-bin.000001 239 Query 1 303 BEGIN
master-bin.000001 303 Table_map 1 65 cluster_replication.apply_status
master-bin.000001 368 Write_rows 1 107
master-bin.000001 410 Table_map 1 147 test.t1
master-bin.000001 450 Write_rows 1 818
master-bin.000001 1121 Write_rows 1 9853
master-bin.000001 10156 Query 1 10221 COMMIT
master-bin.000001 10221 Query 1 10285 BEGIN
master-bin.000001 10285 Table_map 1 65 cluster_replication.apply_status
master-bin.000001 10350 Write_rows 1 107
master-bin.000001 10392 Query 1 10457 COMMIT
master-bin.000001 10457 Query 1 10533 use `test`; drop table t1
master-bin.000001 10533 Query 1 10708 use `test`; create table t1 (
master-bin.000001 303 Table_map 1 53 cluster.apply_status
master-bin.000001 356 Write_rows 1 95
master-bin.000001 398 Table_map 1 135 test.t1
master-bin.000001 438 Write_rows 1 806
master-bin.000001 1109 Write_rows 1 9841
master-bin.000001 10144 Query 1 10209 COMMIT
master-bin.000001 10209 Query 1 10273 BEGIN
master-bin.000001 10273 Table_map 1 53 cluster.apply_status
master-bin.000001 10326 Write_rows 1 95
master-bin.000001 10368 Query 1 10433 COMMIT
master-bin.000001 10433 Query 1 10509 use `test`; drop table t1
master-bin.000001 10509 Query 1 10684 use `test`; create table t1 (
a int not null primary key,
b text not null,
c int,
d longblob,
e tinyblob
) engine=ndbcluster
master-bin.000001 10708 Query 1 10772 BEGIN
master-bin.000001 10772 Table_map 1 65 cluster_replication.apply_status
master-bin.000001 10837 Write_rows 1 107
master-bin.000001 10879 Table_map 1 150 test.t1
master-bin.000001 10922 Write_rows 1 48934
master-bin.000001 59706 Write_rows 1 124436
master-bin.000001 135208 Write_rows 1 124542
master-bin.000001 135314 Write_rows 1 205961
master-bin.000001 216733 Write_rows 1 224245
master-bin.000001 235017 Write_rows 1 227523
master-bin.000001 238295 Write_rows 1 242391
master-bin.000001 253163 Write_rows 1 254087
master-bin.000001 264859 Write_rows 1 304335
master-bin.000001 315107 Write_rows 1 330427
master-bin.000001 341199 Query 1 341264 COMMIT
master-bin.000001 341264 Query 1 341328 BEGIN
master-bin.000001 341328 Table_map 1 65 cluster_replication.apply_status
master-bin.000001 341393 Write_rows 1 107
master-bin.000001 341435 Query 1 341500 COMMIT
master-bin.000001 341500 Query 1 341576 use `test`; drop table t1
master-bin.000001 10684 Query 1 10748 BEGIN
master-bin.000001 10748 Table_map 1 53 cluster.apply_status
master-bin.000001 10801 Write_rows 1 95
master-bin.000001 10843 Table_map 1 138 test.t1
master-bin.000001 10886 Write_rows 1 48922
master-bin.000001 59670 Write_rows 1 124424
master-bin.000001 135172 Write_rows 1 124530
master-bin.000001 135278 Write_rows 1 205949
master-bin.000001 216697 Write_rows 1 224233
master-bin.000001 234981 Write_rows 1 227511
master-bin.000001 238259 Write_rows 1 242379
master-bin.000001 253127 Write_rows 1 254075
master-bin.000001 264823 Write_rows 1 304323
master-bin.000001 315071 Write_rows 1 330415
master-bin.000001 341163 Query 1 341228 COMMIT
master-bin.000001 341228 Query 1 341292 BEGIN
master-bin.000001 341292 Table_map 1 53 cluster.apply_status
master-bin.000001 341345 Write_rows 1 95
master-bin.000001 341387 Query 1 341452 COMMIT
master-bin.000001 341452 Query 1 341528 use `test`; drop table t1
......@@ -57,11 +57,11 @@ master-bin.000001 798 Query 1 978 use `test`; CREATE TABLE t1
tablespace ts1 storage disk
engine ndb
master-bin.000001 978 Query 1 1042 BEGIN
master-bin.000001 1042 Table_map 1 65 cluster_replication.apply_status
master-bin.000001 1107 Write_rows 1 107
master-bin.000001 1149 Table_map 1 148 test.t1
master-bin.000001 1190 Write_rows 1 190
master-bin.000001 1232 Query 1 1297 COMMIT
master-bin.000001 1042 Table_map 1 53 cluster.apply_status
master-bin.000001 1095 Write_rows 1 95
master-bin.000001 1137 Table_map 1 136 test.t1
master-bin.000001 1178 Write_rows 1 178
master-bin.000001 1220 Query 1 1285 COMMIT
drop table t1;
alter tablespace ts1
drop datafile 'datafile.dat'
......
......@@ -9,14 +9,14 @@ INSERT INTO t1 VALUES ("row1","will go away",1);
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
row1 will go away 1
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
row1 will go away 1
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch = <the_epoch> ;
FROM cluster.binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
<the_pos> master-bin.000001
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
......
......@@ -21,7 +21,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
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 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Table_map 1 # cluster.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
......@@ -29,7 +29,7 @@ master-bin.000001 # Query 1 # COMMIT
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 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Table_map 1 # cluster.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
......@@ -43,7 +43,7 @@ master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_in
master-bin.000001 # Query 1 # BEGIN
show binlog events from 102 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Table_map 1 # cluster.apply_status
flush logs;
create table t3 (a int)ENGINE=NDB;
start slave;
......@@ -56,7 +56,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
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 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Table_map 1 # cluster.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
......@@ -64,7 +64,7 @@ master-bin.000001 # Query 1 # COMMIT
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 # BEGIN
master-bin.000001 # Table_map 1 # cluster_replication.apply_status
master-bin.000001 # Table_map 1 # cluster.apply_status
master-bin.000001 # Write_rows 1 #
master-bin.000001 # Table_map 1 # test.t1
master-bin.000001 # Write_rows 1 #
......@@ -76,7 +76,7 @@ master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
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 # BEGIN
master-bin.000002 # Table_map 1 # cluster_replication.apply_status
master-bin.000002 # Table_map 1 # cluster.apply_status
master-bin.000002 # Write_rows 1 #
master-bin.000002 # Table_map 1 # test.t2
master-bin.000002 # Write_rows 1 #
......@@ -95,7 +95,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
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 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Table_map 2 # cluster.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Table_map 2 # test.t1
slave-bin.000001 # Write_rows 2 #
......@@ -104,7 +104,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 t3 (a int)ENGINE=NDB
slave-bin.000001 # Query 2 # BEGIN
slave-bin.000001 # Table_map 2 # cluster_replication.apply_status
slave-bin.000001 # Table_map 2 # cluster.apply_status
slave-bin.000001 # Write_rows 2 #
slave-bin.000001 # Table_map 2 # test.t1
slave-bin.000001 # Write_rows 2 #
......@@ -115,7 +115,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
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 2 # BEGIN
slave-bin.000002 # Table_map 2 # cluster_replication.apply_status
slave-bin.000002 # Table_map 2 # cluster.apply_status
slave-bin.000002 # Write_rows 2 #
slave-bin.000002 # Table_map 2 # test.t2
slave-bin.000002 # Write_rows 2 #
......
......@@ -16,7 +16,7 @@ row1 will go away 1
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
row1 will go away 1
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT * FROM t1 ORDER BY c3;
......@@ -24,7 +24,7 @@ c1 c2 c3
row1 will go away 1
stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch = <the_epoch> ;
FROM cluster.binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
102 master-bin1.000001
CHANGE MASTER TO
......
......@@ -25,13 +25,13 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
CREATE TEMPORARY TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE cluster_replication.backup_info;
DROP TABLE cluster.backup_info;
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
hex(c1) hex(c2) c3
......@@ -60,11 +60,11 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
@the_epoch:=MAX(epoch)
<the_epoch>
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
FROM cluster.binlog_index WHERE epoch > <the_epoch> ORDER BY epoch ASC LIMIT 1;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
<the_pos> master-bin.000001
CHANGE MASTER TO
......@@ -89,8 +89,8 @@ hex(c2) hex(c3) c1
DROP DATABASE ndbsynctest;
STOP SLAVE;
reset master;
select * from cluster_replication.binlog_index;
select * from cluster.binlog_index;
Position File epoch inserts updates deletes schemaops
reset slave;
select * from cluster_replication.apply_status;
select * from cluster.apply_status;
server_id epoch
......@@ -9,7 +9,7 @@ CREATE DATABASE test_ignore;
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
test
test_ignore
......@@ -29,7 +29,7 @@ INSERT INTO t2 VALUES (3,3), (4,4);
SHOW DATABASES;
Database
information_schema
cluster_replication
cluster
mysql
test
USE test;
......
......@@ -6,7 +6,7 @@ foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
show schemas;
Database
information_schema
cluster_replication
cluster
foo
mysql
test
......
......@@ -53,7 +53,7 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
show databases;
Database
information_schema
cluster_replication
cluster
mysql
test
show databases like "test%";
......
......@@ -22,16 +22,16 @@ partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite
#rpl_bit_npk : Bug#13418
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
rpl_ndb_2innodb : Bugs#17400, 17687, 17701
rpl_ndb_2myisam : Bugs#17400, 17687, 17701
rpl_ndb_2innodb : Bugs#17400: delete & update of rows in table without pk fails
rpl_ndb_2myisam : Bugs#17400: delete & update of rows in table without pk fails
rpl_ndb_auto_inc : Bug#17086
rpl_ndb_basic : Bug#16228 [IN REVIEW]
rpl_ndb_charset : Bug#17246
rpl_ndb_ddl : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_innodb2ndb : Bugs#17400, 17687, 17701
rpl_ndb_innodb2ndb : Bugs#17400: delete & update of rows in table without pk fails
rpl_ndb_insert_ignore : Bugs: #17431: INSERT IGNORE INTO returns failed: 1296
rpl_ndb_myisam2ndb : Bugs#17400, 17687, 17701
rpl_ndb_myisam2ndb : Bugs#17400: delete & update of rows in table without pk fails
rpl_ndb_log : result not deterministic
rpl_ndb_relay_space : Bug#16993
rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
......
......@@ -19,7 +19,7 @@ create table t1 (a int primary key) engine=ndb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
save_master_pos;
--replace_column 1 #
select @max_epoch:=max(epoch)-1 from cluster_replication.binlog_index;
select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
delete from t1;
alter table t1 add (b int);
......@@ -38,12 +38,12 @@ drop table t2;
# (save_master_pos waits for last gcp to complete, ensuring that we have
# the expected data in the binlog)
save_master_pos;
select inserts from cluster_replication.binlog_index where epoch > @max_epoch and inserts > 5;
select deletes from cluster_replication.binlog_index where epoch > @max_epoch and deletes > 5;
select inserts from cluster.binlog_index where epoch > @max_epoch and inserts > 5;
select deletes from cluster.binlog_index where epoch > @max_epoch and deletes > 5;
select inserts,updates,deletes from
cluster_replication.binlog_index where epoch > @max_epoch and updates > 0;
cluster.binlog_index where epoch > @max_epoch and updates > 0;
select schemaops from
cluster_replication.binlog_index where epoch > @max_epoch and schemaops > 0;
cluster.binlog_index where epoch > @max_epoch and schemaops > 0;
#
# check that purge clears the binlog_index
......@@ -51,7 +51,7 @@ select schemaops from
flush logs;
--sleep 1
purge master logs before now();
select count(*) from cluster_replication.binlog_index;
select count(*) from cluster.binlog_index;
#
# several tables in different databases
......@@ -66,11 +66,11 @@ use test;
insert into mysqltest.t1 values (2,1),(2,2);
save_master_pos;
--replace_column 1 #
select @max_epoch:=max(epoch)-1 from cluster_replication.binlog_index;
select @max_epoch:=max(epoch)-1 from cluster.binlog_index;
drop table t1;
drop database mysqltest;
select inserts,updates,deletes from
cluster_replication.binlog_index where epoch > @max_epoch and inserts > 0;
cluster.binlog_index where epoch > @max_epoch and inserts > 0;
select schemaops from
cluster_replication.binlog_index where epoch > @max_epoch and schemaops > 0;
cluster.binlog_index where epoch > @max_epoch and schemaops > 0;
......@@ -14,7 +14,7 @@ drop table if exists t1,t2;
# and sets up the replication correctly
#
# no tables and nothing in cluster_replication.binlog_index;
# no tables and nothing in cluster.binlog_index;
connection server1;
SHOW TABLES;
......@@ -33,7 +33,7 @@ select * from t2 order by a;
save_master_pos;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=epoch,inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index ORDER BY epoch DESC LIMIT 1;
cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
let $the_epoch= `SELECT @the_epoch`;
# see if we got something on server1
......@@ -41,7 +41,7 @@ connection server1;
SELECT * FROM t2 ORDER BY a;
--replace_result $the_epoch <the_epoch>
eval SELECT inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index WHERE epoch=$the_epoch;
cluster.binlog_index WHERE epoch=$the_epoch;
# drop the table on server1
DROP TABLE t2;
......@@ -50,12 +50,12 @@ INSERT INTO t1 VALUES (1),(2);
save_master_pos;
--replace_column 1 <the_epoch2>
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index ORDER BY epoch DESC LIMIT 1;
cluster.binlog_index ORDER BY epoch DESC LIMIT 1;
let $the_epoch2= `SELECT @the_epoch2`;
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index WHERE epoch > $the_epoch AND epoch < $the_epoch2;
cluster.binlog_index WHERE epoch > $the_epoch AND epoch < $the_epoch2;
drop table t1;
# flush on server2
......@@ -63,7 +63,7 @@ connection server2;
SHOW TABLES;
--replace_result $the_epoch <the_epoch> $the_epoch2 <the_epoch2>
eval SELECT inserts,updates,deletes,schemaops FROM
cluster_replication.binlog_index WHERE epoch > $the_epoch AND epoch < $the_epoch2;
cluster.binlog_index WHERE epoch > $the_epoch AND epoch < $the_epoch2;
# reset
connection server1;
......
......@@ -140,7 +140,7 @@ CREATE TABLE test.t1 (
a3 BIT NOT NULL,
a4 DECIMAL(8,3),
a5 INT NOT NULL,
a6 VARCHAR(255),
a6 INT,
PRIMARY KEY(a1))
TABLESPACE ts1 STORAGE DISK ENGINE=NDB
PARTITION BY LIST (a1)
......@@ -148,6 +148,10 @@ CREATE TABLE test.t1 (
PARTITION p1 VALUES IN (6,7,8,9, 10),
PARTITION p2 VALUES IN (11, 12, 13, 14, 15));
# Alter table directly without any statements inbetween
ALTER TABLE test.t1 DROP COLUMN a6;
ALTER TABLE test.t1 ADD COLUMN a6 VARCHAR(255);
let $j= 15;
--disable_query_log
while ($j)
......@@ -223,3 +227,34 @@ ALTER TABLE t1 ADD PARTITION
(PARTITION p2 VALUES IN (412));
SELECT * FROM t1;
DROP TABLE t1;
#
# Bug #17806 Update on NDB table with list partition causes mysqld to core
# Bug #16385 Partitions: crash when updating a range partitioned NDB table
#
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null)
partition by list(a)
partitions 2
(partition x123 values in (1,5,6),
partition x234 values in (4,7,8));
INSERT into t1 VALUES (5,1,1);
select * from t1;
UPDATE t1 SET a=8 WHERE a=5 AND b=1;
select * from t1;
drop table t1;
CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) engine=ndb
PARTITION BY RANGE(f1)
( PARTITION part1 VALUES LESS THAN (2),
PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');
select * from t1;
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
select * from t1;
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
select * from t1;
drop table t1;
......@@ -118,11 +118,11 @@ RESET MASTER;
# there is no neat way to find the backupid, this is a hack to find it...
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
CREATE TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
CREATE TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM cluster.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
let the_backup_id=`select @the_backup_id`;
# restore on slave, first check that nothing is there
......@@ -140,7 +140,7 @@ let the_backup_id=`select @the_backup_id`;
# 1.
--connection slave
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
--let $the_epoch= `select @the_epoch`
# 2.
......@@ -148,7 +148,7 @@ SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
--let $the_pos= `SELECT @the_pos`
--let $the_file= `SELECT @the_file`
......
......@@ -4,7 +4,7 @@
#
# Currently test only works with ndb since it retrieves "old"
# binlog positions with cluster_replication.binlog_index and apply_status;
# binlog positions with cluster.binlog_index and apply_status;
#
# create a table with one row
......@@ -15,7 +15,7 @@ SELECT * FROM t1 ORDER BY c3;
# sync slave and retrieve epoch
sync_slave_with_master;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
let $the_epoch= `select @the_epoch` ;
SELECT * FROM t1 ORDER BY c3;
......@@ -24,7 +24,7 @@ connection master;
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch = $the_epoch ;
FROM cluster.binlog_index WHERE epoch = $the_epoch ;
let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ;
......
......@@ -7,7 +7,7 @@
#
# Currently test only works with ndb since it retrieves "old"
# binlog positions with cluster_replication.binlog_index and apply_status;
# binlog positions with cluster.binlog_index and apply_status;
#
# create a table with one row, and make sure the other "master" gets it
......@@ -25,7 +25,7 @@ SELECT * FROM t1 ORDER BY c3;
connection master;
sync_slave_with_master;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
let $the_epoch= `select @the_epoch` ;
SELECT * FROM t1 ORDER BY c3;
stop slave;
......@@ -34,7 +34,7 @@ stop slave;
connection server2;
--replace_result $the_epoch <the_epoch>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch = $the_epoch ;
FROM cluster.binlog_index WHERE epoch = $the_epoch ;
let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ;
......
......@@ -4,7 +4,7 @@
#
# Currently test only works with ndb since it retrieves "old"
# binlog positions with cluster_replication.binlog_index and apply_status;
# binlog positions with cluster.binlog_index and apply_status;
#
# stop the save
......@@ -27,13 +27,13 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
# take a backup on master
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS cluster_replication.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster_replication.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster_replication.backup_info FIELDS TERMINATED BY ',';
CREATE TEMPORARY TABLE IF NOT EXISTS cluster.backup_info (id INT, backup_id INT)ENGINE=HEAP;
DELETE FROM cluster.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE cluster.backup_info FIELDS TERMINATED BY ',';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM cluster_replication.backup_info;
SELECT @the_backup_id:=backup_id FROM cluster.backup_info;
let the_backup_id=`select @the_backup_id` ;
DROP TABLE cluster_replication.backup_info;
DROP TABLE cluster.backup_info;
# update a row
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
......@@ -73,7 +73,7 @@ SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
# 1.
connection slave;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM cluster_replication.apply_status;
SELECT @the_epoch:=MAX(epoch) FROM cluster.apply_status;
let $the_epoch= `select @the_epoch` ;
# 2.
......@@ -81,7 +81,7 @@ connection master;
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM cluster_replication.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
FROM cluster.binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ;
......@@ -124,11 +124,11 @@ STOP SLAVE;
connection master;
reset master;
# should now contain nothing
select * from cluster_replication.binlog_index;
select * from cluster.binlog_index;
connection slave;
reset slave;
# should now contain nothing
select * from cluster_replication.apply_status;
select * from cluster.apply_status;
# End 5.1 Test
......@@ -874,8 +874,8 @@ $c_pp
$c_gl
$c_sl
$c_ev
CREATE DATABASE IF NOT EXISTS cluster_replication;
CREATE TABLE IF NOT EXISTS cluster_replication.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 DATABASE IF NOT EXISTS cluster;
CREATE TABLE IF NOT EXISTS cluster.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
......@@ -1684,15 +1684,16 @@ int ha_ndbcluster::pk_read(const byte *key, uint key_len, byte *buf,
/*
Read one complementing record from NDB using primary key from old_data
or hidden key
*/
int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data,
int ha_ndbcluster::complemented_read(const byte *old_data, byte *new_data,
uint32 old_part_id)
{
uint no_fields= table_share->fields, i;
NdbTransaction *trans= m_active_trans;
NdbOperation *op;
DBUG_ENTER("complemented_pk_read");
DBUG_ENTER("complemented_read");
m_write_op= FALSE;
if (ha_get_all_bit_in_read_set())
......@@ -1706,9 +1707,17 @@ int ha_ndbcluster::complemented_pk_read(const byte *old_data, byte *new_data,
if (!(op= trans->getNdbOperation((const NDBTAB *) m_table)) ||
op->readTuple(lm) != 0)
ERR_RETURN(trans->getNdbError());
int res;
if ((res= set_primary_key_from_record(op, old_data)))
if (table_share->primary_key != MAX_KEY)
{
if (set_primary_key_from_record(op, old_data))
ERR_RETURN(trans->getNdbError());
}
else
{
// This table has no primary key, use "hidden" primary key
if (set_hidden_key(op, table->s->fields, m_ref))
ERR_RETURN(op->getNdbError());
}
if (m_use_partition_function)
op->setPartitionId(old_part_id);
......@@ -2501,19 +2510,23 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
DBUG_RETURN(error);
}
/* Check for update of primary key for special handling */
if ((table_share->primary_key != MAX_KEY) &&
(key_cmp(table_share->primary_key, old_data, new_data)) ||
/*
* Check for update of primary key or partition change
* for special handling
*/
if (((table_share->primary_key != MAX_KEY) &&
key_cmp(table_share->primary_key, old_data, new_data)) ||
(old_part_id != new_part_id))
{
int read_res, insert_res, delete_res, undo_res;
DBUG_PRINT("info", ("primary key update, doing pk read+delete+insert"));
DBUG_PRINT("info", ("primary key update or partition change, "
"doing read+delete+insert"));
// Get all old fields, since we optimize away fields not in query
read_res= complemented_pk_read(old_data, new_data, old_part_id);
read_res= complemented_read(old_data, new_data, old_part_id);
if (read_res)
{
DBUG_PRINT("info", ("pk read failed"));
DBUG_PRINT("info", ("read failed"));
DBUG_RETURN(read_res);
}
// Delete old row
......
......@@ -731,7 +731,7 @@ private:
char* get_tablespace_name(THD *thd);
int set_range_data(void *tab, partition_info* part_info);
int set_list_data(void *tab, partition_info* part_info);
int complemented_pk_read(const byte *old_data, byte *new_data,
int complemented_read(const byte *old_data, byte *new_data,
uint32 old_part_id);
int pk_read(const byte *key, uint key_len, byte *buf, uint32 part_id);
int ordered_index_scan(const key_range *start_key,
......
......@@ -184,8 +184,8 @@ static void dbug_print_table(const char *info, TABLE *table)
Run a query through mysql_parse
Used to:
- purging the cluster_replication.binlog_index
- creating the cluster_replication.apply_status table
- purging the binlog_index
- creating the apply_status table
*/
static void run_query(THD *thd, char *buf, char *end,
my_bool print_error, my_bool disable_binlog)
......@@ -606,7 +606,7 @@ void ndbcluster_binlog_init_handlerton()
/*
check the availability af the cluster_replication.apply_status share
check the availability af the apply_status share
- return share, but do not increase refcount
- return 0 if there is no share
*/
......@@ -624,7 +624,7 @@ static NDB_SHARE *ndbcluster_check_apply_status_share()
}
/*
check the availability af the cluster_replication.schema share
check the availability af the schema share
- return share, but do not increase refcount
- return 0 if there is no share
*/
......@@ -642,7 +642,7 @@ static NDB_SHARE *ndbcluster_check_schema_share()
}
/*
Create the cluster_replication.apply_status table
Create the apply_status table
*/
static int ndbcluster_create_apply_status_table(THD *thd)
{
......@@ -691,7 +691,7 @@ static int ndbcluster_create_apply_status_table(THD *thd)
/*
Create the cluster_replication.schema table
Create the schema table
*/
static int ndbcluster_create_schema_table(THD *thd)
{
......@@ -1655,13 +1655,13 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
/*********************************************************************
Internal helper functions for handeling of the cluster replication tables
- cluster_replication.binlog_index
- cluster_replication.apply_status
- binlog_index
- apply_status
*********************************************************************/
/*
struct to hold the data to be inserted into the
cluster_replication.binlog_index table
binlog_index table
*/
struct Binlog_index_row {
ulonglong gci;
......@@ -1674,7 +1674,7 @@ struct Binlog_index_row {
};
/*
Open the cluster_replication.binlog_index table
Open the binlog_index table
*/
static int open_binlog_index(THD *thd, TABLE_LIST *tables,
TABLE **binlog_index)
......@@ -1705,7 +1705,7 @@ static int open_binlog_index(THD *thd, TABLE_LIST *tables,
}
/*
Insert one row in the cluster_replication.binlog_index
Insert one row in the binlog_index
declared friend in handler.h to be able to call write_row directly
so that this insert is not replicated
......
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define NDB_REP_DB "cluster_replication"
#define NDB_REP_DB "cluster"
#define NDB_REP_TABLE "binlog_index"
#define NDB_APPLY_TABLE "apply_status"
#define NDB_SCHEMA_TABLE "schema"
......@@ -58,7 +58,7 @@ void mysql_client_binlog_statement(THD* thd)
const char *error= 0;
char *buf= (char *) my_malloc(event_len, MYF(MY_WME));
Log_event *ev;
Log_event *ev = 0;
int res;
/*
......
......@@ -1414,6 +1414,7 @@ static bool set_up_partition_bitmap(THD *thd, partition_info *part_info)
DBUG_RETURN(TRUE);
}
bitmap_init(&part_info->used_partitions, bitmap_buf, bitmap_bytes*8, FALSE);
bitmap_set_all(&part_info->used_partitions);
DBUG_RETURN(FALSE);
}
......
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