Skip to content

Commit d6fab5c

Browse files
committed
merge 7.1 -> 7.2
2 parents 60a0aae + 4d8af51 commit d6fab5c

9 files changed

+698
-43
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# ndb_check_blob_tables.inc - check that all blob tables use same hashmap as main table
3+
#
4+
# Usage:
5+
# let ndb_die_on_error= 1; # 1 if it should fail on hashmap mismatch
6+
# let ndb_database= <table database>;
7+
# let ndb_table= <table name>;
8+
# --source suite/ndb/include/ndb_check_blob_tables.inc
9+
#
10+
11+
--perl
12+
use strict;
13+
14+
my $die_on_error = $ENV{ndb_die_on_error};
15+
my $db = $ENV{ndb_database} or die "Missing ndb_database in environment";
16+
my $tbl = $ENV{ndb_table} or die "Mising ndb_table in environment";
17+
my $cmd = "$ENV{NDB_DESC} -d$db $tbl";
18+
19+
my $hashmap;
20+
open MAIN, "$cmd|";
21+
print "Table: $db.$tbl\n";
22+
while (<MAIN>)
23+
{
24+
if (/HashMap: (\S+).*/)
25+
{
26+
print;
27+
$hashmap = $1;
28+
}
29+
if (/(\w+) .* BT=(NDB.BLOB_\d+_\d+).*/)
30+
{
31+
print;
32+
my $column = $1;
33+
my $blob_table = $2;
34+
my $bt_hashmap;
35+
$blob_table =~ s/_/\"\"_/;
36+
open BLOB, "$ENV{NDB_DESC} -d$db $blob_table|"
37+
or die "FAILED: $ENV{NDB_DESC} -d$db $blob_table|";
38+
while (<BLOB>)
39+
{
40+
if (/HashMap: (\S+).*/)
41+
{
42+
print;
43+
$bt_hashmap = $1;
44+
}
45+
}
46+
close BLOB;
47+
if ($die_on_error and ($bt_hashmap ne $hashmap))
48+
{
49+
die "Blob table $db.$blob_table for $db.$tbl.$column have wrong hashmap. ($bt_hashmap is not $hashmap)"
50+
}
51+
}
52+
}
53+
close MAIN;
54+
EOF
55+
56+
let ndb_die_on_error=;
57+
let ndb_database=;
58+
let ndb_table=;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#
2+
# ndb_get_blob_tables.inc - get blob tables names for all blob columns
3+
#
4+
# Usage:
5+
# let ndb_database= <table database>;
6+
# let ndb_table= <table name>;
7+
# --source suite/ndb/include/ndb_get_blob_tables.inc
8+
#
9+
# For each blob column where will be a variable
10+
# $bt_<table database>_<table_name>_<column_name>
11+
# with the blob table name (with escaped $)
12+
#
13+
14+
let ndb_get_blob_tables_result_file= $MYSQLTEST_VARDIR/tmp/ndb_get_blob_tables_result.inc;
15+
--perl
16+
my $db = $ENV{ndb_database} or die "Missing ndb_database in environment";
17+
my $tbl = $ENV{ndb_table} or die "Missing ndb_table in environment";
18+
my $cmd = "$ENV{NDB_DESC} -d$db $tbl";
19+
20+
open RUN, "$cmd|";
21+
open RES, ">$ENV{ndb_get_blob_tables_result_file}";
22+
while (<RUN>)
23+
{
24+
if (/(\w+) .* BT=(NDB.BLOB_\d+_\d+).*/)
25+
{
26+
my $column = $1;
27+
my $blob_table = $2;
28+
$blob_table =~ s/\$/\\\$/g;
29+
print RES "let \$bt_${db}_${tbl}_${column} = ".$blob_table.";\n";
30+
}
31+
}
32+
close RES;
33+
close RUN;
34+
EOF
35+
36+
let ndb_database=;
37+
let ndb_table=;
38+
39+
--source $ndb_get_blob_tables_result_file
40+
--remove_file $ndb_get_blob_tables_result_file

mysql-test/suite/ndb/t/ndb_addnode.cnf

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ MASTER_MYPORT= @mysqld.1.1.port
2828
MASTER_MYPORT1= @mysqld.2.1.port
2929

3030
NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
31-
31+
unique=$unique
32+
BLOB=$BLOB

mysql-test/suite/ndb/t/ndb_addnode.test

+26-1
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,29 @@ create table t2(id int NOT NULL PRIMARY KEY, data char(8))
2121
TABLESPACE ts_1 STORAGE DISK engine=ndb;
2222
# BUG#13714648
2323
create table t5(id int NOT NULL PRIMARY KEY, data char(8)) max_rows=50000000 engine=ndb;
24+
create table t6(id int not null primary key, dat blob, txt text) engine=ndb;
25+
26+
# Get blob tables table test.t6
27+
let ndb_database= test;
28+
let ndb_table= t6;
29+
--source suite/ndb/include/ndb_get_blob_tables.inc
2430

2531
load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 fields terminated by ' ' lines terminated by '\n';
2632
load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 fields terminated by ' ' lines terminated by '\n';
2733
load data local infile 'suite/ndb/data/table_data10000.dat' into table t5 fields terminated by ' ' lines terminated by '\n';
34+
load data local infile 'suite/ndb/data/table_data10000.dat' into table t6 fields terminated by ' ' lines terminated by '\n' (id, @data) set dat = repeat(@data, 100), txt = repeat(@data,100);
2835

2936
select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
3037
select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
3138
select @init_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
39+
select count(1) as t6_part_count from information_schema.partitions where table_schema='test' and table_name='t6';
3240

3341
## Check details of t5 partitioning
3442
--exec $NDB_DESC -dtest -p -n t5
3543

44+
## Check details of t6 partitioning
45+
--exec $NDB_DESC -dtest -p -n t6 '$bt_test_t6_dat' '$bt_test_t6_txt'
46+
3647
## Create nodegroup for "new" nodes
3748
--exec $NDB_MGM -e "create nodegroup 3,4"
3849

@@ -58,12 +69,14 @@ insert into t4(id, data) VALUES
5869
alter online table t1 reorganize partition;
5970
alter online table t2 reorganize partition;
6071
alter online table t5 max_rows=100000000;
72+
alter online table t6 reorganize partition;
6173

6274
select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
6375
select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
6476
select count(1) as t3_part_count from information_schema.partitions where table_schema='test' and table_name='t3';
6577
select count(1) as t4_part_count from information_schema.partitions where table_schema='test' and table_name='t4';
6678
select @reorg_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
79+
select count(1) as t6_part_count from information_schema.partitions where table_schema='test' and table_name='t6';
6780

6881
## Check details of t5 partitioning
6982
--exec $NDB_DESC -dtest -p -n t5
@@ -75,6 +88,18 @@ if (!$t5_part_diff)
7588
--die Table t5 was not reorganised
7689
}
7790

91+
## Simple blob usage of t6
92+
select count(0) as row_count, sum(length(dat)) as data_length, sum(length(txt)) as text_length from t6;
93+
94+
## Check details of t6 partitioning
95+
--exec $NDB_DESC -dtest -p -n t6 '$bt_test_t6_dat' '$bt_test_t6_txt'
96+
97+
# Check that main table and blob tables have same hashmap.
98+
let ndb_database= test;
99+
let ndb_table= t6;
100+
let ndb_die_on_error= 1;
101+
--source suite/ndb/include/ndb_check_blob_tables.inc
102+
78103
## Drop nodegroup with "new" nodes is not allowed with data one those nodes
79104
# NOTE: --error=0 is due to return codes doesnt work on windoze
80105
--error 0,255
@@ -83,7 +108,7 @@ if (!$t5_part_diff)
83108
## Nodegroup with "new" nodes still exist after dropping it as shown:
84109
--exec $NDB_MGM -e show
85110

86-
drop table t1,t2,t3,t4,t5;
111+
drop table t1,t2,t3,t4,t5,t6;
87112

88113
## Drop nodegroup with "new" nodes
89114
--exec $NDB_MGM -e "drop nodegroup 1"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
!include include/default_mysqld.cnf
2+
!include include/default_ndbd.cnf
3+
!include my.cnf
4+
5+
[cluster_config.1]
6+
NoOfReplicas= 2
7+
DataMemory= 80M
8+
IndexMemory= 20M
9+
#NoOfFragmentLogFiles= 4
10+
NoOfFragmentLogFiles= 16
11+
#FragmentLogFileSize= 80M
12+
FragmentLogFileSize= 100M
13+
#RedoBuffer= 100M
14+
RedoBuffer= 200M
15+
#TransactionDeadlockDetectionTimeout= 7500
16+
ndbd=,,,
17+
ndb_mgmd=
18+
mysqld=,
19+
ndbapi=,,,,,,,,,,,
20+
21+
[mysqld]
22+
# Make all mysqlds use cluster
23+
#ndbcluster
24+
#ndb-wait-connected=20
25+
#ndb-wait-setup=600
26+
ndb-cluster-connection-pool=2
27+
#ndb-extra-logging=99
28+
29+
#connect_timeout=60
30+
#delayed_insert_timeout =1300
31+
#interactive_timeout =28800
32+
#net_read_timeout =1130
33+
net_write_timeout =1160
34+
#slave_net_timeout =1120
35+
#Table_lock_wait_timeout=1150
36+
#wait_timeout = 28800
37+
38+
[cluster_config.ndbd.3.1]
39+
Nodegroup=65536
40+
41+
[cluster_config.ndbd.4.1]
42+
Nodegroup=65536
43+
44+
[ENV]
45+
NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
46+
MASTER_MYPORT= @mysqld.1.1.port
47+
MASTER_MYPORT1= @mysqld.2.1.port
48+
49+
NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
50+
51+
# Test will pass some table names that includes $ to command line interpreter.
52+
# $ is expanded in bourne shell, but not expanded in Windows command line.
53+
# The environment variable below makes sure that xxx$BLOB is passed as xxx$BLOB
54+
# in either case.
55+
BLOB=$BLOB
56+
unique=$unique

0 commit comments

Comments
 (0)