File: drop_table.test

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (131 lines) | stat: -rw-r--r-- 3,662 bytes parent folder | download | duplicates (2)
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
122
123
124
125
126
127
128
129
130
131
--source include/long_test.inc
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_csv.inc
--source include/have_log_bin.inc
--source include/not_valgrind.inc

#
# Testing of atomic drop with crashes in a lot of different places
#

call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
# Speed up wait_until_connected_again.inc
let NO_WSREP=1;
RESET MASTER;
let $MYSQLD_DATADIR= `SELECT @@datadir`;

let $engine_count=5;
let $engines='myisam','aria','aria_notrans','innodb','csv';

let $crash_count=8;
let $crash_points='ddl_log_drop_before_delete_hlindex', 'ddl_log_drop_before_delete_table', 'ddl_log_drop_after_delete_table', 'ddl_log_drop_before_drop_trigger', 'ddl_log_drop_before_drop_trigger2', 'ddl_log_drop_after_drop_trigger', 'ddl_log_drop_before_binlog', 'ddl_log_drop_after_binlog';

# Number of drops in the tested statement
let $drops=2;

let $old_debug=`select @@debug_dbug`;

let $e=0;
let $keep_include_silent=1;
let $grep_script=DROP TABLE;
--disable_query_log

while ($e < $engine_count)
{
  inc $e;
  let $engine=`select ELT($e, $engines)`;
  let $default_engine=$engine;
  let $extra_option=;
  let $vector=, v vector(5) not null default x'e360d63ebe554f3fcdbc523f4522193f5236083d', vector index(v);

  if ($engine == "aria")
  {
    let $extra_option=transactional=1;
  }
  if ($engine == "aria_notrans")
  {
    let $default_engine="aria";
    let $extra_option=transactional=0;
  }
  if ($engine == "csv")
  {
    let $vector=;
  }

  let $c=0;
  while ($c < $crash_count)
  {
    inc $c;
    let $crash=`select ELT($c, $crash_points)`;
    let $r=0;
    while ($r < $drops)
    {
      inc $r;
       --eval set @@default_storage_engine=$default_engine
       --eval create table t1 (a int not null) $extra_option;
       --eval create table t2 (b int not null $vector) $extra_option;
      insert into t1 values(1);
      insert into t2 (b) values(2);
      flush tables;

      delimiter |;
      create trigger t1_trg before insert on t1 for each row
      begin
        if isnull(new.a) then
          set new.a:= 1000;
        end if;
      end|
      create trigger t2_trg before insert on t2 for each row
      begin
        if isnull(new.b) then
          set new.b:= 2000;
        end if;
      end|
      delimiter ;|

      FLUSH BINARY LOGS;
      --let $start_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)

      echo "engine: $engine  crash point: $crash  position: $r";
      --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
      --disable_reconnect
      --eval set @@debug_dbug="+d,$crash",@debug_crash_counter=$r
      let $errno=0;
      --error 0,2013
      drop table t1,t2;
      let $error=$errno;
      --enable_reconnect
      --source include/wait_until_connected_again.inc
      --disable_query_log
      --eval set @@debug_dbug="$old_debug"

      if ($error == 0)
      {
        echo "No crash!";
      }
      # Check which tables still exists
      --list_files $MYSQLD_DATADIR/test t*

      --let $binlog_file=$start_binlog_file
      --let $binlog_output_name=master-bin.000001
      --source include/show_binlog_events.inc
      if ($error)
      {
        --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
        --let $binlog_output_name=master-bin.000002
        if ($binlog_file != $start_binlog_file)
        {
          --source include/show_binlog_events.inc
        }
      }
      # Really drop the tables. The warnings will show what was dropped
      --disable_warnings
      drop table if exists t1,t2;
      --enable_warnings
    }
  }
}
drop table if exists t1,t2;

--enable_query_log