diff options
Diffstat (limited to 'storage/innobase/include/dict0dict.h')
-rw-r--r-- | storage/innobase/include/dict0dict.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 2d347feb7d6..a6b01ab6c43 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1416,12 +1416,6 @@ public: and DROP TABLE, as well as reading the dictionary data for a table from system tables */ - row_id_t row_id; /*!< the next row id to assign; - NOTE that at a checkpoint this - must be written to the dict system - header and flushed to a file; in - recovery this must be derived from - the log records */ hash_table_t table_hash; /*!< hash table of the tables, based on name */ /** hash table of persistent table IDs */ @@ -1439,14 +1433,31 @@ public: UT_LIST_BASE_NODE_T(dict_table_t) table_non_LRU; /*!< List of tables that can't be evicted from the cache */ + private: bool m_initialised= false; /** the sequence of temporary table IDs */ std::atomic<table_id_t> temp_table_id{DICT_HDR_FIRST_ID}; - - /** hash table of temporary table IDs */ - hash_table_t temp_id_hash; + /** hash table of temporary table IDs */ + hash_table_t temp_id_hash; + /** the next value of DB_ROW_ID, backed by DICT_HDR_ROW_ID + (FIXME: remove this, and move to dict_table_t) */ + Atomic_relaxed<row_id_t> row_id; + /** The synchronization interval of row_id */ + static constexpr size_t ROW_ID_WRITE_MARGIN= 256; public: + /** @return A new value for GEN_CLUST_INDEX(DB_ROW_ID) */ + inline row_id_t get_new_row_id(); + + /** Ensure that row_id is not smaller than id, on IMPORT TABLESPACE */ + inline void update_row_id(row_id_t id); + + /** Recover the global DB_ROW_ID sequence on database startup */ + void recover_row_id(row_id_t id) + { + row_id= ut_uint64_align_up(id, ROW_ID_WRITE_MARGIN) + ROW_ID_WRITE_MARGIN; + } + /** @return a new temporary table ID */ table_id_t get_temporary_table_id() { return temp_table_id.fetch_add(1, std::memory_order_relaxed); |