Commit e6748062 authored by Eugene Kosov's avatar Eugene Kosov Committed by Aleksey Midenkov

IB: DICT_TF2_VERSIONED flag removed

Reverted DICT_TF2_BITS (midenok)
parent 4a662df9
...@@ -305,12 +305,10 @@ dict_mem_table_add_col( ...@@ -305,12 +305,10 @@ dict_mem_table_add_col(
dict_mem_fill_column_struct(col, i, mtype, prtype, len); dict_mem_fill_column_struct(col, i, mtype, prtype, len);
if (prtype & DATA_VERS_ROW_START) { if (prtype & DATA_VERS_ROW_START) {
ut_ad(table->flags2 & DICT_TF2_VERSIONED ut_ad(!(prtype & DATA_VERS_ROW_END));
&& !(prtype & DATA_VERS_ROW_END));
table->vers_row_start = i; table->vers_row_start = i;
} else if (prtype & DATA_VERS_ROW_END) { } else if (prtype & DATA_VERS_ROW_END) {
ut_ad(table->flags2 & DICT_TF2_VERSIONED ut_ad(!(prtype & DATA_VERS_ROW_START));
&& !(prtype & DATA_VERS_ROW_START));
table->vers_row_end = i; table->vers_row_end = i;
} }
} }
......
...@@ -8870,9 +8870,8 @@ calc_row_difference( ...@@ -8870,9 +8870,8 @@ calc_row_difference(
n_changed++; n_changed++;
if (!prebuilt->upd_node->versioned && if (!prebuilt->upd_node->versioned &&
DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_VERSIONED) && prebuilt->table->with_versioning() &&
!(field->flags & VERS_OPTIMIZED_UPDATE_FLAG)) !(field->flags & VERS_OPTIMIZED_UPDATE_FLAG)) {
{
prebuilt->upd_node->versioned = true; prebuilt->upd_node->versioned = true;
} }
...@@ -8982,9 +8981,8 @@ calc_row_difference( ...@@ -8982,9 +8981,8 @@ calc_row_difference(
++n_changed; ++n_changed;
if (!prebuilt->upd_node->versioned && if (!prebuilt->upd_node->versioned &&
DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_VERSIONED) && prebuilt->table->with_versioning() &&
!(field->flags & VERS_OPTIMIZED_UPDATE_FLAG)) !(field->flags & VERS_OPTIMIZED_UPDATE_FLAG)) {
{
prebuilt->upd_node->versioned = true; prebuilt->upd_node->versioned = true;
} }
} else { } else {
...@@ -11400,7 +11398,7 @@ create_table_info_t::create_table_def() ...@@ -11400,7 +11398,7 @@ create_table_info_t::create_table_def()
ulint vers_row_start = 0; ulint vers_row_start = 0;
ulint vers_row_end = 0; ulint vers_row_end = 0;
if (m_flags2 & DICT_TF2_VERSIONED) { if (m_form->versioned()) {
if (i == m_form->s->row_start_field) { if (i == m_form->s->row_start_field) {
vers_row_start = DATA_VERS_ROW_START; vers_row_start = DATA_VERS_ROW_START;
} else if (i == m_form->s->row_end_field) { } else if (i == m_form->s->row_end_field) {
...@@ -12522,10 +12520,6 @@ create_table_info_t::innobase_table_flags() ...@@ -12522,10 +12520,6 @@ create_table_info_t::innobase_table_flags()
DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name", DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
m_flags2 &= ~DICT_TF2_FTS_AUX_HEX_NAME;); m_flags2 &= ~DICT_TF2_FTS_AUX_HEX_NAME;);
if (m_create_info->options & HA_VERSIONED_TABLE) {
m_flags2 |= DICT_TF2_VERSIONED;
}
DBUG_RETURN(true); DBUG_RETURN(true);
} }
......
...@@ -245,7 +245,7 @@ ROW_FORMAT=REDUNDANT. InnoDB engines do not check these flags ...@@ -245,7 +245,7 @@ ROW_FORMAT=REDUNDANT. InnoDB engines do not check these flags
for unknown bits in order to protect backward incompatibility. */ for unknown bits in order to protect backward incompatibility. */
/* @{ */ /* @{ */
/** Total number of bits in table->flags2. */ /** Total number of bits in table->flags2. */
#define DICT_TF2_BITS 8 #define DICT_TF2_BITS 7
#define DICT_TF2_UNUSED_BIT_MASK (~0U << DICT_TF2_BITS) #define DICT_TF2_UNUSED_BIT_MASK (~0U << DICT_TF2_BITS)
#define DICT_TF2_BIT_MASK ~DICT_TF2_UNUSED_BIT_MASK #define DICT_TF2_BIT_MASK ~DICT_TF2_UNUSED_BIT_MASK
...@@ -273,9 +273,6 @@ use its own tablespace instead of the system tablespace. */ ...@@ -273,9 +273,6 @@ use its own tablespace instead of the system tablespace. */
index tables) of a FTS table are in HEX format. */ index tables) of a FTS table are in HEX format. */
#define DICT_TF2_FTS_AUX_HEX_NAME 64U #define DICT_TF2_FTS_AUX_HEX_NAME 64U
/** System Versioning bit. */
#define DICT_TF2_VERSIONED 128U
/* @} */ /* @} */
#define DICT_TF2_FLAG_SET(table, flag) \ #define DICT_TF2_FLAG_SET(table, flag) \
...@@ -1492,6 +1489,8 @@ struct dict_table_t { ...@@ -1492,6 +1489,8 @@ struct dict_table_t {
/** Add the table definition to the data dictionary cache */ /** Add the table definition to the data dictionary cache */
void add_to_cache(); void add_to_cache();
bool with_versioning() const { return vers_row_start || vers_row_end; }
/** Id of the table. */ /** Id of the table. */
table_id_t id; table_id_t id;
......
...@@ -1705,9 +1705,8 @@ row_ins_check_foreign_constraint( ...@@ -1705,9 +1705,8 @@ row_ins_check_foreign_constraint(
} }
/* System Versioning: if sys_trx_end != Inf, we /* System Versioning: if sys_trx_end != Inf, we
suppress the foreign key check */ suppress the foreign key check */
if (DICT_TF2_FLAG_IS_SET(table, DICT_TF2_VERSIONED) && if (table->with_versioning() &&
dfield_get_type(field)->prtype & DATA_VERS_ROW_END) dfield_get_type(field)->prtype & DATA_VERS_ROW_END) {
{
byte* data = static_cast<byte*>(dfield_get_data(field)); byte* data = static_cast<byte*>(dfield_get_data(field));
ut_ad(data); ut_ad(data);
trx_id_t end_trx_id = mach_read_from_8(data); trx_id_t end_trx_id = mach_read_from_8(data);
...@@ -1842,7 +1841,7 @@ row_ins_check_foreign_constraint( ...@@ -1842,7 +1841,7 @@ row_ins_check_foreign_constraint(
cmp = cmp_dtuple_rec(entry, rec, offsets); cmp = cmp_dtuple_rec(entry, rec, offsets);
if (cmp == 0) { if (cmp == 0) {
if (DICT_TF2_FLAG_IS_SET(check_table, DICT_TF2_VERSIONED)) { if (check_table->with_versioning()) {
trx_id_t end_trx_id = 0; trx_id_t end_trx_id = 0;
if (dict_index_is_clust(check_index)) { if (dict_index_is_clust(check_index)) {
......
...@@ -2241,8 +2241,7 @@ row_merge_read_clustered_index( ...@@ -2241,8 +2241,7 @@ row_merge_read_clustered_index(
< dict_table_get_n_user_cols(new_table)); < dict_table_get_n_user_cols(new_table));
bool historical_row = false; bool historical_row = false;
if (DICT_TF2_FLAG_IS_SET( if (new_table->with_versioning()) {
new_table, DICT_TF2_VERSIONED)) {
const dfield_t *dfield = dtuple_get_nth_field( const dfield_t *dfield = dtuple_get_nth_field(
row, new_table->vers_row_end); row, new_table->vers_row_end);
const byte *data = static_cast<const byte *>( const byte *data = static_cast<const byte *>(
...@@ -2304,10 +2303,8 @@ row_merge_read_clustered_index( ...@@ -2304,10 +2303,8 @@ row_merge_read_clustered_index(
} }
} }
if (DICT_TF2_FLAG_IS_SET(old_table, DICT_TF2_VERSIONED)) { if (old_table->with_versioning()) {
if (DICT_TF2_FLAG_IS_SET(new_table, if (new_table->with_versioning() && !drop_historical) {
DICT_TF2_VERSIONED) &&
!drop_historical) {
dfield_t *end = dtuple_get_nth_field( dfield_t *end = dtuple_get_nth_field(
row, new_table->vers_row_end); row, new_table->vers_row_end);
byte *data = static_cast<byte *>( byte *data = static_cast<byte *>(
...@@ -2333,8 +2330,7 @@ row_merge_read_clustered_index( ...@@ -2333,8 +2330,7 @@ row_merge_read_clustered_index(
if (mach_read_from_8(sys_trx_end) != TRX_ID_MAX) if (mach_read_from_8(sys_trx_end) != TRX_ID_MAX)
continue; continue;
} }
} else if (DICT_TF2_FLAG_IS_SET( } else if (new_table->with_versioning()) {
new_table, DICT_TF2_VERSIONED)) {
void *sys_trx_start = mem_heap_alloc(row_heap, 8); void *sys_trx_start = mem_heap_alloc(row_heap, 8);
void *sys_trx_end = mem_heap_alloc(row_heap, 8); void *sys_trx_end = mem_heap_alloc(row_heap, 8);
mach_write_to_8(sys_trx_start, trx->id); mach_write_to_8(sys_trx_start, trx->id);
......
...@@ -1569,7 +1569,7 @@ row_insert_for_mysql( ...@@ -1569,7 +1569,7 @@ row_insert_for_mysql(
node->duplicate = NULL; node->duplicate = NULL;
if (DICT_TF2_FLAG_IS_SET(node->table, DICT_TF2_VERSIONED)) { if (node->table->with_versioning()) {
trx->vtq_notify_on_commit = true; trx->vtq_notify_on_commit = true;
} }
...@@ -2127,8 +2127,8 @@ row_update_for_mysql_using_upd_graph( ...@@ -2127,8 +2127,8 @@ row_update_for_mysql_using_upd_graph(
node->cascade_upd_nodes = cascade_upd_nodes; node->cascade_upd_nodes = cascade_upd_nodes;
cascade_upd_nodes->pop_front(); cascade_upd_nodes->pop_front();
thr->fk_cascade_depth++; thr->fk_cascade_depth++;
vers_set_fields = DICT_TF2_FLAG_IS_SET(node->table, DICT_TF2_VERSIONED) vers_set_fields = node->table->with_versioning() &&
&& (node->is_delete || node->versioned); (node->is_delete || node->versioned);
goto run_again; goto run_again;
} }
...@@ -2208,11 +2208,11 @@ row_update_for_mysql_using_upd_graph( ...@@ -2208,11 +2208,11 @@ row_update_for_mysql_using_upd_graph(
prebuilt->table->stat_modified_counter++; prebuilt->table->stat_modified_counter++;
} }
if (DICT_TF2_FLAG_IS_SET(node->table, DICT_TF2_VERSIONED) && if (node->table->with_versioning() &&
(node->versioned || node->vers_delete || (node->versioned || node->vers_delete ||
// TODO: imrove this check (check if we touch only // TODO: imrove this check (check if we touch only
// unversioned fields in foreigh table // unversioned fields in foreigh table)
node->foreign)) { node->foreign)) {
trx->vtq_notify_on_commit = true; trx->vtq_notify_on_commit = true;
} }
......
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