Debian Codegraph @

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

raw
1 --source include/have_ndb.inc
2 --source include/have_nodebug.inc
3
4 # Test is using error insert, check that binaries support it
5 --source suite/ndb/t/have_ndb_error_insert.inc
6
7 # Use small LoadFactors to force sparse hash table
8 --exec $NDB_MGM -e "all error 3003" >> $NDB_TOOLS_OUTPUT
9
10 set max_heap_table_size = 286720000;
11 create table t1 (a int primary key) engine=memory;
12 load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 columns terminated by ' ' (a, @col2);
13 let $i = 4;
14 let $b = 10000;
15 while ($i)
16 {
17 --eval insert into t1 select a + $b from t1;
18 let $b = $b * 2;
19 dec $i;
20 }
21 select count(*) from t1;
22 alter table t1 engine=ndbcluster comment='NDB_TABLE=NOLOGGING' partition by key() partitions 1;
23 --exec $NDB_MGM -e "all report memory" >> $NDB_TOOLS_OUTPUT
24 create table t2 (a int primary key) engine=memory;
25 insert into t2 select a from t1;
26
27 --echo the left join below should result in scanning t2 and do pk lookups in t1
28 --replace_column 10 # 11 #
29 explain select if(isnull(t1.a),t2.a,NULL) missed, count(*) row_count from t2 left join t1 on t1.a=t2.a group by if(isnull(t1.a),t2.a,NULL);
30 --echo the result rows with missed equal to NULL should count all rows (160000)
31 --echo the other rows are the failed lookups and there should not be any such
32 select if(isnull(t1.a),t2.a,NULL) missed, count(*) row_count from t2 left join t1 on t1.a=t2.a group by if(isnull(t1.a),t2.a,NULL);
33
34 --echo verify that it is not possible to reinsert all rows in t1 to itself
35 --echo affected rows should be zero
36
37 # All the below INSERT IGNORE statements generate 10000 duplicate key
38 # warnings each. By default only the first 64 warnings are saved on the
39 # warning stack (and thus printed to the .result file). Since the order of
40 # the inserts are slightly random the first 64 warnings are also random.
41 # Fix by setting the number of saved warnigns to zero, since the test are
42 # only interested in checking that no records are allowed to be inserted
43 # by looking at "affected_rows"
44 set @save_max_error_count = @@max_error_count;
45 set @@max_error_count = 0;
46
47 --enable_info
48 insert ignore into t1 select a from t2 limit 0, 10000;
49 insert ignore into t1 select a from t2 limit 10000, 10000;
50 insert ignore into t1 select a from t2 limit 20000, 10000;
51 insert ignore into t1 select a from t2 limit 30000, 10000;
52 insert ignore into t1 select a from t2 limit 40000, 10000;
53 insert ignore into t1 select a from t2 limit 50000, 10000;
54 insert ignore into t1 select a from t2 limit 60000, 10000;
55 insert ignore into t1 select a from t2 limit 70000, 10000;
56 insert ignore into t1 select a from t2 limit 80000, 10000;
57 insert ignore into t1 select a from t2 limit 90000, 10000;
58 insert ignore into t1 select a from t2 limit 100000, 10000;
59 insert ignore into t1 select a from t2 limit 110000, 10000;
60 insert ignore into t1 select a from t2 limit 120000, 10000;
61 insert ignore into t1 select a from t2 limit 130000, 10000;
62 insert ignore into t1 select a from t2 limit 140000, 10000;
63 insert ignore into t1 select a from t2 limit 150000, 10000;
64 --disable_info
65
66 set @@max_error_count = @save_max_error_count;
67
68 # Reset error insertion
69 --exec $NDB_MGM -e "all error 0"
70
71 # Verify no data memory leakage on drop table (see bug#86247).
72
73 # Avoid problem with too large transactions.
74 set ndb_use_transactions=0;
75
76 drop table t1;
77
78 create table t1 (a int primary key)
79 engine=ndbcluster
80 comment='NDB_TABLE=NOLOGGING'
81 partition by key() partitions 1;
82 insert into t1 select * from t2;
83 drop table t1;
84
85 # Keep value to check against after several create and drop table.
86 select max(used_pages) into @data_memory_pages
87 from ndbinfo.memoryusage where memory_type = 'Data memory';
88
89 let $lap = 3;
90 while ($lap)
91 {
92 create table t1 (a int primary key)
93 engine=ndbcluster
94 comment='NDB_TABLE=NOLOGGING'
95 partition by key() partitions 1;
96 insert into t1 select * from t2;
97 drop table t1;
98 dec $lap;
99 }
100
101 # Verify page count, allow 15% variation.
102 if (`select max(used_pages) > 1.15 * @data_memory_pages
103 from ndbinfo.memoryusage where memory_type = 'Data memory'`)
104 {
105 select @data_memory_pages 'Initial data memory pages in use';
106 select max(used_pages) 'Final data memory pages in use'
107 from ndbinfo.memoryusage where memory_type = 'Data memory';
108 die "Data memory leakage?";
109 }
110
111 drop table t2;
112 --remove_file $NDB_TOOLS_OUTPUT