Commit 94fb7c6f authored by Marko Mäkelä's avatar Marko Mäkelä

Revert changes to REC_OFFS_MASK

There is no need to omit dropped columns in rec_get_offsets() and
related functions. Dropped columns will have to be dealt with
at a higher level when converting between table rows and
clustered index records.
parent 326d65e4
......@@ -399,7 +399,6 @@ btr_cur_instant_init_metadata(
const rec_t* rec,
dict_index_t* index)
{
ulint n_drop_nullable = 0;
ulint* offsets;
ulint len;
mem_heap_t* heap = mem_heap_create(UNIV_PAGE_SIZE_MAX);
......@@ -451,10 +450,8 @@ btr_cur_instant_init_metadata(
col->len = len;
index->fields[i].fixed_len = len;
if (!rec_offs_nth_drop_sql_null(offsets, i + 1)) {
if (!rec_offs_nth_sql_null(offsets, i + 1)) {
col->prtype = DATA_NOT_NULL;
} else {
n_drop_nullable++;
}
} else if (!rec_offs_nth_extern(offsets, i)) {
col->def_val.len = len;
......
......@@ -95,16 +95,10 @@ const ulint REC_OFFS_COMPACT = ~(ulint(~0) >> 1);
const ulint REC_OFFS_SQL_NULL = REC_OFFS_COMPACT;
/** External flag in offsets returned by rec_get_offsets() */
const ulint REC_OFFS_EXTERNAL = REC_OFFS_COMPACT >> 1;
/** Default value flag in offsets returned by rec_get_offsets() */
const ulint REC_OFFS_DEFAULT = REC_OFFS_COMPACT >> 2;
const ulint REC_OFFS_DROP_COL = REC_OFFS_COMPACT >> 3;
const ulint REC_OFFS_DROP_SQL_NULL = REC_OFFS_COMPACT >> 4;
/** Mask for offsets returned by rec_get_offsets() */
const ulint REC_OFFS_MASK = REC_OFFS_DROP_SQL_NULL - 1;
const ulint REC_OFFS_MASK = REC_OFFS_DEFAULT - 1;
#ifndef UNIV_INNOCHECKSUM
/******************************************************//**
......@@ -713,20 +707,6 @@ rec_offs_nth_sql_null(const ulint* offsets, ulint n)
return rec_offs_nth_flag(offsets, n, REC_OFFS_SQL_NULL);
}
inline
ulint
rec_offs_nth_drop_sql_null(const ulint* offsets, ulint n)
{
return rec_offs_nth_flag(offsets, n, REC_OFFS_DROP_SQL_NULL);
}
inline
ulint
rec_offs_nth_drop_col(const ulint* offsets, ulint n)
{
return rec_offs_nth_flag(offsets, n, REC_OFFS_DROP_COL);
}
/** Determine if a record field is stored off-page.
@param[in] offsets rec_get_offsets()
@param[in] n nth field
......@@ -884,11 +864,6 @@ rec_get_nth_cfield(
{
ut_ad(rec_offs_validate(rec, index, offsets));
if (rec_offs_nth_drop_col(offsets, n)) {
*len = index->fields[n].col->len;
return field_ref_zero;
}
if (!rec_offs_nth_default(offsets, n)) {
return rec_get_nth_field(rec, offsets, n, len);
}
......
......@@ -381,10 +381,7 @@ rec_init_offsets_comp_ordinary(
goto resolved;
} else {
ulint dlen;
if (col->is_dropped()) {
len = offs | REC_OFFS_DROP_COL;
any |= REC_OFFS_DROP_COL;
} else if (!index->instant_field_value(i, &dlen)) {
if (!index->instant_field_value(i, &dlen)) {
len = offs | REC_OFFS_SQL_NULL;
ut_ad(dlen == UNIV_SQL_NULL);
} else {
......@@ -583,11 +580,7 @@ number of fields in the record. The rest of the array will be
initialized by this function. rec_offs_base(offsets)[0] will be set
to the extra size (if REC_OFFS_COMPACT is set, the record is in the
new format; if REC_OFFS_EXTERNAL is set, the record contains externally
stored columns; if REC_OFFS_DROP_SQL_NULL is set, the field for the dropped
column is NULLABLE or length for the column is also maintained), and
rec_offs_base(offsets)[1..n_fields] will be set to
offsets past the end of fields 0..n_fields, or to the beginning of
fields 1..n_fields+1. When the high-order bit of the offset at [i+1]
stored columns); When the high-order bit of the offset at [i+1]
is set (REC_OFFS_SQL_NULL), the field i is NULL. When the second
high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the
field i is being stored externally.
......@@ -629,8 +622,6 @@ rec_init_offsets_for_metadata_low(
while(pos < rec_offs_n_fields(offsets) && pos < limit)
{
bool is_dropped = false;
bool is_nullable = false;
bool is_drop_null = false;
if (pos == n_pk_fields) {
/* Default row blob. */
......@@ -667,16 +658,7 @@ rec_init_offsets_for_metadata_low(
}
}
is_nullable = !(col->prtype & DATA_NOT_NULL);
/* Maintain null bit for dropped column. */
if (is_dropped) {
if (*nulls & null_mask) {
is_drop_null = true;
}
null_mask <<= 1;
} else if (is_nullable) {
if (!(col->prtype & DATA_NOT_NULL)) {
if (*nulls & null_mask) {
null_mask <<= 1;
len = offs | REC_OFFS_SQL_NULL;
......@@ -718,17 +700,7 @@ rec_init_offsets_for_metadata_low(
prev_offs = offs;
len = offs += len;
if (is_drop_null) {
/* Set the REC_OFFS_DROP_SQL_NULL flag if
the column is dropped and it is nullable. */
len = offs | REC_OFFS_DROP_SQL_NULL;
}
resolved:
if (is_dropped && !is_drop_null) {
len = offs | REC_OFFS_DROP_COL;
}
if (!is_dropped) {
/* Initialize previous offset if the column
is not dropped. */
......@@ -749,8 +721,7 @@ number of fields in the record. The rest of the array will be
initialized by this function. rec_offs_base(offsets)[0] will be set
to the extra size (if REC_OFFS_COMPACT is set, the record is in the
new format; if REC_OFFS_EXTERNAL is set, the record contains externally
stored columns; if REC_OFFS_DROP_SQL_NULL is set, the field for the dropped
column is NULLABLE or length for the column is also maintained), and
stored columns), and
rec_offs_base(offsets)[1..n_fields] will be set to
offsets past the end of fields 0..n_fields, or to the beginning of
fields 1..n_fields+1. When the high-order bit of the offset at [i+1]
......
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