Fixed some mtr tests that failed on windows
Most things where wrong in the test suite. The one thing that was a bug was that table_map_id was in some places defined as ulong and in other places as ulonglong. On Linux 64 bit this is not a problem as ulong == ulonglong, but on windows this caused failures. Fixed by ensuring that all instances of table_map_id are ulonglong.
This commit is contained in:
parent
6085fb199a
commit
26c86c39fc
@ -2190,7 +2190,7 @@ static bool innodb_init_param()
|
||||
|
||||
/* Check that values don't overflow on 32-bit systems. */
|
||||
if (sizeof(ulint) == 4) {
|
||||
if (xtrabackup_use_memory > UINT_MAX32) {
|
||||
if (xtrabackup_use_memory > (longlong) UINT_MAX32) {
|
||||
msg("mariabackup: use-memory can't be over 4GB"
|
||||
" on 32-bit systems");
|
||||
}
|
||||
|
@ -3229,7 +3229,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
|
||||
{
|
||||
longlong data= my_strtoll10(value, &endptr, &err);
|
||||
*param->error= (IS_TRUNCATED(data, param->is_unsigned,
|
||||
INT_MIN32, INT_MAX32, UINT_MAX32) || err > 0);
|
||||
(longlong) INT_MIN32, (longlong) INT_MAX32,
|
||||
(longlong) UINT_MAX32) || err > 0);
|
||||
longstore(buffer, (int32) data);
|
||||
break;
|
||||
}
|
||||
@ -3346,7 +3347,8 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
|
||||
break;
|
||||
case MYSQL_TYPE_LONG:
|
||||
*param->error= IS_TRUNCATED(value, param->is_unsigned,
|
||||
INT_MIN32, INT_MAX32, UINT_MAX32);
|
||||
(longlong) INT_MIN32, (longlong) INT_MAX32,
|
||||
(longlong) UINT_MAX32);
|
||||
longstore(buffer, (int32) value);
|
||||
break;
|
||||
case MYSQL_TYPE_LONGLONG:
|
||||
|
@ -1,6 +1,7 @@
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/not_windows.inc
|
||||
|
||||
--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1)
|
||||
--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2)
|
||||
|
@ -21,23 +21,23 @@ master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
master-bin.000001 # Gtid 1 # GTID #-#-#
|
||||
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
|
||||
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
|
||||
master-bin.000001 # Table_map 1 # table_id: 4294967298 (test.t)
|
||||
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
|
||||
master-bin.000001 # Query 1 # COMMIT
|
||||
connection slave;
|
||||
connection master;
|
||||
SET debug_dbug=@old_debug_dbug;
|
||||
|
1465
mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff
Normal file
1465
mysql-test/suite/sys_vars/r/sysvars_server_notembedded,win.rdiff
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ set global low_priority_updates=1;
|
||||
install soname 'sql_errlog';
|
||||
|
||||
vertical_results;
|
||||
replace_regex /\/.*\//var\//;
|
||||
replace_regex /(C:)?\/.*\//var\//;
|
||||
select * from information_schema.system_variables
|
||||
where variable_name in (
|
||||
'completion_type', #session!=global, origin=compile-time
|
||||
@ -32,7 +32,7 @@ create user foo@localhost;
|
||||
connect foo,localhost,foo;
|
||||
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
|
||||
connection default;
|
||||
replace_regex /\/.*\//var\//;
|
||||
replace_regex /(C:)?\/.*\//var\//;
|
||||
select global_value_path from information_schema.system_variables where variable_name='plugin_maturity';
|
||||
disconnect foo;
|
||||
drop user foo@localhost;
|
||||
|
@ -260,7 +260,7 @@ int Parser::parse_line(char **line_ptr, keyentry *key)
|
||||
while (isdigit(*p))
|
||||
{
|
||||
id = id * 10 + *p - '0';
|
||||
if (id > UINT_MAX32)
|
||||
if (id > (longlong) UINT_MAX32)
|
||||
{
|
||||
report_error("Invalid key id", p - *line_ptr);
|
||||
return -1;
|
||||
|
@ -3224,7 +3224,7 @@ String *Item_func_binlog_gtid_pos::val_str(String *str)
|
||||
if (args[0]->null_value || args[1]->null_value)
|
||||
goto err;
|
||||
|
||||
if (pos < 0 || pos > UINT_MAX32)
|
||||
if (pos < 0 || pos > (longlong) UINT_MAX32)
|
||||
goto err;
|
||||
|
||||
if (gtid_state_from_binlog_pos(name->c_ptr_safe(), (uint32)pos, str))
|
||||
|
@ -6129,12 +6129,13 @@ bool THD::binlog_write_table_map(TABLE *table, bool with_annotate)
|
||||
int error= 1;
|
||||
bool is_transactional= table->file->row_logging_has_trans;
|
||||
DBUG_ENTER("THD::binlog_write_table_map");
|
||||
DBUG_PRINT("enter", ("table: %p (%s: #%lu)",
|
||||
DBUG_PRINT("enter", ("table: %p (%s: #%llu)",
|
||||
table, table->s->table_name.str,
|
||||
table->s->table_map_id));
|
||||
|
||||
/* Pre-conditions */
|
||||
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX);
|
||||
DBUG_ASSERT((table->s->table_map_id & MAX_TABLE_MAP_ID) != UINT32_MAX &&
|
||||
(table->s->table_map_id & MAX_TABLE_MAP_ID) != 0);
|
||||
|
||||
/* Ensure that all events in a GTID group are in the same cache */
|
||||
if (variables.option_bits & OPTION_GTID_BEGIN)
|
||||
|
@ -3311,7 +3311,7 @@ Rows_log_event::Rows_log_event(const uchar *buf, uint event_len,
|
||||
}
|
||||
else
|
||||
{
|
||||
m_table_id= (ulong) uint6korr(post_start);
|
||||
m_table_id= (ulonglong) uint6korr(post_start);
|
||||
post_start+= RW_FLAGS_OFFSET;
|
||||
}
|
||||
|
||||
@ -3668,11 +3668,12 @@ Table_map_log_event::Table_map_log_event(const uchar *buf, uint event_len,
|
||||
else
|
||||
{
|
||||
DBUG_ASSERT(post_header_len == TABLE_MAP_HEADER_LEN);
|
||||
m_table_id= (ulong) uint6korr(post_start);
|
||||
m_table_id= (ulonglong) uint6korr(post_start);
|
||||
post_start+= TM_FLAGS_OFFSET;
|
||||
}
|
||||
|
||||
DBUG_ASSERT(m_table_id != ~0ULL);
|
||||
DBUG_ASSERT((m_table_id & MAX_TABLE_MAP_ID) != UINT32_MAX &&
|
||||
(m_table_id & MAX_TABLE_MAP_ID) != 0);
|
||||
|
||||
m_flags= uint2korr(post_start);
|
||||
|
||||
|
@ -158,6 +158,12 @@ class String;
|
||||
|
||||
#define NUM_LOAD_DELIM_STRS 5
|
||||
|
||||
/*
|
||||
The following is the max table_map_id. This is limited by that we
|
||||
are using 6 bytes for it in replication
|
||||
*/
|
||||
#define MAX_TABLE_MAP_ID ((1ULL << (6*8)) -1)
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
MySQL Binary Log
|
||||
@ -4796,7 +4802,8 @@ public:
|
||||
flag_set get_flags(flag_set flag) const { return m_flags & flag; }
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, bool is_transactional);
|
||||
Table_map_log_event(THD *thd, TABLE *tbl, ulonglong tid,
|
||||
bool is_transactional);
|
||||
#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
Table_map_log_event(const uchar *buf, uint event_len,
|
||||
@ -5122,7 +5129,7 @@ protected:
|
||||
this class, not create instances of this class.
|
||||
*/
|
||||
#ifdef MYSQL_SERVER
|
||||
Rows_log_event(THD*, TABLE*, ulong table_id,
|
||||
Rows_log_event(THD*, TABLE*, ulonglong table_id,
|
||||
MY_BITMAP const *cols, bool is_transactional,
|
||||
Log_event_type event_type);
|
||||
#endif
|
||||
@ -5356,7 +5363,7 @@ public:
|
||||
};
|
||||
|
||||
#if defined(MYSQL_SERVER)
|
||||
Write_rows_log_event(THD*, TABLE*, ulong table_id,
|
||||
Write_rows_log_event(THD*, TABLE*, ulonglong table_id,
|
||||
bool is_transactional);
|
||||
#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
@ -5397,7 +5404,7 @@ class Write_rows_compressed_log_event : public Write_rows_log_event
|
||||
{
|
||||
public:
|
||||
#if defined(MYSQL_SERVER)
|
||||
Write_rows_compressed_log_event(THD*, TABLE*, ulong table_id,
|
||||
Write_rows_compressed_log_event(THD*, TABLE*, ulonglong table_id,
|
||||
bool is_transactional);
|
||||
virtual bool write();
|
||||
#endif
|
||||
@ -5433,7 +5440,7 @@ public:
|
||||
};
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
Update_rows_log_event(THD*, TABLE*, ulong table_id,
|
||||
Update_rows_log_event(THD*, TABLE*, ulonglong table_id,
|
||||
bool is_transactional);
|
||||
|
||||
void init(MY_BITMAP const *cols);
|
||||
@ -5485,7 +5492,7 @@ class Update_rows_compressed_log_event : public Update_rows_log_event
|
||||
{
|
||||
public:
|
||||
#if defined(MYSQL_SERVER)
|
||||
Update_rows_compressed_log_event(THD*, TABLE*, ulong table_id,
|
||||
Update_rows_compressed_log_event(THD*, TABLE*, ulonglong table_id,
|
||||
bool is_transactional);
|
||||
virtual bool write();
|
||||
#endif
|
||||
@ -5529,7 +5536,7 @@ public:
|
||||
};
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
Delete_rows_log_event(THD*, TABLE*, ulong, bool is_transactional);
|
||||
Delete_rows_log_event(THD*, TABLE*, ulonglong, bool is_transactional);
|
||||
#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
Delete_rows_log_event(const uchar *buf, uint event_len,
|
||||
@ -5570,7 +5577,8 @@ class Delete_rows_compressed_log_event : public Delete_rows_log_event
|
||||
{
|
||||
public:
|
||||
#if defined(MYSQL_SERVER)
|
||||
Delete_rows_compressed_log_event(THD*, TABLE*, ulong, bool is_transactional);
|
||||
Delete_rows_compressed_log_event(THD*, TABLE*, ulonglong,
|
||||
bool is_transactional);
|
||||
virtual bool write();
|
||||
#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
|
@ -1502,8 +1502,8 @@ bool Rows_log_event::print_verbose(IO_CACHE *file,
|
||||
if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
|
||||
!(td= map->create_table_def()))
|
||||
{
|
||||
return (my_b_printf(file, "### Row event for unknown table #%lu",
|
||||
(ulong) m_table_id));
|
||||
return (my_b_printf(file, "### Row event for unknown table #%llu",
|
||||
(ulonglong) m_table_id));
|
||||
}
|
||||
|
||||
/* If the write rows event contained no values for the AI */
|
||||
|
@ -47,12 +47,12 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi)
|
||||
const Relay_log_info *rli= rgi->rli;
|
||||
|
||||
/*
|
||||
If m_table_id == ~0UL, then we have a dummy event that does not
|
||||
If m_table_id == UINT32_MAX, then we have a dummy event that does not
|
||||
contain any data. In that case, we just remove all tables in the
|
||||
tables_to_lock list, close the thread tables, and return with
|
||||
success.
|
||||
*/
|
||||
if (ev->m_table_id == ~0UL)
|
||||
if (ev->m_table_id == UINT32_MAX)
|
||||
{
|
||||
/*
|
||||
This one is supposed to be set: just an extra check so that
|
||||
@ -1123,13 +1123,14 @@ int Update_rows_log_event_old::do_exec_row(TABLE *table)
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
||||
Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulonglong table_id,
|
||||
MY_BITMAP const *cols,
|
||||
bool is_transactional)
|
||||
: Log_event(thd_arg, 0, is_transactional),
|
||||
m_row_count(0),
|
||||
m_table(tbl_arg),
|
||||
m_table_id(tid),
|
||||
m_table_id(table_id),
|
||||
m_width(tbl_arg ? tbl_arg->s->fields : 1),
|
||||
m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0)
|
||||
#ifdef HAVE_REPLICATION
|
||||
@ -1142,12 +1143,12 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
||||
|
||||
/*
|
||||
We allow a special form of dummy event when the table, and cols
|
||||
are null and the table id is ~0UL. This is a temporary
|
||||
are null and the table id is UINT32_MAX. This is a temporary
|
||||
solution, to be able to terminate a started statement in the
|
||||
binary log: the extraneous events will be removed in the future.
|
||||
*/
|
||||
DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) ||
|
||||
(!tbl_arg && !cols && tid == ~0UL));
|
||||
DBUG_ASSERT((tbl_arg && tbl_arg->s && table_id != UINT32_MAX) ||
|
||||
(!tbl_arg && !cols && table_id == UINT32_MAX));
|
||||
|
||||
if (thd_arg->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)
|
||||
set_flags(NO_FOREIGN_KEY_CHECKS_F);
|
||||
@ -1209,7 +1210,7 @@ Old_rows_log_event::Old_rows_log_event(const uchar *buf, uint event_len,
|
||||
}
|
||||
else
|
||||
{
|
||||
m_table_id= (ulong) uint6korr(post_start);
|
||||
m_table_id= (ulonglong) uint6korr(post_start);
|
||||
post_start+= RW_FLAGS_OFFSET;
|
||||
}
|
||||
|
||||
@ -1364,12 +1365,12 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
Relay_log_info const *rli= rgi->rli;
|
||||
|
||||
/*
|
||||
If m_table_id == ~0UL, then we have a dummy event that does not
|
||||
If m_table_id == UINT32_MAX, then we have a dummy event that does not
|
||||
contain any data. In that case, we just remove all tables in the
|
||||
tables_to_lock list, close the thread tables, and return with
|
||||
success.
|
||||
*/
|
||||
if (m_table_id == ~0UL)
|
||||
if (m_table_id == UINT32_MAX)
|
||||
{
|
||||
/*
|
||||
This one is supposed to be set: just an extra check so that
|
||||
@ -1786,7 +1787,7 @@ bool Old_rows_log_event::write_data_header()
|
||||
// This method should not be reached.
|
||||
assert(0);
|
||||
|
||||
DBUG_ASSERT(m_table_id != ~0UL);
|
||||
DBUG_ASSERT(m_table_id != UINT32_MAX);
|
||||
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
|
||||
{
|
||||
int4store(buf + 0, m_table_id);
|
||||
@ -2400,7 +2401,7 @@ int Old_rows_log_event::find_row(rpl_group_info *rgi)
|
||||
#if !defined(MYSQL_CLIENT)
|
||||
Write_rows_log_event_old::Write_rows_log_event_old(THD *thd_arg,
|
||||
TABLE *tbl_arg,
|
||||
ulong tid_arg,
|
||||
ulonglong tid_arg,
|
||||
MY_BITMAP const *cols,
|
||||
bool is_transactional)
|
||||
: Old_rows_log_event(thd_arg, tbl_arg, tid_arg, cols, is_transactional)
|
||||
@ -2512,7 +2513,7 @@ bool Write_rows_log_event_old::print(FILE *file,
|
||||
#ifndef MYSQL_CLIENT
|
||||
Delete_rows_log_event_old::Delete_rows_log_event_old(THD *thd_arg,
|
||||
TABLE *tbl_arg,
|
||||
ulong tid,
|
||||
ulonglong tid,
|
||||
MY_BITMAP const *cols,
|
||||
bool is_transactional)
|
||||
: Old_rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional),
|
||||
@ -2620,7 +2621,7 @@ bool Delete_rows_log_event_old::print(FILE *file,
|
||||
#if !defined(MYSQL_CLIENT)
|
||||
Update_rows_log_event_old::Update_rows_log_event_old(THD *thd_arg,
|
||||
TABLE *tbl_arg,
|
||||
ulong tid,
|
||||
ulonglong tid,
|
||||
MY_BITMAP const *cols,
|
||||
bool is_transactional)
|
||||
: Old_rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional),
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
|
||||
MY_BITMAP const *get_cols() const { return &m_cols; }
|
||||
size_t get_width() const { return m_width; }
|
||||
ulong get_table_id() const { return m_table_id; }
|
||||
ulonglong get_table_id() const { return m_table_id; }
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
virtual bool write_data_header();
|
||||
@ -158,7 +158,7 @@ protected:
|
||||
this class, not create instances of this class.
|
||||
*/
|
||||
#ifndef MYSQL_CLIENT
|
||||
Old_rows_log_event(THD*, TABLE*, ulong table_id,
|
||||
Old_rows_log_event(THD*, TABLE*, ulonglong table_id,
|
||||
MY_BITMAP const *cols, bool is_transactional);
|
||||
#endif
|
||||
Old_rows_log_event(const uchar *row_data, uint event_len,
|
||||
@ -176,7 +176,7 @@ protected:
|
||||
#ifndef MYSQL_CLIENT
|
||||
TABLE *m_table; /* The table the rows belong to */
|
||||
#endif
|
||||
ulong m_table_id; /* Table ID */
|
||||
ulonglong m_table_id; /* Table ID */
|
||||
MY_BITMAP m_cols; /* Bitmap denoting columns available */
|
||||
ulong m_width; /* The width of the columns bitmap */
|
||||
|
||||
@ -359,7 +359,7 @@ class Write_rows_log_event_old : public Old_rows_log_event
|
||||
/********** BEGIN CUT & PASTE FROM Write_rows_log_event **********/
|
||||
public:
|
||||
#if !defined(MYSQL_CLIENT)
|
||||
Write_rows_log_event_old(THD*, TABLE*, ulong table_id,
|
||||
Write_rows_log_event_old(THD*, TABLE*, ulonglong table_id,
|
||||
MY_BITMAP const *cols, bool is_transactional);
|
||||
#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
@ -430,7 +430,7 @@ class Update_rows_log_event_old : public Old_rows_log_event
|
||||
/********** BEGIN CUT & PASTE FROM Update_rows_log_event **********/
|
||||
public:
|
||||
#ifndef MYSQL_CLIENT
|
||||
Update_rows_log_event_old(THD*, TABLE*, ulong table_id,
|
||||
Update_rows_log_event_old(THD*, TABLE*, ulonglong table_id,
|
||||
MY_BITMAP const *cols,
|
||||
bool is_transactional);
|
||||
#endif
|
||||
@ -507,7 +507,7 @@ class Delete_rows_log_event_old : public Old_rows_log_event
|
||||
/********** BEGIN CUT & PASTE FROM Update_rows_log_event **********/
|
||||
public:
|
||||
#ifndef MYSQL_CLIENT
|
||||
Delete_rows_log_event_old(THD*, TABLE*, ulong,
|
||||
Delete_rows_log_event_old(THD*, TABLE*, ulonglong,
|
||||
MY_BITMAP const *cols, bool is_transactional);
|
||||
#endif
|
||||
#ifdef HAVE_REPLICATION
|
||||
|
@ -5254,13 +5254,14 @@ bool sql_ex_info::write_data(Log_event_writer *writer)
|
||||
Rows_log_event member functions
|
||||
**************************************************************************/
|
||||
|
||||
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
||||
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulonglong table_id,
|
||||
MY_BITMAP const *cols, bool is_transactional,
|
||||
Log_event_type event_type)
|
||||
: Log_event(thd_arg, 0, is_transactional),
|
||||
m_row_count(0),
|
||||
m_table(tbl_arg),
|
||||
m_table_id(tid),
|
||||
m_table_id(table_id),
|
||||
m_width(tbl_arg ? tbl_arg->s->fields : 1),
|
||||
m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0),
|
||||
m_type(event_type), m_extra_row_data(0)
|
||||
@ -5272,12 +5273,13 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
|
||||
{
|
||||
/*
|
||||
We allow a special form of dummy event when the table, and cols
|
||||
are null and the table id is ~0UL. This is a temporary
|
||||
are null and the table id is UINT32_MAX. This is a temporary
|
||||
solution, to be able to terminate a started statement in the
|
||||
binary log: the extraneous events will be removed in the future.
|
||||
*/
|
||||
DBUG_ASSERT((tbl_arg && tbl_arg->s && tid != ~0UL) ||
|
||||
(!tbl_arg && !cols && tid == ~0UL));
|
||||
DBUG_ASSERT((tbl_arg && tbl_arg->s &&
|
||||
(table_id & MAX_TABLE_MAP_ID) != UINT32_MAX) ||
|
||||
(!tbl_arg && !cols && (table_id & MAX_TABLE_MAP_ID) == UINT32_MAX));
|
||||
|
||||
if (thd_arg->variables.option_bits & OPTION_NO_FOREIGN_KEY_CHECKS)
|
||||
set_flags(NO_FOREIGN_KEY_CHECKS_F);
|
||||
@ -5425,12 +5427,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
LEX *lex= thd->lex;
|
||||
uint8 new_trg_event_map= get_trg_event_map();
|
||||
/*
|
||||
If m_table_id == ~0ULL, then we have a dummy event that does not
|
||||
If m_table_id == UINT32_MAX, then we have a dummy event that does not
|
||||
contain any data. In that case, we just remove all tables in the
|
||||
tables_to_lock list, close the thread tables, and return with
|
||||
success.
|
||||
*/
|
||||
if (m_table_id == ~0ULL)
|
||||
if (m_table_id == UINT32_MAX)
|
||||
{
|
||||
/*
|
||||
This one is supposed to be set: just an extra check so that
|
||||
@ -6069,7 +6071,7 @@ Rows_log_event::do_update_pos(rpl_group_info *rgi)
|
||||
bool Rows_log_event::write_data_header()
|
||||
{
|
||||
uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer
|
||||
DBUG_ASSERT(m_table_id != ~0ULL);
|
||||
DBUG_ASSERT(m_table_id != UINT32_MAX);
|
||||
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
|
||||
{
|
||||
int4store(buf + 0, m_table_id);
|
||||
@ -6277,7 +6279,7 @@ int Table_map_log_event::save_field_metadata()
|
||||
Mats says tbl->s lives longer than this event so it's ok to copy pointers
|
||||
(tbl->s->db etc) and not pointer content.
|
||||
*/
|
||||
Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
|
||||
Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulonglong tid,
|
||||
bool is_transactional)
|
||||
: Log_event(thd, 0, is_transactional),
|
||||
m_table(tbl),
|
||||
@ -6300,7 +6302,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
|
||||
uchar cbuf[MAX_INT_WIDTH];
|
||||
uchar *cbuf_end;
|
||||
DBUG_ENTER("Table_map_log_event::Table_map_log_event(TABLE)");
|
||||
DBUG_ASSERT(m_table_id != ~0ULL);
|
||||
DBUG_ASSERT(m_table_id != UINT32_MAX);
|
||||
/*
|
||||
In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
|
||||
table.cc / alloc_table_share():
|
||||
@ -6627,7 +6629,7 @@ int Table_map_log_event::do_update_pos(rpl_group_info *rgi)
|
||||
|
||||
bool Table_map_log_event::write_data_header()
|
||||
{
|
||||
DBUG_ASSERT(m_table_id != ~0ULL);
|
||||
DBUG_ASSERT(m_table_id != UINT32_MAX);
|
||||
uchar buf[TABLE_MAP_HEADER_LEN];
|
||||
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
|
||||
{
|
||||
@ -7082,7 +7084,7 @@ void Table_map_log_event::pack_info(Protocol *protocol)
|
||||
Constructor used to build an event for writing to the binary log.
|
||||
*/
|
||||
Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulong tid_arg,
|
||||
ulonglong tid_arg,
|
||||
bool is_transactional)
|
||||
:Rows_log_event(thd_arg, tbl_arg, tid_arg, tbl_arg->rpl_write_set,
|
||||
is_transactional, WRITE_ROWS_EVENT_V1)
|
||||
@ -7092,7 +7094,7 @@ Write_rows_log_event::Write_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
Write_rows_compressed_log_event::Write_rows_compressed_log_event(
|
||||
THD *thd_arg,
|
||||
TABLE *tbl_arg,
|
||||
ulong tid_arg,
|
||||
ulonglong tid_arg,
|
||||
bool is_transactional)
|
||||
: Write_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional)
|
||||
{
|
||||
@ -8216,7 +8218,8 @@ end:
|
||||
*/
|
||||
|
||||
Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulong tid, bool is_transactional)
|
||||
ulonglong tid,
|
||||
bool is_transactional)
|
||||
: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
|
||||
DELETE_ROWS_EVENT_V1)
|
||||
{
|
||||
@ -8224,7 +8227,7 @@ Delete_rows_log_event::Delete_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
|
||||
Delete_rows_compressed_log_event::Delete_rows_compressed_log_event(
|
||||
THD *thd_arg, TABLE *tbl_arg,
|
||||
ulong tid_arg,
|
||||
ulonglong tid_arg,
|
||||
bool is_transactional)
|
||||
: Delete_rows_log_event(thd_arg, tbl_arg, tid_arg, is_transactional)
|
||||
{
|
||||
@ -8365,7 +8368,7 @@ uint8 Delete_rows_log_event::get_trg_event_map()
|
||||
Constructor used to build an event for writing to the binary log.
|
||||
*/
|
||||
Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulong tid,
|
||||
ulonglong tid,
|
||||
bool is_transactional)
|
||||
: Rows_log_event(thd_arg, tbl_arg, tid, tbl_arg->read_set, is_transactional,
|
||||
UPDATE_ROWS_EVENT_V1)
|
||||
@ -8373,9 +8376,9 @@ Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
init(tbl_arg->rpl_write_set);
|
||||
}
|
||||
|
||||
Update_rows_compressed_log_event::Update_rows_compressed_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulong tid,
|
||||
bool is_transactional)
|
||||
Update_rows_compressed_log_event::
|
||||
Update_rows_compressed_log_event(THD *thd_arg, TABLE *tbl_arg,
|
||||
ulonglong tid, bool is_transactional)
|
||||
: Update_rows_log_event(thd_arg, tbl_arg, tid, is_transactional)
|
||||
{
|
||||
m_type = UPDATE_ROWS_COMPRESSED_EVENT_V1;
|
||||
|
@ -953,7 +953,8 @@ void field_longlong::get_opt_type(String *answer,
|
||||
UINT_MAX24 : INT_MAX24))
|
||||
snprintf(buff, sizeof(buff), "MEDIUMINT(%d)", (int) max_length);
|
||||
else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ?
|
||||
UINT_MAX32 : INT_MAX32))
|
||||
(longlong) UINT_MAX32 :
|
||||
(longlong) INT_MAX32))
|
||||
snprintf(buff, sizeof(buff), "INT(%d)", (int) max_length);
|
||||
else
|
||||
snprintf(buff, sizeof(buff), "BIGINT(%d)", (int) max_length);
|
||||
|
@ -7005,7 +7005,8 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
|
||||
{
|
||||
DBUG_ENTER("binlog_prepare_pending_rows_event");
|
||||
/* Pre-conditions */
|
||||
DBUG_ASSERT(table->s->table_map_id != ~0UL);
|
||||
DBUG_ASSERT((table->s->table_map_id & MAX_TABLE_MAP_ID) != UINT32_MAX &&
|
||||
(table->s->table_map_id & MAX_TABLE_MAP_ID) != 0);
|
||||
|
||||
/* Fetch the type code for the RowsEventT template parameter */
|
||||
int const general_type_code= RowsEventT::TYPE_CODE;
|
||||
|
18
sql/table.cc
18
sql/table.cc
@ -48,6 +48,7 @@
|
||||
#ifdef WITH_WSREP
|
||||
#include "wsrep_schema.h"
|
||||
#endif
|
||||
#include "log_event.h" // MAX_TABLE_MAP_ID
|
||||
|
||||
/* For MySQL 5.7 virtual fields */
|
||||
#define MYSQL57_GENERATED_FIELD 128
|
||||
@ -107,7 +108,7 @@ LEX_CSTRING MYSQL_PROC_NAME= {STRING_WITH_LEN("proc")};
|
||||
*/
|
||||
static LEX_CSTRING parse_vcol_keyword= { STRING_WITH_LEN("PARSE_VCOL_EXPR ") };
|
||||
|
||||
static std::atomic<ulong> last_table_id;
|
||||
static std::atomic<ulonglong> last_table_id;
|
||||
|
||||
/* Functions defined in this file */
|
||||
|
||||
@ -383,17 +384,20 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
|
||||
|
||||
DBUG_EXECUTE_IF("simulate_big_table_id",
|
||||
if (last_table_id < UINT_MAX32)
|
||||
last_table_id= UINT_MAX32 - 1;);
|
||||
last_table_id= UINT_MAX32-1;);
|
||||
/*
|
||||
There is one reserved number that cannot be used. Remember to
|
||||
change this when 6-byte global table id's are introduced.
|
||||
Replication is using 6 bytes as table_map_id. Ensure that
|
||||
the 6 lowest bytes are not 0.
|
||||
We also have to ensure that we do not use the special value
|
||||
UINT_MAX32 as this is used to mark a dummy event row event. See
|
||||
comments in Rows_log_event::Rows_log_event().
|
||||
*/
|
||||
do
|
||||
{
|
||||
share->table_map_id=
|
||||
last_table_id.fetch_add(1, std::memory_order_relaxed);
|
||||
} while (unlikely(share->table_map_id == ~0UL ||
|
||||
share->table_map_id == 0));
|
||||
} while (unlikely((share->table_map_id & MAX_TABLE_MAP_ID) == 0) ||
|
||||
unlikely((share->table_map_id & MAX_TABLE_MAP_ID) == UINT_MAX32));
|
||||
}
|
||||
DBUG_RETURN(share);
|
||||
}
|
||||
@ -456,7 +460,7 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
|
||||
table_map_id is also used for MERGE tables to suppress repeated
|
||||
compatibility checks.
|
||||
*/
|
||||
share->table_map_id= (ulong) thd->query_id;
|
||||
share->table_map_id= (ulonglong) thd->query_id;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
10
sql/table.h
10
sql/table.h
@ -851,7 +851,7 @@ struct TABLE_SHARE
|
||||
/* 1 if frm version cannot be updated as part of upgrade */
|
||||
bool keep_original_mysql_version;
|
||||
|
||||
ulong table_map_id; /* for row-based replication */
|
||||
ulonglong table_map_id; /* for row-based replication */
|
||||
|
||||
/*
|
||||
Things that are incompatible between the stored version and the
|
||||
@ -1006,7 +1006,7 @@ struct TABLE_SHARE
|
||||
return (table_category == TABLE_CATEGORY_LOG);
|
||||
}
|
||||
|
||||
inline ulong get_table_def_version()
|
||||
inline ulonglong get_table_def_version()
|
||||
{
|
||||
return table_map_id;
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ struct TABLE_SHARE
|
||||
|
||||
@sa TABLE_LIST::is_the_same_definition()
|
||||
*/
|
||||
ulong get_table_ref_version() const
|
||||
ulonglong get_table_ref_version() const
|
||||
{
|
||||
return (tmp_table == SYSTEM_TMP_TABLE) ? 0 : table_map_id;
|
||||
}
|
||||
@ -2774,7 +2774,7 @@ struct TABLE_LIST
|
||||
{ set_table_ref_id(s->get_table_ref_type(), s->get_table_ref_version()); }
|
||||
|
||||
inline void set_table_ref_id(enum_table_ref_type table_ref_type_arg,
|
||||
ulong table_ref_version_arg)
|
||||
ulonglong table_ref_version_arg)
|
||||
{
|
||||
m_table_ref_type= table_ref_type_arg;
|
||||
m_table_ref_version= table_ref_version_arg;
|
||||
@ -2929,7 +2929,7 @@ private:
|
||||
/** See comments for set_table_ref_id() */
|
||||
enum enum_table_ref_type m_table_ref_type;
|
||||
/** See comments for set_table_ref_id() */
|
||||
ulong m_table_ref_version;
|
||||
ulonglong m_table_ref_version;
|
||||
};
|
||||
|
||||
class Item;
|
||||
|
@ -34,7 +34,7 @@ class Mrg_child_def: public Sql_alloc
|
||||
{
|
||||
/* Remembered MERGE child def version. See top comment in ha_myisammrg.cc */
|
||||
enum_table_ref_type m_child_table_ref_type;
|
||||
ulong m_child_def_version;
|
||||
ulonglong m_child_def_version;
|
||||
public:
|
||||
LEX_STRING db;
|
||||
LEX_STRING name;
|
||||
@ -44,12 +44,12 @@ public:
|
||||
{
|
||||
return m_child_table_ref_type;
|
||||
}
|
||||
inline ulong get_child_def_version()
|
||||
inline ulonglong get_child_def_version()
|
||||
{
|
||||
return m_child_def_version;
|
||||
}
|
||||
inline void set_child_def_version(enum_table_ref_type child_table_ref_type,
|
||||
ulong version)
|
||||
ulonglong version)
|
||||
{
|
||||
m_child_table_ref_type= child_table_ref_type;
|
||||
m_child_def_version= version;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
# This test tests spider init after startup under global ORACLE mode
|
||||
install soname 'ha_spider';
|
||||
--replace_regex /\.dll/.so/
|
||||
select * from mysql.plugin;
|
||||
create table t (c int) Engine=SPIDER;
|
||||
drop table t;
|
||||
|
@ -3,6 +3,7 @@ DROP FUNCTION spider_copy_tables;
|
||||
DROP FUNCTION spider_ping_table;
|
||||
DROP FUNCTION spider_bg_direct_sql;
|
||||
DROP FUNCTION spider_direct_sql;
|
||||
--replace_regex /\.dll/.so/
|
||||
UNINSTALL SONAME IF EXISTS 'ha_spider';
|
||||
DROP TABLE IF EXISTS mysql.spider_xa;
|
||||
DROP TABLE IF EXISTS mysql.spider_xa_member;
|
||||
|
Loading…
x
Reference in New Issue
Block a user