Commit 90215eb3 authored by mats@mysql.com's avatar mats@mysql.com

WL#3023 (Use locks in statement-like manner):

  Post-merge patches.
parent 9dace135
...@@ -37,6 +37,7 @@ rpl_ndb_log : result not deterministic ...@@ -37,6 +37,7 @@ rpl_ndb_log : result not deterministic
rpl_ndb_relay_space : Bug#16993 rpl_ndb_relay_space : Bug#16993
rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_sp007 : Bug #17290 rpl_ndb_sp007 : Bug #17290
rpl_row_inexist_tbl : Disabled since patch makes this test wait forever
rpl_sp : Bug#16456 rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886 rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future sp-goto : GOTO is currently is disabled - will be fixed in the future
......
...@@ -5073,12 +5073,12 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, ...@@ -5073,12 +5073,12 @@ 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 We allow a special form of dummy event when the table, and cols
are null and the table id is ULONG_MAX. This is a temporary are null and the table id is ~0UL. This is a temporary
solution, to be able to terminate a started statement in the solution, to be able to terminate a started statement in the
binary log: the extreneous events will be removed in the future. binary log: the extreneous events will be removed in the future.
*/ */
DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ULONG_MAX || DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ~0UL ||
!tbl_arg && !cols && tid == ULONG_MAX); !tbl_arg && !cols && tid == ~0UL);
if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS) if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS)
set_flags(NO_FOREIGN_KEY_CHECKS_F); set_flags(NO_FOREIGN_KEY_CHECKS_F);
...@@ -5268,12 +5268,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) ...@@ -5268,12 +5268,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
char const *row_start= (char const *)m_rows_buf; char const *row_start= (char const *)m_rows_buf;
/* /*
If m_table_id == ULONG_MAX, then we have a dummy event that does If m_table_id == ~0UL, then we have a dummy event that does
not contain any data. In that case, we just remove all tables in not contain any data. In that case, we just remove all tables in
the tables_to_lock list, close the thread tables, step the relay the tables_to_lock list, close the thread tables, step the relay
log position, and return with success. log position, and return with success.
*/ */
if (m_table_id == ULONG_MAX) if (m_table_id == ~0UL)
{ {
/* /*
This one is supposed to be set: just an extra check so that This one is supposed to be set: just an extra check so that
...@@ -5417,16 +5417,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) ...@@ -5417,16 +5417,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli)
DBUG_ASSERT(row_end != NULL); // cannot happen DBUG_ASSERT(row_end != NULL); // cannot happen
DBUG_ASSERT(row_end <= (const char*)m_rows_end); DBUG_ASSERT(row_end <= (const char*)m_rows_end);
#if 0
/* in_use can have been set to NULL in close_tables_for_reopen */ /* in_use can have been set to NULL in close_tables_for_reopen */
THD* old_thd= table->in_use; THD* old_thd= table->in_use;
if (!table->in_use) if (!table->in_use)
table->in_use= thd; table->in_use= thd;
#endif
error= do_exec_row(table); error= do_exec_row(table);
#if 0
table->in_use = old_thd; table->in_use = old_thd;
#endif
switch (error) switch (error)
{ {
/* Some recoverable errors */ /* Some recoverable errors */
...@@ -5640,7 +5636,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, ...@@ -5640,7 +5636,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
m_table_id(tid), m_table_id(tid),
m_flags(flags) m_flags(flags)
{ {
DBUG_ASSERT(m_table_id != ULONG_MAX); DBUG_ASSERT(m_table_id != ~0UL);
/* /*
In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
table.cc / alloc_table_share(): table.cc / alloc_table_share():
...@@ -5708,7 +5704,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, ...@@ -5708,7 +5704,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
post_start+= TM_FLAGS_OFFSET; post_start+= TM_FLAGS_OFFSET;
} }
DBUG_ASSERT(m_table_id != ULONG_MAX); DBUG_ASSERT(m_table_id != ~0UL);
m_flags= uint2korr(post_start); m_flags= uint2korr(post_start);
...@@ -5985,7 +5981,7 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) ...@@ -5985,7 +5981,7 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli)
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
bool Table_map_log_event::write_data_header(IO_CACHE *file) bool Table_map_log_event::write_data_header(IO_CACHE *file)
{ {
DBUG_ASSERT(m_table_id != ULONG_MAX); DBUG_ASSERT(m_table_id != ~0UL);
byte buf[TABLE_MAP_HEADER_LEN]; byte buf[TABLE_MAP_HEADER_LEN];
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
{ {
...@@ -6395,7 +6391,9 @@ static int find_and_fetch_row(TABLE *table, byte *key) ...@@ -6395,7 +6391,9 @@ static int find_and_fetch_row(TABLE *table, byte *key)
just set the necessary bits on the bytes and don't set the just set the necessary bits on the bytes and don't set the
filler bits correctly. filler bits correctly.
*/ */
table->record[1][table->s->null_bytes - 1]= 0xFF; my_ptrdiff_t const pos=
table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
table->record[1][pos]= 0xFF;
if ((error= table->file->index_read_idx(table->record[1], 0, key, if ((error= table->file->index_read_idx(table->record[1], 0, key,
table->key_info->key_length, table->key_info->key_length,
HA_READ_KEY_EXACT))) HA_READ_KEY_EXACT)))
...@@ -6430,7 +6428,9 @@ static int find_and_fetch_row(TABLE *table, byte *key) ...@@ -6430,7 +6428,9 @@ static int find_and_fetch_row(TABLE *table, byte *key)
just set the necessary bits on the bytes and don't set the just set the necessary bits on the bytes and don't set the
filler bits correctly. filler bits correctly.
*/ */
table->record[1][table->s->null_bytes - 1]= 0xFF; my_ptrdiff_t const pos=
table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
table->record[1][pos]= 0xFF;
if ((error= table->file->index_next(table->record[1]))) if ((error= table->file->index_next(table->record[1])))
{ {
table->file->print_error(error, MYF(0)); table->file->print_error(error, MYF(0));
...@@ -6451,7 +6451,9 @@ static int find_and_fetch_row(TABLE *table, byte *key) ...@@ -6451,7 +6451,9 @@ static int find_and_fetch_row(TABLE *table, byte *key)
just set the necessary bits on the bytes and don't set the just set the necessary bits on the bytes and don't set the
filler bits correctly. filler bits correctly.
*/ */
table->record[1][table->s->null_bytes - 1]= 0xFF; my_ptrdiff_t const pos=
table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0;
table->record[1][pos]= 0xFF;
error= table->file->rnd_next(table->record[1]); error= table->file->rnd_next(table->record[1]);
switch (error) switch (error)
{ {
......
...@@ -2431,11 +2431,11 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name) ...@@ -2431,11 +2431,11 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
reused is on wrap-around, which means more than 4 billion table reused is on wrap-around, which means more than 4 billion table
shares open at the same time). shares open at the same time).
share->table_map_id is not ULONG_MAX. share->table_map_id is not ~0UL.
*/ */
void assign_new_table_id(TABLE_SHARE *share) void assign_new_table_id(TABLE_SHARE *share)
{ {
static ulong last_table_id= ULONG_MAX; static ulong last_table_id= ~0UL;
DBUG_ENTER("assign_new_table_id"); DBUG_ENTER("assign_new_table_id");
...@@ -2448,13 +2448,13 @@ void assign_new_table_id(TABLE_SHARE *share) ...@@ -2448,13 +2448,13 @@ void assign_new_table_id(TABLE_SHARE *share)
There is one reserved number that cannot be used. Remember to There is one reserved number that cannot be used. Remember to
change this when 6-byte global table id's are introduced. change this when 6-byte global table id's are introduced.
*/ */
if (unlikely(tid == ULONG_MAX)) if (unlikely(tid == ~0UL))
tid= ++last_table_id; tid= ++last_table_id;
share->table_map_id= tid; share->table_map_id= tid;
DBUG_PRINT("info", ("table_id=%lu", tid)); DBUG_PRINT("info", ("table_id=%lu", tid));
/* Post conditions */ /* Post conditions */
DBUG_ASSERT(share->table_map_id != ULONG_MAX); DBUG_ASSERT(share->table_map_id != ~0UL);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -2194,7 +2194,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id, ...@@ -2194,7 +2194,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
{ {
DBUG_ENTER("binlog_prepare_pending_rows_event"); DBUG_ENTER("binlog_prepare_pending_rows_event");
/* Pre-conditions */ /* Pre-conditions */
DBUG_ASSERT(table->s->table_map_id != ULONG_MAX); DBUG_ASSERT(table->s->table_map_id != ~0UL);
/* Fetch the type code for the RowsEventT template parameter */ /* Fetch the type code for the RowsEventT template parameter */
int const type_code= RowsEventT::TYPE_CODE; int const type_code= RowsEventT::TYPE_CODE;
...@@ -2541,7 +2541,7 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end) ...@@ -2541,7 +2541,7 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end)
*/ */
Rows_log_event *ev= Rows_log_event *ev=
new Write_rows_log_event(this, 0, ULONG_MAX, 0, FALSE); new Write_rows_log_event(this, 0, ~0UL, 0, FALSE);
ev->set_flags(Rows_log_event::STMT_END_F); ev->set_flags(Rows_log_event::STMT_END_F);
binlog_set_pending_rows_event(ev); binlog_set_pending_rows_event(ev);
......
...@@ -145,7 +145,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, ...@@ -145,7 +145,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
elsewhere, and then assign a table map id inside open_table() elsewhere, and then assign a table map id inside open_table()
under the protection of the LOCK_open mutex. under the protection of the LOCK_open mutex.
*/ */
share->table_map_id= ULONG_MAX; share->table_map_id= ~0UL;
#endif #endif
memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root)); memcpy((char*) &share->mem_root, (char*) &mem_root, sizeof(mem_root));
...@@ -204,7 +204,7 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key, ...@@ -204,7 +204,7 @@ void init_tmp_table_share(TABLE_SHARE *share, const char *key,
anyway to be able to catch errors. anyway to be able to catch errors.
*/ */
share->table_map_version= ~(ulonglong)0; share->table_map_version= ~(ulonglong)0;
share->table_map_id= ULONG_MAX; share->table_map_id= ~0UL;
#endif #endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment