Commit f6f4a52b authored by marko's avatar marko

branches/zip: Add clarifying comments that the clustered index record must

be protected from being deleted while any externally stored columns are
being fetched.

row_ext_create(),
row_upd_index_replace_new_col_vals(),
row_upd_index_replace_new_col_vals_index_pos(),
row_sel_sec_rec_is_for_blob(),
row_sel_sec_rec_is_for_clust_rec(): Note that the clustered
index record must be covered by a lock or a page latch.

row_upd_sec_index_entry(), row_upd_clust_rec_by_insert(),
row_undo_mod_upd_exist_sec(): Note that these functions probably
do not obtain an appropriate lock on the clustered index record
before fetching any externally stored columns.
parent 0d025934
...@@ -27,8 +27,11 @@ row_ext_create( ...@@ -27,8 +27,11 @@ row_ext_create(
dict_col_get_no(); NOT relative to the records dict_col_get_no(); NOT relative to the records
in the clustered index */ in the clustered index */
const dtuple_t* tuple, /* in: data tuple containing the field const dtuple_t* tuple, /* in: data tuple containing the field
references of the externally stored columns; references of the externally stored
must be indexed by col_no */ columns; must be indexed by col_no;
the clustered index record must be
covered by a lock or a page latch
to prevent deletion (rollback or purge). */
ulint zip_size,/* compressed page size in bytes, or 0 */ ulint zip_size,/* compressed page size in bytes, or 0 */
mem_heap_t* heap); /* in: heap where created */ mem_heap_t* heap); /* in: heap where created */
......
...@@ -185,7 +185,10 @@ given. */ ...@@ -185,7 +185,10 @@ given. */
void void
row_upd_index_replace_new_col_vals_index_pos( row_upd_index_replace_new_col_vals_index_pos(
/*=========================================*/ /*=========================================*/
dtuple_t* entry, /* in/out: index entry where replaced */ dtuple_t* entry, /* in/out: index entry where replaced;
the clustered index record must be
covered by a lock or a page latch to
prevent deletion (rollback or purge) */
dict_index_t* index, /* in: index; NOTE that this may also be a dict_index_t* index, /* in: index; NOTE that this may also be a
non-clustered index */ non-clustered index */
const upd_t* update, /* in: an update vector built for the index so const upd_t* update, /* in: an update vector built for the index so
...@@ -210,7 +213,10 @@ given. */ ...@@ -210,7 +213,10 @@ given. */
void void
row_upd_index_replace_new_col_vals( row_upd_index_replace_new_col_vals(
/*===============================*/ /*===============================*/
dtuple_t* entry, /* in/out: index entry where replaced */ dtuple_t* entry, /* in/out: index entry where replaced;
the clustered index record must be
covered by a lock or a page latch to
prevent deletion (rollback or purge) */
dict_index_t* index, /* in: index; NOTE that this may also be a dict_index_t* index, /* in: index; NOTE that this may also be a
non-clustered index */ non-clustered index */
const upd_t* update, /* in: an update vector built for the const upd_t* update, /* in: an update vector built for the
......
...@@ -60,8 +60,11 @@ row_ext_create( ...@@ -60,8 +60,11 @@ row_ext_create(
dict_col_get_no(); NOT relative to the records dict_col_get_no(); NOT relative to the records
in the clustered index */ in the clustered index */
const dtuple_t* tuple, /* in: data tuple containing the field const dtuple_t* tuple, /* in: data tuple containing the field
references of the externally stored columns; references of the externally stored
must be indexed by col_no */ columns; must be indexed by col_no;
the clustered index record must be
covered by a lock or a page latch
to prevent deletion (rollback or purge). */
ulint zip_size,/* compressed page size in bytes, or 0 */ ulint zip_size,/* compressed page size in bytes, or 0 */
mem_heap_t* heap) /* in: heap where created */ mem_heap_t* heap) /* in: heap where created */
{ {
......
...@@ -67,10 +67,13 @@ row_sel_sec_rec_is_for_blob( ...@@ -67,10 +67,13 @@ row_sel_sec_rec_is_for_blob(
ulint mbminlen, /* in: minimum length of a ulint mbminlen, /* in: minimum length of a
multi-byte character */ multi-byte character */
ulint mbmaxlen, /* in: maximum length of a ulint mbmaxlen, /* in: maximum length of a
multi-byte character */ multi-byte character */
const byte* clust_field, /* in: the locally stored part of const byte* clust_field, /* in: the locally stored part of
the clustered index column, including the clustered index column, including
the BLOB pointer */ the BLOB pointer; the clustered
index record must be covered by
a lock or a page latch to protect it
against deletion (rollback or purge) */
ulint clust_len, /* in: length of clust_field */ ulint clust_len, /* in: length of clust_field */
const byte* sec_field, /* in: column in secondary index */ const byte* sec_field, /* in: column in secondary index */
ulint sec_len, /* in: length of sec_field */ ulint sec_len, /* in: length of sec_field */
...@@ -104,7 +107,10 @@ row_sel_sec_rec_is_for_clust_rec( ...@@ -104,7 +107,10 @@ row_sel_sec_rec_is_for_clust_rec(
when compared with collation */ when compared with collation */
const rec_t* sec_rec, /* in: secondary index record */ const rec_t* sec_rec, /* in: secondary index record */
dict_index_t* sec_index, /* in: secondary index */ dict_index_t* sec_index, /* in: secondary index */
const rec_t* clust_rec, /* in: clustered index record */ const rec_t* clust_rec, /* in: clustered index record;
must be protected by a lock or
a page latch against deletion
in rollback or purge */
dict_index_t* clust_index) /* in: clustered index */ dict_index_t* clust_index) /* in: clustered index */
{ {
const byte* sec_field; const byte* sec_field;
...@@ -2990,8 +2996,8 @@ row_sel_get_clust_rec_for_mysql( ...@@ -2990,8 +2996,8 @@ row_sel_get_clust_rec_for_mysql(
&& !row_sel_sec_rec_is_for_clust_rec( && !row_sel_sec_rec_is_for_clust_rec(
rec, sec_index, clust_rec, clust_index)) { rec, sec_index, clust_rec, clust_index)) {
clust_rec = NULL; clust_rec = NULL;
} else {
#ifdef UNIV_SEARCH_DEBUG #ifdef UNIV_SEARCH_DEBUG
} else {
ut_a(clust_rec == NULL ut_a(clust_rec == NULL
|| row_sel_sec_rec_is_for_clust_rec( || row_sel_sec_rec_is_for_clust_rec(
rec, sec_index, clust_rec, clust_index)); rec, sec_index, clust_rec, clust_index));
......
...@@ -637,6 +637,8 @@ row_undo_mod_upd_exist_sec( ...@@ -637,6 +637,8 @@ row_undo_mod_upd_exist_sec(
but alphabetically they stayed the same, e.g., but alphabetically they stayed the same, e.g.,
'abc' -> 'aBc'. */ 'abc' -> 'aBc'. */
/* TODO: lock the clustered index record
before fetching BLOBs */
row_upd_index_replace_new_col_vals(entry, index, row_upd_index_replace_new_col_vals(entry, index,
node->update, node->update,
NULL, heap); NULL, heap);
......
...@@ -868,7 +868,10 @@ given. */ ...@@ -868,7 +868,10 @@ given. */
void void
row_upd_index_replace_new_col_vals_index_pos( row_upd_index_replace_new_col_vals_index_pos(
/*=========================================*/ /*=========================================*/
dtuple_t* entry, /* in/out: index entry where replaced */ dtuple_t* entry, /* in/out: index entry where replaced;
the clustered index record must be
covered by a lock or a page latch to
prevent deletion (rollback or purge) */
dict_index_t* index, /* in: index; NOTE that this may also be a dict_index_t* index, /* in: index; NOTE that this may also be a
non-clustered index */ non-clustered index */
const upd_t* update, /* in: an update vector built for the index so const upd_t* update, /* in: an update vector built for the index so
...@@ -986,7 +989,10 @@ given. */ ...@@ -986,7 +989,10 @@ given. */
void void
row_upd_index_replace_new_col_vals( row_upd_index_replace_new_col_vals(
/*===============================*/ /*===============================*/
dtuple_t* entry, /* in/out: index entry where replaced */ dtuple_t* entry, /* in/out: index entry where replaced;
the clustered index record must be
covered by a lock or a page latch to
prevent deletion (rollback or purge) */
dict_index_t* index, /* in: index; NOTE that this may also be a dict_index_t* index, /* in: index; NOTE that this may also be a
non-clustered index */ non-clustered index */
const upd_t* update, /* in: an update vector built for the const upd_t* update, /* in: an update vector built for the
...@@ -1440,6 +1446,7 @@ row_upd_sec_index_entry( ...@@ -1440,6 +1446,7 @@ row_upd_sec_index_entry(
} }
/* Build a new index entry */ /* Build a new index entry */
/* TODO: lock the clustered index record before fetching BLOBs */
row_upd_index_replace_new_col_vals(entry, index, node->update, row_upd_index_replace_new_col_vals(entry, index, node->update,
NULL, heap); NULL, heap);
...@@ -1562,6 +1569,7 @@ row_upd_clust_rec_by_insert( ...@@ -1562,6 +1569,7 @@ row_upd_clust_rec_by_insert(
entry = row_build_index_entry(node->row, node->ext, index, heap); entry = row_build_index_entry(node->row, node->ext, index, heap);
ut_a(entry); ut_a(entry);
/* TODO: lock the clustered index record before fetching BLOBs */
row_upd_index_replace_new_col_vals(entry, index, node->update, row_upd_index_replace_new_col_vals(entry, index, node->update,
NULL, heap); NULL, heap);
......
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