diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/table.h | 2 | ||||
-rw-r--r-- | sql/table_cache.cc | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sql/table.h b/sql/table.h index 4a1552f8c0d..10c1d1bc68e 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1816,7 +1816,7 @@ struct TABLE_LIST /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List<Index_hint> *index_hints; TABLE *table; /* opened table */ - uint table_id; /* table id (from binlog) for opened table */ + ulonglong table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table filling procedure diff --git a/sql/table_cache.cc b/sql/table_cache.cc index f13d7183a99..1154017d8d5 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -1206,6 +1206,9 @@ void tdc_assign_new_table_id(TABLE_SHARE *share) DBUG_ASSERT(share); DBUG_ASSERT(tdc_inited); + DBUG_EXECUTE_IF("simulate_big_table_id", + if (last_table_id < UINT_MAX32) + 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. @@ -1215,7 +1218,7 @@ void tdc_assign_new_table_id(TABLE_SHARE *share) my_atomic_rwlock_wrlock(&LOCK_tdc_atomics); tid= my_atomic_add64(&last_table_id, 1); my_atomic_rwlock_wrunlock(&LOCK_tdc_atomics); - } while (unlikely(tid == ~0UL)); + } while (unlikely(tid == ~0UL || tid == 0)); share->table_map_id= tid; DBUG_PRINT("info", ("table_id= %lu", share->table_map_id)); |