Terminology: 'metadata record' instead of 'default row'

For instant ALTER TABLE, we store a hidden metadata record at the
start of the clustered index, to indicate how the format of the
records differs from the latest table definition.

The term 'default row' is too specific, because it applies to
instant ADD COLUMN only, and we will be supporting more classes
of instant ALTER TABLE later on. For instant ADD COLUMN, we
store the initial default values in the metadata record.
This commit is contained in:
Marko Mäkelä 2018-09-19 07:21:24 +03:00
parent 043639f9b0
commit 755187c853
24 changed files with 134 additions and 137 deletions

View file

@ -431,7 +431,7 @@ btr_cur_instant_init_low(dict_index_t* index, mtr_t* mtr)
const rec_t* rec = cur.page_cur.rec;
if (page_rec_is_supremum(rec) || !rec_is_default_row(rec, index)) {
if (page_rec_is_supremum(rec) || !rec_is_metadata(rec, index)) {
ib::error() << "Table " << index->table->name
<< " is missing instant ALTER metadata";
index->table->corrupted = true;
@ -452,7 +452,7 @@ incompatible:
goto incompatible;
}
/* Read the 'default row'. We can get here on server restart
/* Read the metadata. We can get here on server restart
or when the table was evicted from the data dictionary cache
and is now being accessed again.
@ -471,8 +471,8 @@ inconsistent:
goto incompatible;
}
/* In fact, because we only ever append fields to the 'default
value' record, it is also OK to perform READ UNCOMMITTED and
/* In fact, because we only ever append fields to the metadata
record, it is also OK to perform READ UNCOMMITTED and
then ignore any extra fields, provided that
trx_sys.is_registered(DB_TRX_ID). */
if (rec_offs_n_fields(offsets) > index->n_fields
@ -2270,10 +2270,9 @@ need_opposite_intention:
ut_ad(index->is_instant());
/* This may be a search tuple for
btr_pcur_restore_position(). */
ut_ad(tuple->info_bits == REC_INFO_DEFAULT_ROW
ut_ad(tuple->info_bits == REC_INFO_METADATA
|| tuple->info_bits == REC_INFO_MIN_REC_FLAG);
} else if (rec_is_default_row(btr_cur_get_rec(cursor),
index)) {
} else if (rec_is_metadata(btr_cur_get_rec(cursor), index)) {
/* Only user records belong in the adaptive
hash index. */
} else {
@ -3412,7 +3411,7 @@ fail_err:
} else if (index->disable_ahi) {
# endif
} else if (entry->info_bits & REC_INFO_MIN_REC_FLAG) {
ut_ad(entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(entry->info_bits == REC_INFO_METADATA);
ut_ad(index->is_instant());
ut_ad(flags == BTR_NO_LOCKING_FLAG);
} else {
@ -3620,7 +3619,7 @@ btr_cur_pessimistic_insert(
if (index->disable_ahi); else
# endif
if (entry->info_bits & REC_INFO_MIN_REC_FLAG) {
ut_ad(entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(entry->info_bits == REC_INFO_METADATA);
ut_ad(index->is_instant());
ut_ad((flags & ulint(~BTR_KEEP_IBUF_BITMAP))
== BTR_NO_LOCKING_FLAG);
@ -4100,9 +4099,9 @@ func_exit:
/** Trim an update tuple due to instant ADD COLUMN, if needed.
For normal records, the trailing instantly added fields that match
the 'default row' are omitted.
the initial default values are omitted.
For the special 'default row' record on a table on which instant
For the special metadata record on a table on which instant
ADD COLUMN has already been executed, both ADD COLUMN and the
rollback of ADD COLUMN need to be handled specially.
@ -4119,8 +4118,8 @@ btr_cur_trim(
const que_thr_t* thr)
{
if (!index->is_instant()) {
} else if (UNIV_UNLIKELY(update->info_bits == REC_INFO_DEFAULT_ROW)) {
/* We are either updating a 'default row'
} else if (UNIV_UNLIKELY(update->info_bits == REC_INFO_METADATA)) {
/* We are either updating a metadata record
(instantly adding columns to a table where instant ADD was
already executed) or rolling back such an operation. */
ut_ad(!upd_get_nth_field(update, 0)->orig_len);
@ -4227,9 +4226,9 @@ btr_cur_optimistic_update(
|| trx_is_recv(thr_get_trx(thr)));
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
const bool is_default_row = update->info_bits == REC_INFO_DEFAULT_ROW;
const bool is_metadata = update->info_bits == REC_INFO_METADATA;
if (UNIV_LIKELY(!is_default_row)
if (UNIV_LIKELY(!is_metadata)
&& !row_upd_changes_field_size_or_external(index, *offsets,
update)) {
@ -4389,8 +4388,8 @@ any_extern:
lock_rec_store_on_page_infimum(block, rec);
}
if (UNIV_UNLIKELY(is_default_row)) {
ut_ad(new_entry->info_bits == REC_INFO_DEFAULT_ROW);
if (UNIV_UNLIKELY(is_metadata)) {
ut_ad(new_entry->info_bits == REC_INFO_METADATA);
ut_ad(index->is_instant());
/* This can be innobase_add_instant_try() performing a
subsequent instant ADD COLUMN, or its rollback by
@ -4416,9 +4415,9 @@ any_extern:
cursor, new_entry, offsets, heap, 0/*n_ext*/, mtr);
ut_a(rec); /* <- We calculated above the insert would fit */
if (UNIV_UNLIKELY(is_default_row)) {
if (UNIV_UNLIKELY(is_metadata)) {
/* We must empty the PAGE_FREE list, because if this
was a rollback, the shortened 'default row' record
was a rollback, the shortened metadata record
would have too many fields, and we would be unable to
know the size of the freed record. */
btr_page_reorganize(page_cursor, index, mtr);
@ -4623,7 +4622,7 @@ btr_cur_pessimistic_update(
entry_heap);
btr_cur_trim(new_entry, index, update, thr);
const bool is_default_row = new_entry->info_bits
const bool is_metadata = new_entry->info_bits
& REC_INFO_MIN_REC_FLAG;
/* We have to set appropriate extern storage bits in the new
@ -4717,8 +4716,8 @@ btr_cur_pessimistic_update(
page, 1);
}
if (UNIV_UNLIKELY(is_default_row)) {
ut_ad(new_entry->info_bits == REC_INFO_DEFAULT_ROW);
if (UNIV_UNLIKELY(is_metadata)) {
ut_ad(new_entry->info_bits == REC_INFO_METADATA);
ut_ad(index->is_instant());
/* This can be innobase_add_instant_try() performing a
subsequent instant ADD COLUMN, or its rollback by
@ -4757,9 +4756,9 @@ btr_cur_pessimistic_update(
if (rec) {
page_cursor->rec = rec;
if (UNIV_UNLIKELY(is_default_row)) {
if (UNIV_UNLIKELY(is_metadata)) {
/* We must empty the PAGE_FREE list, because if this
was a rollback, the shortened 'default row' record
was a rollback, the shortened metadata record
would have too many fields, and we would be unable to
know the size of the freed record. */
btr_page_reorganize(page_cursor, index, mtr);
@ -4913,9 +4912,9 @@ btr_cur_pessimistic_update(
ut_ad(row_get_rec_trx_id(rec, index, *offsets));
}
if (UNIV_UNLIKELY(is_default_row)) {
if (UNIV_UNLIKELY(is_metadata)) {
/* We must empty the PAGE_FREE list, because if this
was a rollback, the shortened 'default row' record
was a rollback, the shortened metadata record
would have too many fields, and we would be unable to
know the size of the freed record. */
btr_page_reorganize(page_cursor, index, mtr);
@ -5413,16 +5412,16 @@ btr_cur_optimistic_delete_func(
if (UNIV_UNLIKELY(page_is_root(block->frame)
&& page_get_n_recs(block->frame) == 1
+ (cursor->index->is_instant()
&& !rec_is_default_row(rec, cursor->index)))) {
&& !rec_is_metadata(rec, cursor->index)))) {
/* The whole index (and table) becomes logically empty.
Empty the whole page. That is, if we are deleting the
only user record, also delete the 'default row' record
only user record, also delete the metadata record
if one exists (it exists if and only if is_instant()).
If we are deleting the 'default row' record and the
If we are deleting the metadata record and the
table becomes empty, clean up the whole page. */
dict_index_t* index = cursor->index;
ut_ad(!index->is_instant()
|| rec_is_default_row(
|| rec_is_metadata(
page_rec_get_next_const(
page_get_infimum_rec(block->frame)),
index));
@ -5475,7 +5474,7 @@ btr_cur_optimistic_delete_func(
page_cur_delete_rec(btr_cur_get_page_cur(cursor),
cursor->index, offsets, mtr);
/* We must empty the PAGE_FREE list, because
after rollback, this deleted 'default row' record
after rollback, this deleted metadata record
would have too many fields, and we would be
unable to know the size of the freed record. */
btr_page_reorganize(btr_cur_get_page_cur(cursor),
@ -5628,9 +5627,9 @@ btr_cur_pessimistic_delete(
}
if (page_is_leaf(page)) {
const bool is_default_row = rec_get_info_bits(
const bool is_metadata = rec_get_info_bits(
rec, page_rec_is_comp(rec)) & REC_INFO_MIN_REC_FLAG;
if (UNIV_UNLIKELY(is_default_row)) {
if (UNIV_UNLIKELY(is_metadata)) {
/* This should be rolling back instant ADD COLUMN.
If this is a recovered transaction, then
index->is_instant() will hold until the
@ -5648,15 +5647,15 @@ btr_cur_pessimistic_delete(
}
} else if (page_get_n_recs(page) == 1
+ (index->is_instant()
&& !rec_is_default_row(rec, index))) {
&& !rec_is_metadata(rec, index))) {
/* The whole index (and table) becomes logically empty.
Empty the whole page. That is, if we are deleting the
only user record, also delete the 'default row' record
only user record, also delete the metadata record
if one exists (it exists if and only if is_instant()).
If we are deleting the 'default row' record and the
If we are deleting the metadata record and the
table becomes empty, clean up the whole page. */
ut_ad(!index->is_instant()
|| rec_is_default_row(
|| rec_is_metadata(
page_rec_get_next_const(
page_get_infimum_rec(page)),
index));
@ -5673,13 +5672,13 @@ btr_cur_pessimistic_delete(
goto return_after_reservations;
}
if (UNIV_LIKELY(!is_default_row)) {
if (UNIV_LIKELY(!is_metadata)) {
btr_search_update_hash_on_delete(cursor);
} else {
page_cur_delete_rec(btr_cur_get_page_cur(cursor),
index, offsets, mtr);
/* We must empty the PAGE_FREE list, because
after rollback, this deleted 'default row' record
after rollback, this deleted metadata record
would carry too many fields, and we would be
unable to know the size of the freed record. */
btr_page_reorganize(btr_cur_get_page_cur(cursor),

View file

@ -151,13 +151,13 @@ btr_pcur_store_position(
rec = page_rec_get_prev(rec);
ut_ad(!page_rec_is_infimum(rec));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
cursor->rel_pos = BTR_PCUR_AFTER;
} else if (page_rec_is_infimum_low(offs)) {
rec = page_rec_get_next(rec);
if (rec_is_default_row(rec, index)) {
if (rec_is_metadata(rec, index)) {
rec = page_rec_get_next(rec);
ut_ad(!page_rec_is_supremum(rec));
}

View file

@ -111,7 +111,7 @@ rec_fold(
ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_ad(rec_validate(rec, offsets));
ut_ad(page_rec_is_leaf(rec));
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
ut_ad(n_fields > 0 || n_bytes > 0);
n_fields_rec = rec_offs_n_fields(offsets);
@ -1190,7 +1190,7 @@ retry:
rec = page_get_infimum_rec(page);
rec = page_rec_get_next_low(rec, page_is_comp(page));
if (rec_is_default_row(rec, index)) {
if (rec_is_metadata(rec, index)) {
rec = page_rec_get_next_low(rec, page_is_comp(page));
}
@ -1398,7 +1398,7 @@ btr_search_build_page_hash_index(
rec = page_rec_get_next_const(page_get_infimum_rec(page));
if (rec_is_default_row(rec, index)) {
if (rec_is_metadata(rec, index)) {
rec = page_rec_get_next_const(rec);
if (!--n_recs) return;
}
@ -1862,7 +1862,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch)
n_bytes, index->id);
}
if (!page_rec_is_infimum(rec) && !rec_is_default_row(rec, index)) {
if (!page_rec_is_infimum(rec) && !rec_is_metadata(rec, index)) {
offsets = rec_get_offsets(
rec, index, offsets, true,
btr_search_get_n_fields(n_fields, n_bytes), &heap);

View file

@ -44,7 +44,8 @@ byte data_error;
/** Trim the tail of an index tuple before insert or update.
After instant ADD COLUMN, if the last fields of a clustered index tuple
match the 'default row', there will be no need to store them.
match the default values that were explicitly specified or implied during
ADD COLUMN, there will be no need to store them.
NOTE: A page latch in the index must be held, so that the index
may not lose 'instantness' before the trimmed tuple has been
inserted or updated.

View file

@ -1084,7 +1084,7 @@ dict_stats_analyze_index_level(
btr_pcur_get_rec(&pcur), page_is_comp(page))) {
ut_ad(btr_pcur_is_on_user_rec(&pcur));
if (level == 0) {
/* Skip the 'default row' pseudo-record */
/* Skip the metadata pseudo-record */
ut_ad(index->is_instant());
btr_pcur_move_to_next_user_rec(&pcur, mtr);
}

View file

@ -3733,7 +3733,7 @@ fts_get_max_doc_id(
goto func_exit;
}
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
offsets = rec_get_offsets(
rec, index, offsets, true, ULINT_UNDEFINED, &heap);

View file

@ -4236,7 +4236,7 @@ innobase_add_virtual_try(
return innodb_update_n_cols(user_table, new_n, trx);
}
/** Insert into SYS_COLUMNS and insert/update the 'default row'
/** Insert into SYS_COLUMNS and insert/update the hidden metadata record
for instant ADD COLUMN.
@param[in,out] ctx ALTER TABLE context for the current partition
@param[in] altered_table MySQL table that is being altered
@ -4304,7 +4304,7 @@ innobase_add_instant_try(
/* For fixed-length NOT NULL 'core' columns,
get a dummy default value from SQL. Note that
we will preserve the old values of these
columns when updating the 'default row'
columns when updating the metadata
record, to avoid unnecessary updates. */
ulint len = (*af)->pack_length();
DBUG_ASSERT(d->type.mtype != DATA_INT
@ -4371,7 +4371,7 @@ innobase_add_instant_try(
memset(roll_ptr, 0, sizeof roll_ptr);
dtuple_t* entry = row_build_index_entry(row, NULL, index, ctx->heap);
entry->info_bits = REC_INFO_DEFAULT_ROW;
entry->info_bits = REC_INFO_METADATA;
mtr_t mtr;
mtr.start();
@ -4391,7 +4391,7 @@ innobase_add_instant_try(
NULL, trx, ctx->heap, NULL);
dberr_t err;
if (rec_is_default_row(rec, index)) {
if (rec_is_metadata(rec, index)) {
ut_ad(page_rec_is_user_rec(rec));
if (!page_has_next(block->frame)
&& page_rec_is_last(rec, block->frame)) {
@ -4404,7 +4404,7 @@ innobase_add_instant_try(
page as a result of the update. */
upd_t* update = upd_create(index->n_fields, ctx->heap);
update->n_fields = n;
update->info_bits = REC_INFO_DEFAULT_ROW;
update->info_bits = REC_INFO_METADATA;
/* Add the default values for instantly added columns */
for (unsigned i = 0; i < n; i++) {
upd_field_t* uf = upd_get_nth_field(update, i);

View file

@ -638,7 +638,8 @@ struct dtuple_t {
/** Trim the tail of an index tuple before insert or update.
After instant ADD COLUMN, if the last fields of a clustered index tuple
match the 'default row', there will be no need to store them.
match the default values that were explicitly specified or implied
during ADD COLUMN, there will be no need to store them.
NOTE: A page latch in the index must be held, so that the index
may not lose 'instantness' before the trimmed tuple has been
inserted or updated.

View file

@ -87,12 +87,12 @@ bits are stored in the most significant 5 bits of PAGE_DIRECTION_B.
These FIL_PAGE_TYPE_INSTANT and PAGE_INSTANT may be assigned even if
instant ADD COLUMN was not committed. Changes to these page header fields
are not undo-logged, but changes to the 'default value record' are.
are not undo-logged, but changes to the hidden metadata record are.
If the server is killed and restarted, the page header fields could
remain set even though no 'default value record' is present.
remain set even though no metadata record is present.
When the table becomes empty, the PAGE_INSTANT field and the
FIL_PAGE_TYPE can be reset and any 'default value record' be removed. */
FIL_PAGE_TYPE can be reset and any metadata record be removed. */
#define PAGE_INSTANT 12
/** last insert direction: PAGE_LEFT, ....
@ -285,13 +285,11 @@ page_rec_is_comp(const byte* rec)
}
# ifdef UNIV_DEBUG
/** Determine if the record is the 'default row' pseudo-record
/** Determine if the record is the metadata pseudo-record
in the clustered index.
@param[in] rec leaf page record on an index page
@return whether the record is the 'default row' pseudo-record */
inline
bool
page_rec_is_default_row(const rec_t* rec)
@return whether the record is the metadata pseudo-record */
inline bool page_rec_is_metadata(const rec_t* rec)
{
return rec_get_info_bits(rec, page_rec_is_comp(rec))
& REC_INFO_MIN_REC_FLAG;

View file

@ -70,9 +70,9 @@ enum rec_comp_status_t {
REC_STATUS_COLUMNS_ADDED = 4
};
/** The dtuple_t::info_bits of the 'default row' record.
@see rec_is_default_row() */
static const byte REC_INFO_DEFAULT_ROW
/** The dtuple_t::info_bits of the metadata pseudo-record.
@see rec_is_metadata() */
static const byte REC_INFO_METADATA
= REC_INFO_MIN_REC_FLAG | REC_STATUS_COLUMNS_ADDED;
#define REC_NEW_STATUS 3 /* This is single byte bit-field */
@ -791,14 +791,12 @@ rec_offs_comp(const ulint* offsets)
return(*rec_offs_base(offsets) & REC_OFFS_COMPACT);
}
/** Determine if the record is the 'default row' pseudo-record
/** Determine if the record is the metadata pseudo-record
in the clustered index.
@param[in] rec leaf page record
@param[in] index index of the record
@return whether the record is the 'default row' pseudo-record */
inline
bool
rec_is_default_row(const rec_t* rec, const dict_index_t* index)
@return whether the record is the metadata pseudo-record */
inline bool rec_is_metadata(const rec_t* rec, const dict_index_t* index)
{
bool is = rec_get_info_bits(rec, dict_table_is_comp(index->table))
& REC_INFO_MIN_REC_FLAG;

View file

@ -688,7 +688,7 @@ struct row_prebuilt_t {
to the Innobase format from the MySQL
format */
const byte* default_rec; /*!< the default values of all columns
(a "default row") in MySQL format */
(a "metadata") in MySQL format */
ulint hint_need_to_fetch_extra_cols;
/*!< normally this is set to 0; if this
is set to ROW_RETRIEVE_PRIMARY_KEY,

View file

@ -337,7 +337,7 @@ lock_report_trx_id_insanity(
trx_id_t max_trx_id) /*!< in: trx_sys.get_max_trx_id() */
{
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
ib::error()
<< "Transaction id " << trx_id
@ -360,7 +360,7 @@ lock_check_trx_id_sanity(
const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */
{
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
trx_id_t max_trx_id = trx_sys.get_max_trx_id();
ut_ad(max_trx_id || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN);
@ -389,7 +389,7 @@ lock_clust_rec_cons_read_sees(
ut_ad(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
/* Temp-tables are not shared across connections and multiple
transactions from different connections cannot simultaneously
@ -428,7 +428,7 @@ lock_sec_rec_cons_read_sees(
{
ut_ad(page_rec_is_user_rec(rec));
ut_ad(!index->is_primary());
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
/* NOTE that we might call this function while holding the search
system latch. */
@ -1222,7 +1222,7 @@ lock_sec_rec_some_has_impl(
ut_ad(!dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
max_trx_id = page_get_max_trx_id(page);
@ -2696,8 +2696,8 @@ lock_move_reorganize_page(
ulint old_heap_no;
ulint new_heap_no;
ut_d(const rec_t* const orec = rec1);
ut_ad(page_rec_is_default_row(rec1)
== page_rec_is_default_row(rec2));
ut_ad(page_rec_is_metadata(rec1)
== page_rec_is_metadata(rec2));
if (comp) {
old_heap_no = rec_get_heap_no_new(rec2);
@ -2718,7 +2718,7 @@ lock_move_reorganize_page(
/* Clear the bit in old_lock. */
if (old_heap_no < lock->un_member.rec_lock.n_bits
&& lock_rec_reset_nth_bit(lock, old_heap_no)) {
ut_ad(!page_rec_is_default_row(orec));
ut_ad(!page_rec_is_metadata(orec));
/* NOTE that the old lock bitmap could be too
small for the new heap number! */
@ -2799,8 +2799,8 @@ lock_move_rec_list_end(
reset the lock bits on the old */
for (;;) {
ut_ad(page_rec_is_default_row(rec1)
== page_rec_is_default_row(rec2));
ut_ad(page_rec_is_metadata(rec1)
== page_rec_is_metadata(rec2));
ut_d(const rec_t* const orec = rec1);
ulint rec1_heap_no;
@ -2837,7 +2837,7 @@ lock_move_rec_list_end(
if (rec1_heap_no < lock->un_member.rec_lock.n_bits
&& lock_rec_reset_nth_bit(lock, rec1_heap_no)) {
ut_ad(!page_rec_is_default_row(orec));
ut_ad(!page_rec_is_metadata(orec));
if (type_mode & LOCK_WAIT) {
lock_reset_lock_and_trx_wait(lock);
@ -2882,7 +2882,7 @@ lock_move_rec_list_start(
ut_ad(block->frame == page_align(rec));
ut_ad(new_block->frame == page_align(old_end));
ut_ad(comp == page_rec_is_comp(old_end));
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
lock_mutex_enter();
@ -2908,8 +2908,8 @@ lock_move_rec_list_start(
reset the lock bits on the old */
while (rec1 != rec) {
ut_ad(page_rec_is_default_row(rec1)
== page_rec_is_default_row(rec2));
ut_ad(page_rec_is_metadata(rec1)
== page_rec_is_metadata(rec2));
ut_d(const rec_t* const prev = rec1);
ulint rec1_heap_no;
@ -2934,7 +2934,7 @@ lock_move_rec_list_start(
if (rec1_heap_no < lock->un_member.rec_lock.n_bits
&& lock_rec_reset_nth_bit(lock, rec1_heap_no)) {
ut_ad(!page_rec_is_default_row(prev));
ut_ad(!page_rec_is_metadata(prev));
if (type_mode & LOCK_WAIT) {
lock_reset_lock_and_trx_wait(lock);
@ -3014,8 +3014,8 @@ lock_rtr_move_rec_list(
rec1 = rec_move[moved].old_rec;
rec2 = rec_move[moved].new_rec;
ut_ad(!page_rec_is_default_row(rec1));
ut_ad(!page_rec_is_default_row(rec2));
ut_ad(!page_rec_is_metadata(rec1));
ut_ad(!page_rec_is_metadata(rec2));
if (comp) {
rec1_heap_no = rec_get_heap_no_new(rec1);
@ -3094,7 +3094,7 @@ lock_update_merge_right(
page which will be
discarded */
{
ut_ad(!page_rec_is_default_row(orig_succ));
ut_ad(!page_rec_is_metadata(orig_succ));
lock_mutex_enter();
@ -3346,7 +3346,7 @@ lock_update_insert(
ulint donator_heap_no;
ut_ad(block->frame == page_align(rec));
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
/* Inherit the gap-locking locks for rec, in gap mode, from the next
record */
@ -3378,7 +3378,7 @@ lock_update_delete(
ulint next_heap_no;
ut_ad(page == page_align(rec));
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
if (page_is_comp(page)) {
heap_no = rec_get_heap_no_new(rec);
@ -4176,7 +4176,7 @@ lock_rec_unlock(
ut_ad(block->frame == page_align(rec));
ut_ad(!trx->lock.wait_lock);
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
heap_no = page_rec_get_heap_no(rec);
@ -4505,7 +4505,7 @@ lock_rec_print(FILE* file, const lock_t* lock)
rec = page_find_rec_with_heap_no(
buf_block_get_frame(block), i);
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
offsets = rec_get_offsets(
rec, lock->index, offsets, true,
@ -4977,7 +4977,7 @@ lock_rec_queue_validate(
lock = lock_rec_get_next_const(heap_no, lock)) {
ut_ad(!trx_is_ac_nl_ro(lock->trx));
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
if (index) {
ut_a(lock->index == index);
@ -5312,7 +5312,7 @@ lock_rec_insert_check_and_lock(
trx_t* trx = thr_get_trx(thr);
const rec_t* next_rec = page_rec_get_next_const(rec);
ulint heap_no = page_rec_get_heap_no(next_rec);
ut_ad(!rec_is_default_row(next_rec, index));
ut_ad(!rec_is_metadata(next_rec, index));
lock_mutex_enter();
/* Because this code is invoked for a running transaction by
@ -5440,7 +5440,7 @@ lock_rec_convert_impl_to_expl_for_trx(
{
ut_ad(trx->is_referenced());
ut_ad(page_rec_is_leaf(rec));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
DEBUG_SYNC_C("before_lock_rec_convert_impl_to_expl_for_trx");
@ -5517,7 +5517,7 @@ static void lock_rec_other_trx_holds_expl(trx_t *caller_trx, trx_t *trx,
{
if (trx)
{
ut_ad(!page_rec_is_default_row(rec));
ut_ad(!page_rec_is_metadata(rec));
lock_mutex_enter();
lock_rec_other_trx_holds_expl_arg arg= { page_rec_get_heap_no(rec), block,
trx };
@ -5564,7 +5564,7 @@ lock_rec_convert_impl_to_expl(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
ut_ad(page_rec_is_leaf(rec));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
if (dict_index_is_clust(index)) {
trx_id_t trx_id;
@ -5641,7 +5641,7 @@ lock_clust_rec_modify_check_and_lock(
return(DB_SUCCESS);
}
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
ut_ad(!index->table->is_temporary());
heap_no = rec_offs_comp(offsets)
@ -5697,7 +5697,7 @@ lock_sec_rec_modify_check_and_lock(
ut_ad(block->frame == page_align(rec));
ut_ad(mtr->is_named_space(index->table->space));
ut_ad(page_rec_is_leaf(rec));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
if (flags & BTR_NO_LOCKING_FLAG) {
@ -5791,7 +5791,7 @@ lock_sec_rec_read_check_and_lock(
return(DB_SUCCESS);
}
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
heap_no = page_rec_get_heap_no(rec);
/* Some transaction may have an implicit x-lock on the record only
@ -5853,7 +5853,7 @@ lock_clust_rec_read_check_and_lock(
|| gap_mode == LOCK_REC_NOT_GAP);
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(page_rec_is_leaf(rec));
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
if ((flags & BTR_NO_LOCKING_FLAG)
|| srv_read_only_mode
@ -7100,7 +7100,7 @@ lock_update_split_and_merge(
lock_mutex_enter();
left_next_rec = page_rec_get_next_const(orig_pred);
ut_ad(!page_rec_is_default_row(left_next_rec));
ut_ad(!page_rec_is_metadata(left_next_rec));
/* Inherit the locks on the supremum of the left page to the
first record which was moved from the right page */

View file

@ -737,7 +737,7 @@ up_slot_match:
& REC_INFO_MIN_REC_FLAG)) {
ut_ad(!page_has_prev(page_align(mid_rec)));
ut_ad(!page_rec_is_leaf(mid_rec)
|| rec_is_default_row(mid_rec, index));
|| rec_is_metadata(mid_rec, index));
cmp = 1;
goto low_rec_match;
}

View file

@ -2810,7 +2810,7 @@ page_find_rec_max_not_deleted(
const rec_t* prev_rec = NULL; // remove warning
/* Because the page infimum is never delete-marked
and never the 'default row' pseudo-record (MIN_REC_FLAG)),
and never the metadata pseudo-record (MIN_REC_FLAG)),
prev_rec will always be assigned to it first. */
ut_ad(!rec_get_info_bits(rec, page_rec_is_comp(rec)));
ut_ad(page_is_leaf(page));

View file

@ -1905,7 +1905,7 @@ rec_copy_prefix_to_buf(
case REC_STATUS_COLUMNS_ADDED:
/* We would have !index->is_instant() when rolling back
an instant ADD COLUMN operation. */
ut_ad(index->is_instant() || page_rec_is_default_row(rec));
ut_ad(index->is_instant() || page_rec_is_metadata(rec));
nulls++;
const ulint n_rec = ulint(index->n_core_fields) + 1
+ rec_get_n_add_field(nulls);

View file

@ -1462,9 +1462,9 @@ IndexPurge::open() UNIV_NOTHROW
btr_pcur_open_at_index_side(
true, m_index, BTR_MODIFY_LEAF, &m_pcur, true, 0, &m_mtr);
btr_pcur_move_to_next_user_rec(&m_pcur, &m_mtr);
if (rec_is_default_row(btr_pcur_get_rec(&m_pcur), m_index)) {
if (rec_is_metadata(btr_pcur_get_rec(&m_pcur), m_index)) {
ut_ad(btr_pcur_is_on_user_rec(&m_pcur));
/* Skip the 'default row' pseudo-record. */
/* Skip the metadata pseudo-record. */
} else {
btr_pcur_move_to_prev_on_page(&m_pcur);
}
@ -2267,8 +2267,8 @@ row_import_set_sys_max_row_id(
if (page_rec_is_infimum(rec)) {
/* The table is empty. */
err = DB_SUCCESS;
} else if (rec_is_default_row(rec, index)) {
/* The clustered index contains the 'default row',
} else if (rec_is_metadata(rec, index)) {
/* The clustered index contains the metadata record only,
that is, the table is empty. */
err = DB_SUCCESS;
} else {

View file

@ -2652,7 +2652,7 @@ row_ins_clust_index_entry_low(
#endif /* UNIV_DEBUG */
if (UNIV_UNLIKELY(entry->info_bits != 0)) {
ut_ad(entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(entry->info_bits == REC_INFO_METADATA);
ut_ad(flags == BTR_NO_LOCKING_FLAG);
ut_ad(index->is_instant());
ut_ad(!dict_index_is_online_ddl(index));
@ -2667,7 +2667,8 @@ row_ins_clust_index_entry_low(
err = DB_DUPLICATE_KEY;
goto err_exit;
case REC_INFO_MIN_REC_FLAG | REC_INFO_DELETED_FLAG:
/* The 'default row' is never delete-marked.
/* The metadata record never carries the delete-mark
in MariaDB Server 10.3.
If a table loses its 'instantness', it happens
by the rollback of this first-time insert, or
by a call to btr_page_empty() on the root page
@ -2682,7 +2683,7 @@ row_ins_clust_index_entry_low(
if (index->is_instant()) entry->trim(*index);
if (rec_is_default_row(btr_cur_get_rec(cursor), index)) {
if (rec_is_metadata(btr_cur_get_rec(cursor), index)) {
goto do_insert;
}

View file

@ -970,7 +970,7 @@ row_log_table_low(
ut_ad(!"wrong page type");
}
#endif /* UNIV_DEBUG */
ut_ad(!rec_is_default_row(rec, index));
ut_ad(!rec_is_metadata(rec, index));
ut_ad(page_rec_is_leaf(rec));
ut_ad(!page_is_comp(page_align(rec)) == !rec_offs_comp(offsets));
/* old_pk=row_log_table_get_pk() [not needed in INSERT] is a prefix

View file

@ -1873,9 +1873,9 @@ row_merge_read_clustered_index(
btr_pcur_open_at_index_side(
true, clust_index, BTR_SEARCH_LEAF, &pcur, true, 0, &mtr);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
if (rec_is_default_row(btr_pcur_get_rec(&pcur), clust_index)) {
if (rec_is_metadata(btr_pcur_get_rec(&pcur), clust_index)) {
ut_ad(btr_pcur_is_on_user_rec(&pcur));
/* Skip the 'default row' pseudo-record. */
/* Skip the metadata pseudo-record. */
} else {
ut_ad(!clust_index->is_instant());
btr_pcur_move_to_prev_on_page(&pcur);

View file

@ -1013,7 +1013,7 @@ row_search_on_row_ref(
index = dict_table_get_first_index(table);
if (UNIV_UNLIKELY(ref->info_bits != 0)) {
ut_ad(ref->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(ref->info_bits == REC_INFO_METADATA);
ut_ad(ref->n_fields <= index->n_uniq);
btr_pcur_open_at_index_side(true, index, mode, pcur, true, 0,
mtr);
@ -1021,7 +1021,7 @@ row_search_on_row_ref(
/* We do not necessarily have index->is_instant() here,
because we could be executing a rollback of an
instant ADD COLUMN operation. The function
rec_is_default_row() asserts index->is_instant();
rec_is_metadata() asserts index->is_instant();
we do not want to call it here. */
return rec_get_info_bits(btr_pcur_get_rec(pcur),
dict_table_is_comp(index->table))

View file

@ -1489,7 +1489,7 @@ row_sel_try_search_shortcut(
const rec_t* rec = btr_pcur_get_rec(&(plan->pcur));
if (!page_rec_is_user_rec(rec) || rec_is_default_row(rec, index)) {
if (!page_rec_is_user_rec(rec) || rec_is_metadata(rec, index)) {
retry:
rw_lock_s_unlock(ahi_latch);
return(SEL_RETRY);
@ -1789,8 +1789,8 @@ skip_lock:
goto next_rec;
}
if (rec_is_default_row(rec, index)) {
/* Skip the 'default row' pseudo-record. */
if (rec_is_metadata(rec, index)) {
/* Skip the metadata pseudo-record. */
cost_counter++;
goto next_rec;
}
@ -3011,7 +3011,7 @@ row_sel_store_mysql_field_func(
}
} else {
/* The field is stored in the index record, or
in the 'default row' for instant ADD COLUMN. */
in the metadata for instant ADD COLUMN. */
if (rec_offs_nth_default(offsets, field_no)) {
ut_ad(dict_index_is_clust(index));
@ -3563,8 +3563,8 @@ sel_restore_position_for_mysql(
if (!success && moves_up) {
next:
if (btr_pcur_move_to_next(pcur, mtr)
&& rec_is_default_row(btr_pcur_get_rec(pcur),
pcur->btr_cur.index)) {
&& rec_is_metadata(btr_pcur_get_rec(pcur),
pcur->btr_cur.index)) {
btr_pcur_move_to_next(pcur, mtr);
}
@ -3579,8 +3579,8 @@ next:
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
prev:
if (btr_pcur_is_on_user_rec(pcur) && !moves_up
&& !rec_is_default_row(btr_pcur_get_rec(pcur),
pcur->btr_cur.index)) {
&& !rec_is_metadata(btr_pcur_get_rec(pcur),
pcur->btr_cur.index)) {
btr_pcur_move_to_prev(pcur, mtr);
}
return true;
@ -3857,7 +3857,7 @@ row_sel_try_search_shortcut_for_mysql(
BTR_SEARCH_LEAF, pcur, ahi_latch, mtr);
rec = btr_pcur_get_rec(pcur);
if (!page_rec_is_user_rec(rec) || rec_is_default_row(rec, index)) {
if (!page_rec_is_user_rec(rec) || rec_is_metadata(rec, index)) {
retry:
rw_lock_s_unlock(ahi_latch);
return(SEL_RETRY);
@ -4758,7 +4758,7 @@ rec_loop:
if (comp) {
if (rec_get_info_bits(rec, true) & REC_INFO_MIN_REC_FLAG) {
/* Skip the 'default row' pseudo-record. */
/* Skip the metadata pseudo-record. */
ut_ad(index->is_instant());
goto next_rec;
}
@ -4770,7 +4770,7 @@ rec_loop:
}
} else {
if (rec_get_info_bits(rec, false) & REC_INFO_MIN_REC_FLAG) {
/* Skip the 'default row' pseudo-record. */
/* Skip the metadata pseudo-record. */
ut_ad(index->is_instant());
goto next_rec;
}

View file

@ -142,7 +142,7 @@ row_undo_ins_remove_clust_rec(
/* This is rolling back an INSERT into SYS_COLUMNS.
If it was part of an instant ADD COLUMN operation, we
must modify the table definition. At this point, any
corresponding operation to the 'default row' will have
corresponding operation to the metadata record will have
been rolled back. */
ut_ad(!online);
ut_ad(node->trx->dict_operation_lock_mode == RW_X_LATCH);

View file

@ -1211,16 +1211,15 @@ close_table:
if (node->update->info_bits & REC_INFO_MIN_REC_FLAG) {
/* This must be an undo log record for a subsequent
instant ADD COLUMN on a table, extending the
'default value' record. */
instant ALTER TABLE, extending the metadata record. */
ut_ad(clust_index->is_instant());
if (node->update->info_bits != REC_INFO_MIN_REC_FLAG) {
ut_ad(!"wrong info_bits in undo log record");
goto close_table;
}
node->update->info_bits = REC_INFO_DEFAULT_ROW;
node->update->info_bits = REC_INFO_METADATA;
const_cast<dtuple_t*>(node->ref)->info_bits
= REC_INFO_DEFAULT_ROW;
= REC_INFO_METADATA;
}
if (!row_undo_search_clust_to_pcur(node)) {
@ -1297,7 +1296,7 @@ row_undo_mod(
ut_ad(dict_index_is_clust(node->index));
if (node->ref->info_bits) {
ut_ad(node->ref->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(node->ref->info_bits == REC_INFO_METADATA);
goto rollback_clust;
}

View file

@ -42,7 +42,7 @@ Created 3/26/1996 Heikki Tuuri
/** The search tuple corresponding to TRX_UNDO_INSERT_DEFAULT */
const dtuple_t trx_undo_default_rec = {
REC_INFO_DEFAULT_ROW, 0, 0,
REC_INFO_METADATA, 0, 0,
NULL, 0, NULL,
UT_LIST_NODE_T(dtuple_t)()
#ifdef UNIV_DEBUG
@ -506,7 +506,7 @@ trx_undo_page_report_insert(
/* Store then the fields required to uniquely determine the record
to be inserted in the clustered index */
if (UNIV_UNLIKELY(clust_entry->info_bits != 0)) {
ut_ad(clust_entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(clust_entry->info_bits == REC_INFO_METADATA);
ut_ad(index->is_instant());
ut_ad(undo_block->frame[first_free + 2]
== TRX_UNDO_INSERT_REC);