Skip to content

Commit 30cb107

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
2 parents cfa81d2 + 6682d43 commit 30cb107

File tree

6 files changed

+19
-89
lines changed

6 files changed

+19
-89
lines changed

storage/innobase/btr/btr0cur.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3924,7 +3924,9 @@ dberr_t btr_cur_pessimistic_update(
39243924

39253925
ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec));
39263926
ut_ad(rec_offs_validate(rec, index, *offsets));
3927-
n_ext += lob::btr_push_update_extern_fields(new_entry, update, entry_heap);
3927+
3928+
/* Get number of externally stored columns in updated record */
3929+
n_ext = new_entry->get_n_ext();
39283930

39293931
if (page_zip_rec_needs_ext(rec_get_converted_size(index, new_entry, n_ext),
39303932
page_is_comp(page), dict_index_get_n_fields(index),

storage/innobase/include/data0data.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,18 @@ struct dtuple_t {
792792

793793
return (compare(rec, index, offsets, &matched_fields));
794794
}
795+
796+
/** Get number of externally stored fields.
797+
@retval number of externally stored fields. */
798+
inline ulint get_n_ext() const {
799+
ulint n_ext = 0;
800+
for (ulint i = 0; i < n_fields; ++i) {
801+
if (dfield_is_ext(&fields[i])) {
802+
n_ext++;
803+
}
804+
}
805+
return (n_ext);
806+
}
795807
};
796808

797809
/** A slot for a field in a big rec vector */

storage/innobase/include/lob0lob.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,16 +1503,6 @@ byte *btr_copy_externally_stored_field_func(
15031503
#endif /* UNIV_DEBUG */
15041504
mem_heap_t *heap);
15051505

1506-
/** Flags the data tuple fields that are marked as extern storage in the
1507-
update vector. We use this function to remember which fields we must
1508-
mark as extern storage in a record inserted for an update.
1509-
@param[in,out] tuple data tuple
1510-
@param[in] update update vector
1511-
@param[in] heap memory heap
1512-
@return number of flagged external columns */
1513-
ulint btr_push_update_extern_fields(dtuple_t *tuple, const upd_t *update,
1514-
mem_heap_t *heap);
1515-
15161506
/** Gets the externally stored size of a record, in units of a database page.
15171507
@param[in] rec record
15181508
@param[in] offsets array returned by rec_get_offsets()

storage/innobase/include/rem0rec.ic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ ulint rec_get_converted_size(
10651065

10661066
data_size = dtuple_get_data_size(dtuple, 0);
10671067

1068+
ut_ad(n_ext == dtuple->get_n_ext());
10681069
extra_size = rec_get_converted_extra_size(data_size,
10691070
dtuple_get_n_fields(dtuple), n_ext);
10701071

storage/innobase/lob/lob0lob.cc

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,83 +1078,6 @@ void blob_free(dict_index_t *index, buf_block_t *block, bool all, mtr_t *mtr) {
10781078
}
10791079
}
10801080

1081-
/** Flags the data tuple fields that are marked as extern storage in the
1082-
update vector. We use this function to remember which fields we must
1083-
mark as extern storage in a record inserted for an update.
1084-
@param[in,out] tuple data tuple
1085-
@param[in] update update vector
1086-
@param[in] heap memory heap
1087-
@return number of flagged external columns */
1088-
ulint btr_push_update_extern_fields(dtuple_t *tuple, const upd_t *update,
1089-
mem_heap_t *heap) {
1090-
DBUG_TRACE;
1091-
1092-
ulint n_pushed = 0;
1093-
ulint n;
1094-
upd_field_t *uf;
1095-
1096-
ut_ad(tuple);
1097-
ut_ad(update);
1098-
1099-
uf = update->fields;
1100-
n = upd_get_n_fields(update);
1101-
1102-
for (; n--; uf++) {
1103-
if (dfield_is_ext(&uf->new_val)) {
1104-
dfield_t *field = dtuple_get_nth_field(tuple, uf->field_no);
1105-
1106-
if (dfield_is_ext(field)) {
1107-
uf->ext_in_old = true;
1108-
} else {
1109-
uf->ext_in_old = false;
1110-
dfield_set_ext(field);
1111-
n_pushed++;
1112-
}
1113-
1114-
switch (uf->orig_len) {
1115-
byte *data;
1116-
ulint len;
1117-
byte *buf;
1118-
case 0:
1119-
break;
1120-
case BTR_EXTERN_FIELD_REF_SIZE:
1121-
/* Restore the original locally stored
1122-
part of the column. In the undo log,
1123-
InnoDB writes a longer prefix of externally
1124-
stored columns, so that column prefixes
1125-
in secondary indexes can be reconstructed. */
1126-
dfield_set_data(field,
1127-
(byte *)dfield_get_data(field) +
1128-
dfield_get_len(field) - BTR_EXTERN_FIELD_REF_SIZE,
1129-
BTR_EXTERN_FIELD_REF_SIZE);
1130-
dfield_set_ext(field);
1131-
break;
1132-
default:
1133-
/* Reconstruct the original locally
1134-
stored part of the column. The data
1135-
will have to be copied. */
1136-
ut_a(uf->orig_len > BTR_EXTERN_FIELD_REF_SIZE);
1137-
1138-
data = (byte *)dfield_get_data(field);
1139-
len = dfield_get_len(field);
1140-
1141-
buf = (byte *)mem_heap_alloc(heap, uf->orig_len);
1142-
/* Copy the locally stored prefix. */
1143-
memcpy(buf, data, uf->orig_len - BTR_EXTERN_FIELD_REF_SIZE);
1144-
/* Copy the BLOB pointer. */
1145-
memcpy(buf + uf->orig_len - BTR_EXTERN_FIELD_REF_SIZE,
1146-
data + len - BTR_EXTERN_FIELD_REF_SIZE,
1147-
BTR_EXTERN_FIELD_REF_SIZE);
1148-
1149-
dfield_set_data(field, buf, uf->orig_len);
1150-
dfield_set_ext(field);
1151-
}
1152-
}
1153-
}
1154-
1155-
return n_pushed;
1156-
}
1157-
11581081
/** Gets the externally stored size of a record, in units of a database page.
11591082
@param[in] rec record
11601083
@param[in] offsets array returned by rec_get_offsets()

storage/innobase/trx/trx0rec.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2593,12 +2593,14 @@ bool trx_undo_prev_version_build(
25932593
fields. Store the info: */
25942594

25952595
entry = row_rec_to_index_entry(rec, index, offsets, &n_ext, heap);
2596-
n_ext += lob::btr_push_update_extern_fields(entry, update, heap);
25972596
/* The page containing the clustered index record
25982597
corresponding to entry is latched in mtr. Thus the
25992598
following call is safe. */
26002599
row_upd_index_replace_new_col_vals(entry, index, update, heap);
26012600

2601+
/* Get number of externally stored columns in updated record */
2602+
n_ext = entry->get_n_ext();
2603+
26022604
buf = static_cast<byte *>(
26032605
mem_heap_alloc(heap, rec_get_converted_size(index, entry, n_ext)));
26042606

0 commit comments

Comments
 (0)