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