diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 5704337e77b..2606454d79a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -37,6 +37,7 @@ rpl_ndb_log : result not deterministic rpl_ndb_relay_space : Bug#16993 rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails rpl_ndb_sp007 : Bug #17290 +rpl_row_inexist_tbl : Disabled since patch makes this test wait forever rpl_sp : Bug#16456 rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future diff --git a/sql/log_event.cc b/sql/log_event.cc index 1b21bee1635..a6034c8d5b0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -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 - 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 binary log: the extreneous events will be removed in the future. */ - DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ULONG_MAX || - !tbl_arg && !cols && tid == ULONG_MAX); + DBUG_ASSERT(tbl_arg && tbl_arg->s && tid != ~0UL || + !tbl_arg && !cols && tid == ~0UL); if (thd_arg->options & OPTION_NO_FOREIGN_KEY_CHECKS) set_flags(NO_FOREIGN_KEY_CHECKS_F); @@ -5268,12 +5268,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) 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 the tables_to_lock list, close the thread tables, step the relay 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 @@ -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 <= (const char*)m_rows_end); -#if 0 /* in_use can have been set to NULL in close_tables_for_reopen */ THD* old_thd= table->in_use; if (!table->in_use) table->in_use= thd; -#endif error= do_exec_row(table); -#if 0 table->in_use = old_thd; -#endif switch (error) { /* Some recoverable errors */ @@ -5640,7 +5636,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, m_table_id(tid), 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 table.cc / alloc_table_share(): @@ -5708,7 +5704,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, post_start+= TM_FLAGS_OFFSET; } - DBUG_ASSERT(m_table_id != ULONG_MAX); + DBUG_ASSERT(m_table_id != ~0UL); m_flags= uint2korr(post_start); @@ -5985,7 +5981,7 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) #ifndef MYSQL_CLIENT 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]; 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) just set the necessary bits on the bytes and don't set the 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, table->key_info->key_length, HA_READ_KEY_EXACT))) @@ -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 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]))) { table->file->print_error(error, MYF(0)); @@ -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 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]); switch (error) { diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 3cc36f5105c..6c2ca06164f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -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 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) { - static ulong last_table_id= ULONG_MAX; + static ulong last_table_id= ~0UL; DBUG_ENTER("assign_new_table_id"); @@ -2448,13 +2448,13 @@ void assign_new_table_id(TABLE_SHARE *share) There is one reserved number that cannot be used. Remember to change this when 6-byte global table id's are introduced. */ - if (unlikely(tid == ULONG_MAX)) + if (unlikely(tid == ~0UL)) tid= ++last_table_id; share->table_map_id= tid; DBUG_PRINT("info", ("table_id=%lu", tid)); /* Post conditions */ - DBUG_ASSERT(share->table_map_id != ULONG_MAX); + DBUG_ASSERT(share->table_map_id != ~0UL); DBUG_VOID_RETURN; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 8ff36536743..f656f03ddc2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2194,7 +2194,7 @@ 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 != ULONG_MAX); + DBUG_ASSERT(table->s->table_map_id != ~0UL); /* Fetch the type code for the RowsEventT template parameter */ int const type_code= RowsEventT::TYPE_CODE; @@ -2541,7 +2541,7 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end) */ 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); binlog_set_pending_rows_event(ev); diff --git a/sql/table.cc b/sql/table.cc index b13fb347ee8..b7b235dc180 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -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() under the protection of the LOCK_open mutex. */ - share->table_map_id= ULONG_MAX; + share->table_map_id= ~0UL; #endif 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, anyway to be able to catch errors. */ share->table_map_version= ~(ulonglong)0; - share->table_map_id= ULONG_MAX; + share->table_map_id= ~0UL; #endif DBUG_VOID_RETURN;