Skip to content

Commit b223546

Browse files
committed
merge 10.0 -> 10.1 to resolve MDEV-17803 conflicts.
1 parent c2a4bfa commit b223546

File tree

5 files changed

+129
-2
lines changed

5 files changed

+129
-2
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--- r/rpl_row_big_table_id.result 2019-01-23 19:58:07.204914873 +0200
2+
+++ r/rpl_row_big_table_id_32bit.result 2019-01-23 19:43:54.590640934 +0200
3+
@@ -19,20 +19,20 @@
4+
master-bin.000002 # Gtid 1 # GTID #-#-#
5+
master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
6+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
7+
-master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t)
8+
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
9+
+master-bin.000002 # Table_map 1 # table_id: 1 (test.t)
10+
+master-bin.000002 # Write_rows_v1 1 # table_id: 1 flags: STMT_END_F
11+
master-bin.000002 # Query 1 # COMMIT
12+
master-bin.000002 # Gtid 1 # GTID #-#-#
13+
master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
14+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
15+
-master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t)
16+
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
17+
+master-bin.000002 # Table_map 1 # table_id: 2 (test.t)
18+
+master-bin.000002 # Write_rows_v1 1 # table_id: 2 flags: STMT_END_F
19+
master-bin.000002 # Query 1 # COMMIT
20+
master-bin.000002 # Gtid 1 # GTID #-#-#
21+
master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
22+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
23+
-master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t)
24+
-master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
25+
+master-bin.000002 # Table_map 1 # table_id: 3 (test.t)
26+
+master-bin.000002 # Write_rows_v1 1 # table_id: 3 flags: STMT_END_F
27+
master-bin.000002 # Query 1 # COMMIT
28+
DROP TABLE t;
29+
include/rpl_end.inc
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
include/master-slave.inc
2+
[connection master]
3+
include/rpl_restart_server.inc [server_number=1]
4+
SET @@debug_dbug="d,simulate_big_table_id";
5+
CREATE TABLE t (a int);
6+
INSERT INTO t SET a= 0;
7+
ALTER TABLE t comment '';
8+
INSERT INTO t SET a= 1;
9+
ALTER TABLE t comment '';
10+
INSERT INTO t SET a= 2;
11+
ALTER TABLE t comment '';
12+
INSERT INTO t SET a= 3;
13+
show binlog events in <file> from <pos>;
14+
Log_name Pos Event_type Server_id End_log_pos Info
15+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
16+
master-bin.000002 # Table_map 1 # table_id: 4294967294 (test.t)
17+
master-bin.000002 # Write_rows_v1 1 # table_id: 4294967294 flags: STMT_END_F
18+
master-bin.000002 # Query 1 # COMMIT
19+
master-bin.000002 # Gtid 1 # GTID #-#-#
20+
master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
21+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
22+
master-bin.000002 # Table_map 1 # table_id: 4294967295 (test.t)
23+
master-bin.000002 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
24+
master-bin.000002 # Query 1 # COMMIT
25+
master-bin.000002 # Gtid 1 # GTID #-#-#
26+
master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
27+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
28+
master-bin.000002 # Table_map 1 # table_id: 4294967296 (test.t)
29+
master-bin.000002 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
30+
master-bin.000002 # Query 1 # COMMIT
31+
master-bin.000002 # Gtid 1 # GTID #-#-#
32+
master-bin.000002 # Query 1 # use `test`; ALTER TABLE t comment ''
33+
master-bin.000002 # Gtid 1 # BEGIN GTID #-#-#
34+
master-bin.000002 # Table_map 1 # table_id: 4294967297 (test.t)
35+
master-bin.000002 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
36+
master-bin.000002 # Query 1 # COMMIT
37+
DROP TABLE t;
38+
include/rpl_end.inc
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
##################################################################
2+
# rpl_row_big_table_id
3+
#
4+
# MDEV-17803 Row-based event is not applied when
5+
# table map id is greater 32 bit int
6+
#
7+
# Verify row-based events applying when table map id value is about and greater
8+
# than 1 << 32.
9+
##################################################################
10+
--source include/word_size.inc
11+
--source include/have_debug.inc
12+
--source include/have_binlog_format_row.inc
13+
--source include/master-slave.inc
14+
15+
--connection master
16+
# To reset last table id
17+
--let $rpl_server_number= 1
18+
--source include/rpl_restart_server.inc
19+
20+
SET @@debug_dbug="d,simulate_big_table_id";
21+
CREATE TABLE t (a int);
22+
23+
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
24+
--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
25+
INSERT INTO t SET a= 0;
26+
ALTER TABLE t comment '';
27+
INSERT INTO t SET a= 1;
28+
ALTER TABLE t comment '';
29+
INSERT INTO t SET a= 2;
30+
ALTER TABLE t comment '';
31+
INSERT INTO t SET a= 3;
32+
33+
# display simulated big table_id
34+
--let $_in_from=in '$binlog_file' from $binlog_pos
35+
--replace_result "$_in_from" "in <file> from <pos>"
36+
--replace_column 2 # 5 #
37+
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /file_id=[0-9]+/file_id=#/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
38+
--eval show binlog events in '$binlog_file' from $binlog_pos
39+
40+
41+
--sync_slave_with_master
42+
43+
if (`SELECT sum(a) != 6 FROM t`)
44+
{
45+
--echo *** unexpected result; check slave applier ***
46+
--die
47+
}
48+
49+
50+
# Cleanup
51+
52+
--connection master
53+
DROP TABLE t;
54+
55+
--sync_slave_with_master
56+
57+
--source include/rpl_end.inc

sql/table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,7 @@ struct TABLE_LIST
18871887
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
18881888
List<Index_hint> *index_hints;
18891889
TABLE *table; /* opened table */
1890-
uint table_id; /* table id (from binlog) for opened table */
1890+
ulonglong table_id; /* table id (from binlog) for opened table */
18911891
/*
18921892
select_result for derived table to pass it from table creation to table
18931893
filling procedure

sql/table_cache.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,14 +1134,17 @@ void tdc_assign_new_table_id(TABLE_SHARE *share)
11341134
DBUG_ASSERT(share);
11351135
DBUG_ASSERT(tdc_inited);
11361136

1137+
DBUG_EXECUTE_IF("simulate_big_table_id",
1138+
if (last_table_id < UINT_MAX32)
1139+
last_table_id= UINT_MAX32 - 1;);
11371140
/*
11381141
There is one reserved number that cannot be used. Remember to
11391142
change this when 6-byte global table id's are introduced.
11401143
*/
11411144
do
11421145
{
11431146
tid= my_atomic_add64_explicit(&last_table_id, 1, MY_MEMORY_ORDER_RELAXED);
1144-
} while (unlikely(tid == ~0UL));
1147+
} while (unlikely(tid == ~0UL || tid == 0));
11451148

11461149
share->table_map_id= tid;
11471150
DBUG_PRINT("info", ("table_id= %lu", share->table_map_id));

0 commit comments

Comments
 (0)