Skip to content

Commit

Permalink
IB: DICT_TF2_VERSIONED flag removed
Browse files Browse the repository at this point in the history
Reverted DICT_TF2_BITS (midenok)
  • Loading branch information
kevgs authored and midenok committed Nov 14, 2017
1 parent 4a662df commit e674806
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 39 deletions.
6 changes: 2 additions & 4 deletions storage/innobase/dict/dict0mem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
16 changes: 5 additions & 11 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

Expand Down
7 changes: 3 additions & 4 deletions storage/innobase/include/dict0mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) \
Expand Down Expand Up @@ -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;

Expand Down
7 changes: 3 additions & 4 deletions storage/innobase/row/row0ins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down
12 changes: 4 additions & 8 deletions storage/innobase/row/row0merge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 *>(
Expand Down Expand Up @@ -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 *>(
Expand All @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions storage/innobase/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -2208,11 +2208,11 @@ row_update_for_mysql_using_upd_graph(
prebuilt->table->stat_modified_counter++;
}

if (DICT_TF2_FLAG_IS_SET(node->table, DICT_TF2_VERSIONED) &&
(node->versioned || node->vers_delete ||
// TODO: imrove this check (check if we touch only
// unversioned fields in foreigh table
node->foreign)) {
if (node->table->with_versioning() &&
(node->versioned || node->vers_delete ||
// TODO: imrove this check (check if we touch only
// unversioned fields in foreigh table)
node->foreign)) {
trx->vtq_notify_on_commit = true;
}

Expand Down

0 comments on commit e674806

Please sign in to comment.