File: binlog_insert_delayed.test

package info (click to toggle)
mariadb-10.1 10.1.45-0%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 476,916 kB
  • sloc: cpp: 1,124,656; ansic: 871,843; perl: 52,917; sh: 40,078; pascal: 35,370; javascript: 15,555; yacc: 14,728; ruby: 8,684; xml: 5,377; sql: 3,490; makefile: 2,934; python: 1,970; java: 1,691; asm: 837; lex: 757; php: 22; sed: 16
file content (71 lines) | stat: -rw-r--r-- 2,447 bytes parent folder | download | duplicates (11)
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
# ==== Purpose ====
#
# Verify that INSERT DELAYED in mixed or row mode writes events to the
# binlog, and that AUTO_INCREMENT works correctly.
#
# ==== Method ====
#
# Insert both single and multiple rows into an autoincrement column,
# both with specified value and with NULL.
#
# With INSERT DELAYED, the rows do not show up in the table
# immediately, so we must do source include/wait_until_rows_count.inc
# between any two INSERT DELAYED statements.  Moreover, if mixed or
# row-based logging is used, there is also a delay between when rows
# show up in the table and when they show up in the binlog.  To ensure
# that the rows show up in the binlog, we call FLUSH TABLES, which
# waits until the delayed_insert thread has finished.
#
# We cannot read the binlog after executing INSERT DELAYED statements
# that insert multiple rows, because that is nondeterministic. More
# precisely, rows may be written in batches to the binlog, where each
# batch has one Table_map_log_event and one or more
# Write_rows_log_event. The number of rows included in each batch is
# nondeterministic.
#
# ==== Related bugs ====
#
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild

reset master;

create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;

let $table=t1;
let $count=0;

insert /* before delayed */ delayed /* after delayed */ into t1 values (207);
inc $count;
--source include/wait_until_rows_count.inc

insert /*! delayed */ into t1 values (null);
inc $count;
--source include/wait_until_rows_count.inc

insert delayed into t1 values (300);
inc $count;
--source include/wait_until_rows_count.inc

# It is not enough to wait until all rows have been inserted into the
# table. FLUSH TABLES ensures that they are in the binlog too.  See
# comment above.
FLUSH TABLES;
source include/show_binlog_events.inc;

RESET MASTER;
insert /* before delayed */ delayed /* after delayed */ into t1 values (null),(null),(null),(null);
inc $count; inc $count; inc $count; inc $count;
--source include/wait_until_rows_count.inc

insert  /*! delayed */ into t1 values (null),(null),(400),(null);
inc $count; inc $count; inc $count; inc $count;
--source include/wait_until_rows_count.inc

if (`SELECT @@SESSION.BINLOG_FORMAT = 'STATEMENT'`) {
  FLUSH TABLES;
  source include/show_binlog_events.inc;
}

select * from t1;
drop table t1;