summaryrefslogtreecommitdiff
path: root/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test
blob: 99e28f3b55ede051e3085ff9290afcb274a59be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--source include/have_rocksdb.inc
--source include/have_debug.inc
--source include/have_log_bin.inc
--source include/not_valgrind.inc

--let $restart_noprint=2

--echo #
--echo # Testing upgrading from server without merges for auto_increment
--echo # to new server with such support.
--echo #

set debug_dbug='+d,myrocks_autoinc_upgrade';
create table t (i int primary key auto_increment);
insert into t values ();
insert into t values ();
insert into t values ();
select * from t;

delete from t where i > 1;
select * from t;

select table_name, index_name, auto_increment
  from information_schema.rocksdb_ddl where table_name = 't';

set debug_dbug='-d,myrocks_autoinc_upgrade';

--source include/restart_mysqld.inc

insert into t values ();
insert into t values ();
insert into t values ();
select * from t;

select table_name, index_name, auto_increment
  from information_schema.rocksdb_ddl where table_name = 't';

delete from t where i > 1;

--source include/restart_mysqld.inc

insert into t values ();
insert into t values ();
insert into t values ();
select * from t;

drop table t;

--echo #
--echo # Testing crash safety of transactions.
--echo #
create table t (i int primary key auto_increment);
insert into t values ();
insert into t values ();
insert into t values ();

--echo # Before anything
begin;
insert into t values ();
insert into t values ();
set debug_dbug="+d,crash_commit_before";
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
commit;
--source include/wait_until_disconnected.inc
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
select max(i) into @row_max from t;
select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't';

--echo # After engine prepare
begin;
insert into t values ();
insert into t values ();
set debug_dbug="+d,crash_commit_after_prepare";
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
commit;
--source include/wait_until_disconnected.inc
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
select max(i) into @row_max from t;
select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't';

--echo # After binlog
begin;
insert into t values ();
insert into t values ();
set debug_dbug="+d,crash_commit_after_log";
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
commit;
--source include/wait_until_disconnected.inc
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
select max(i) into @row_max from t;
select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't';

--echo # After everything
begin;
insert into t values ();
insert into t values ();
set debug_dbug="+d,crash_commit_after";
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
commit;
--source include/wait_until_disconnected.inc
--enable_reconnect
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
--disable_reconnect
select max(i) into @row_max from t;
select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't';

drop table t;