summaryrefslogtreecommitdiff
path: root/innobase/row
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-08-29 19:42:23 +0300
committerunknown <heikki@donna.mysql.fi>2001-08-29 19:42:23 +0300
commitdd9fa926b390d59a13f4d2a8e2fef6d653372651 (patch)
tree9d78d40bd578ed463aac576cc0fbd077bbe9cd20 /innobase/row
parentfc6696de0357612a35a968b824cbcd1819af4fa4 (diff)
downloadmariadb-git-dd9fa926b390d59a13f4d2a8e2fef6d653372651.tar.gz
trx0roll.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints
trx0sys.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints trx0trx.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0mysql.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0purge.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0sel.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0uins.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0umod.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints row0upd.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints srv0srv.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints srv0start.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints sync0arr.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints fil0fil.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints ibuf0ibuf.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints lock0lock.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints os0file.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0btr.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0cur.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0sea.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints buf0buf.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints data0data.c Fix the primary key update + BLOB bug, improve InnoDB Monitor prints srv0srv.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints trx0sys.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints trx0trx.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints btr0cur.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints buf0buf.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints data0data.h Fix the primary key update + BLOB bug, improve InnoDB Monitor prints ha_innobase.cc Fix the auto-inc+REPLACE+replication bug, improve InnoDB Monitor prints sql/ha_innobase.cc: Fix the auto-inc+REPLACE+replication bug, improve InnoDB Monitor prints innobase/include/btr0cur.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/buf0buf.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/data0data.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/srv0srv.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/trx0sys.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/include/trx0trx.h: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/btr/btr0btr.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/btr/btr0cur.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/btr/btr0sea.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/buf/buf0buf.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/data/data0data.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/fil/fil0fil.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/ibuf/ibuf0ibuf.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/lock/lock0lock.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/os/os0file.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0mysql.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0purge.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0sel.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0uins.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0umod.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/row/row0upd.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/srv/srv0srv.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/srv/srv0start.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/sync/sync0arr.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/trx/trx0roll.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/trx/trx0sys.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints innobase/trx/trx0trx.c: Fix the primary key update + BLOB bug, improve InnoDB Monitor prints
Diffstat (limited to 'innobase/row')
-rw-r--r--innobase/row/row0mysql.c97
-rw-r--r--innobase/row/row0purge.c8
-rw-r--r--innobase/row/row0sel.c21
-rw-r--r--innobase/row/row0uins.c4
-rw-r--r--innobase/row/row0umod.c33
-rw-r--r--innobase/row/row0upd.c79
6 files changed, 182 insertions, 60 deletions
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 9bbc45a5c9a..373ee4ac4bd 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -462,6 +462,8 @@ row_insert_for_mysql(
ut_ad(trx);
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
+ trx->op_info = "inserting";
+
if (node == NULL) {
row_get_prebuilt_insert_row(prebuilt);
node = prebuilt->ins_node;
@@ -499,6 +501,8 @@ run_again:
goto run_again;
}
+ trx->op_info = "";
+
return(err);
}
@@ -506,12 +510,15 @@ run_again:
prebuilt->table->stat_n_rows++;
+ srv_n_rows_inserted++;
+
if (prebuilt->table->stat_n_rows == 0) {
/* Avoid wrap-over */
prebuilt->table->stat_n_rows--;
}
row_update_statistics_if_needed(prebuilt);
+ trx->op_info = "";
return((int) err);
}
@@ -627,6 +634,8 @@ row_update_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
UT_NOT_USED(mysql_rec);
+ trx->op_info = "updating or deleting";
+
node = prebuilt->upd_node;
clust_index = dict_table_get_first_index(table);
@@ -700,6 +709,7 @@ run_again:
if (err == DB_RECORD_NOT_FOUND) {
trx->error_state = DB_SUCCESS;
+ trx->op_info = "";
return((int) err);
}
@@ -710,6 +720,8 @@ run_again:
goto run_again;
}
+ trx->op_info = "";
+
return(err);
}
@@ -719,10 +731,16 @@ run_again:
if (prebuilt->table->stat_n_rows > 0) {
prebuilt->table->stat_n_rows--;
}
- }
+
+ srv_n_rows_deleted++;
+ } else {
+ srv_n_rows_updated++;
+ }
row_update_statistics_if_needed(prebuilt);
+ trx->op_info = "";
+
return((int) err);
}
@@ -798,6 +816,8 @@ row_create_table_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
+ trx->op_info = "creating table";
+
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
@@ -825,16 +845,22 @@ row_create_table_for_mysql(
trx_general_rollback_for_mysql(trx, FALSE, NULL);
if (err == DB_OUT_OF_FILE_SPACE) {
- row_drop_table_for_mysql(table->name, trx, TRUE);
+ row_drop_table_for_mysql(table->name, trx, TRUE);
} else {
- assert(err == DB_DUPLICATE_KEY);
- fprintf(stderr,
+ assert(err == DB_DUPLICATE_KEY);
+ fprintf(stderr,
"InnoDB: Error: table %s already exists in InnoDB internal\n"
"InnoDB: data dictionary. Have you deleted the .frm file\n"
"InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n"
- "InnoDB: for InnoDB tables in MySQL version <= 3.23.39?\n"
+ "InnoDB: for InnoDB tables in MySQL version <= 3.23.42?\n"
"InnoDB: See the Restrictions section of the InnoDB manual.\n",
table->name);
+ fprintf(stderr,
+ "InnoDB: You can drop the orphaned table inside InnoDB by\n"
+ "InnoDB: creating an InnoDB table with the same name in another\n"
+ "InnoDB: database and moving the .frm file to the current database.\n"
+ "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
+ "InnoDB: succeed.\n");
}
trx->error_state = DB_SUCCESS;
@@ -852,11 +878,32 @@ row_create_table_for_mysql(
srv_print_innodb_monitor = TRUE;
}
+
+ keywordlen = ut_strlen("innodb_lock_monitor");
+
+ if (namelen >= keywordlen
+ && 0 == ut_memcmp(table->name + namelen - keywordlen,
+ "innodb_lock_monitor", keywordlen)) {
+
+ srv_print_innodb_monitor = TRUE;
+ srv_print_innodb_lock_monitor = TRUE;
+ }
+
+ keywordlen = ut_strlen("innodb_tablespace_monitor");
+
+ if (namelen >= keywordlen
+ && 0 == ut_memcmp(table->name + namelen - keywordlen,
+ "innodb_tablespace_monitor", keywordlen)) {
+
+ srv_print_innodb_tablespace_monitor = TRUE;
+ }
}
mutex_exit(&(dict_sys->mutex));
que_graph_free((que_t*) que_node_get_parent(thr));
-
+
+ trx->op_info = "";
+
return((int) err);
}
@@ -879,6 +926,8 @@ row_create_index_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
+ trx->op_info = "creating index";
+
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */
@@ -915,6 +964,8 @@ row_create_index_for_mysql(
que_graph_free((que_t*) que_node_get_parent(thr));
+ trx->op_info = "";
+
return((int) err);
}
@@ -945,7 +996,9 @@ row_drop_table_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_a(name != NULL);
-
+
+ trx->op_info = "dropping table";
+
namelen = ut_strlen(name);
keywordlen = ut_strlen("innodb_monitor");
@@ -957,6 +1010,26 @@ row_drop_table_for_mysql(
stop monitor prints */
srv_print_innodb_monitor = FALSE;
+ srv_print_innodb_lock_monitor = FALSE;
+ }
+
+ keywordlen = ut_strlen("innodb_lock_monitor");
+
+ if (namelen >= keywordlen
+ && 0 == ut_memcmp(name + namelen - keywordlen,
+ "innodb_lock_monitor", keywordlen)) {
+
+ srv_print_innodb_monitor = FALSE;
+ srv_print_innodb_lock_monitor = FALSE;
+ }
+
+ keywordlen = ut_strlen("innodb_tablespace_monitor");
+
+ if (namelen >= keywordlen
+ && 0 == ut_memcmp(name + namelen - keywordlen,
+ "innodb_tablespace_monitor", keywordlen)) {
+
+ srv_print_innodb_tablespace_monitor = FALSE;
}
/* We use the private SQL parser of Innobase to generate the
@@ -1071,6 +1144,8 @@ funct_exit:
que_graph_free(graph);
+ trx->op_info = "";
+
return((int) err);
}
@@ -1099,6 +1174,8 @@ row_rename_table_for_mysql(
ut_a(old_name != NULL);
ut_a(new_name != NULL);
+ trx->op_info = "renaming table";
+
str1 =
"PROCEDURE RENAME_TABLE_PROC () IS\n"
"BEGIN\n"
@@ -1168,6 +1245,8 @@ funct_exit:
que_graph_free(graph);
+ trx->op_info = "";
+
return((int) err);
}
@@ -1279,6 +1358,8 @@ row_check_table_for_mysql(
ulint n_rows;
ulint n_rows_in_table;
ulint ret = DB_SUCCESS;
+
+ prebuilt->trx->op_info = "checking table";
index = dict_table_get_first_index(table);
@@ -1311,5 +1392,7 @@ row_check_table_for_mysql(
index = dict_table_get_next_index(index);
}
+ prebuilt->trx->op_info = "";
+
return(ret);
}
diff --git a/innobase/row/row0purge.c b/innobase/row/row0purge.c
index ec880d3fe04..43bc166347a 100644
--- a/innobase/row/row0purge.c
+++ b/innobase/row/row0purge.c
@@ -132,7 +132,7 @@ row_purge_remove_clust_if_poss_low(
success = btr_cur_optimistic_delete(btr_cur, &mtr);
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, &mtr);
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur, FALSE, &mtr);
if (err == DB_SUCCESS) {
success = TRUE;
@@ -254,8 +254,8 @@ row_purge_remove_sec_if_poss_low(
success = btr_cur_optimistic_delete(btr_cur, &mtr);
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, &mtr);
-
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
+ FALSE, &mtr);
if (err == DB_SUCCESS) {
success = TRUE;
} else if (err == DB_OUT_OF_FILE_SPACE) {
@@ -437,7 +437,7 @@ skip_secondaries:
data_field_len = ufield->new_val.len;
btr_free_externally_stored_field(index, data_field,
- data_field_len, &mtr);
+ data_field_len, FALSE, &mtr);
mtr_commit(&mtr);
}
}
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 0ad6b7084e2..d041e34a558 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2488,6 +2488,8 @@ row_search_for_mysql(
printf("N tables locked %lu\n", trx->mysql_n_tables_locked);
*/
if (direction == 0) {
+ trx->op_info = "starting index read";
+
prebuilt->n_rows_fetched = 0;
prebuilt->n_fetch_cached = 0;
prebuilt->fetch_cache_first = 0;
@@ -2497,6 +2499,8 @@ row_search_for_mysql(
row_prebuild_sel_graph(prebuilt);
}
} else {
+ trx->op_info = "fetching rows";
+
if (prebuilt->n_rows_fetched == 0) {
prebuilt->fetch_direction = direction;
}
@@ -2519,6 +2523,9 @@ row_search_for_mysql(
prebuilt->n_rows_fetched++;
+ srv_n_rows_read++;
+ trx->op_info = "";
+
return(DB_SUCCESS);
}
@@ -2529,6 +2536,7 @@ row_search_for_mysql(
cache, but the cache was not full at the time of the
popping: no more rows can exist in the result set */
+ trx->op_info = "";
return(DB_RECORD_NOT_FOUND);
}
@@ -2560,6 +2568,7 @@ row_search_for_mysql(
/* printf("%s record not found 1\n", index->name); */
+ trx->op_info = "";
return(DB_RECORD_NOT_FOUND);
}
@@ -2599,6 +2608,9 @@ row_search_for_mysql(
/* printf("%s shortcut\n", index->name); */
+ srv_n_rows_read++;
+
+ trx->op_info = "";
return(DB_SUCCESS);
} else if (shortcut == SEL_EXHAUSTED) {
@@ -2607,6 +2619,7 @@ row_search_for_mysql(
/* printf("%s record not found 2\n",
index->name); */
+ trx->op_info = "";
return(DB_RECORD_NOT_FOUND);
}
@@ -2980,6 +2993,8 @@ lock_wait_or_error:
/* printf("Using index %s cnt %lu ret value %lu err\n", index->name,
cnt, err); */
+ trx->op_info = "";
+
return(err);
normal_return:
@@ -2995,5 +3010,11 @@ normal_return:
/* printf("Using index %s cnt %lu ret value %lu\n", index->name,
cnt, err); */
+ if (ret == DB_SUCCESS) {
+ srv_n_rows_read++;
+ }
+
+ trx->op_info = "";
+
return(ret);
}
diff --git a/innobase/row/row0uins.c b/innobase/row/row0uins.c
index 47807877779..27d1fbcb9ba 100644
--- a/innobase/row/row0uins.c
+++ b/innobase/row/row0uins.c
@@ -89,7 +89,7 @@ retry:
&(node->pcur), &mtr);
ut_a(success);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, &mtr);
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur, TRUE, &mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@@ -174,7 +174,7 @@ row_undo_ins_remove_sec_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, &mtr);
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur, TRUE, &mtr);
}
btr_pcur_close(&pcur);
diff --git a/innobase/row/row0umod.c b/innobase/row/row0umod.c
index 0221c51b985..a7c8957d61a 100644
--- a/innobase/row/row0umod.c
+++ b/innobase/row/row0umod.c
@@ -179,7 +179,11 @@ row_undo_mod_remove_clust_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, mtr);
+ /* Note that since this operation is analogous to purge,
+ we can free also inherited externally stored fields:
+ hence the last FALSE in the call below */
+
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur, FALSE, mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@@ -356,7 +360,8 @@ row_undo_mod_del_mark_or_remove_sec_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- btr_cur_pessimistic_delete(&err, FALSE, btr_cur, &mtr);
+ btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
+ TRUE, &mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@@ -423,22 +428,22 @@ row_undo_mod_del_unmark_sec(
found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur,
&mtr);
if (!found) {
- err_buf = mem_alloc(1000);
- dtuple_sprintf(err_buf, 900, entry);
-
- fprintf(stderr, "InnoDB: error in sec index entry del undo in\n"
- "InnoDB: index %s table %s\n", index->name,
- index->table->name);
- fprintf(stderr, "InnoDB: tuple %s\n", err_buf);
+ err_buf = mem_alloc(1000);
+ dtuple_sprintf(err_buf, 900, entry);
- rec_sprintf(err_buf, 900, btr_pcur_get_rec(&pcur));
- fprintf(stderr, "InnoDB: record %s\n", err_buf);
+ fprintf(stderr, "InnoDB: error in sec index entry del undo in\n"
+ "InnoDB: index %s table %s\n", index->name,
+ index->table->name);
+ fprintf(stderr, "InnoDB: tuple %s\n", err_buf);
- fprintf(stderr, "InnoDB: Make a detailed bug report and send it\n");
- fprintf(stderr, "InnoDB: to mysql@lists.mysql.com\n");
+ rec_sprintf(err_buf, 900, btr_pcur_get_rec(&pcur));
+ fprintf(stderr, "InnoDB: record %s\n", err_buf);
- mem_free(err_buf);
+ fprintf(stderr,
+ "InnoDB: Make a detailed bug report and send it\n");
+ fprintf(stderr, "InnoDB: to mysql@lists.mysql.com\n");
+ mem_free(err_buf);
} else {
btr_cur = btr_pcur_get_btr_cur(&pcur);
diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c
index 67a5925a3f5..3fa98db3a02 100644
--- a/innobase/row/row0upd.c
+++ b/innobase/row/row0upd.c
@@ -840,32 +840,31 @@ row_upd_sec_index_entry(
rec = btr_cur_get_rec(btr_cur);
if (!found) {
+ err_buf = mem_alloc(1000);
+ dtuple_sprintf(err_buf, 900, entry);
- err_buf = mem_alloc(1000);
- dtuple_sprintf(err_buf, 900, entry);
+ fprintf(stderr, "InnoDB: error in sec index entry update in\n"
+ "InnoDB: index %s table %s\n", index->name,
+ index->table->name);
+ fprintf(stderr, "InnoDB: tuple %s\n", err_buf);
- fprintf(stderr, "InnoDB: error in sec index entry update in\n"
- "InnoDB: index %s table %s\n", index->name,
- index->table->name);
- fprintf(stderr, "InnoDB: tuple %s\n", err_buf);
+ rec_sprintf(err_buf, 900, rec);
+ fprintf(stderr, "InnoDB: record %s\n", err_buf);
- rec_sprintf(err_buf, 900, rec);
- fprintf(stderr, "InnoDB: record %s\n", err_buf);
+ fprintf(stderr,
+ "InnoDB: Make a detailed bug report and send it\n");
+ fprintf(stderr, "InnoDB: to mysql@lists.mysql.com\n");
- fprintf(stderr, "InnoDB: Make a detailed bug report and send it\n");
- fprintf(stderr, "InnoDB: to mysql@lists.mysql.com\n");
-
- mem_free(err_buf);
+ mem_free(err_buf);
} else {
-
- /* Delete mark the old index record; it can already be
- delete marked if we return after a lock wait in
- row_ins_index_entry below */
-
- if (!rec_get_deleted_flag(rec)) {
- err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE, thr,
- &mtr);
- }
+ /* Delete mark the old index record; it can already be
+ delete marked if we return after a lock wait in
+ row_ins_index_entry below */
+
+ if (!rec_get_deleted_flag(rec)) {
+ err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE,
+ thr, &mtr);
+ }
}
btr_pcur_close(&pcur);
@@ -907,7 +906,7 @@ row_upd_sec_step(
|| (node->state == UPD_NODE_UPDATE_SOME_SEC));
ut_ad(!(node->index->type & DICT_CLUSTERED));
- if ((node->state == UPD_NODE_UPDATE_ALL_SEC)
+ if (node->state == UPD_NODE_UPDATE_ALL_SEC
|| row_upd_changes_ord_field(node->row, node->index,
node->update)) {
err = row_upd_sec_index_entry(node, thr);
@@ -933,15 +932,13 @@ row_upd_clust_rec_by_insert(
dict_index_t* index, /* in: clustered index of the record */
que_thr_t* thr, /* in: query thread */
mtr_t* mtr) /* in: mtr; gets committed here */
-{
+{
+ mem_heap_t* heap;
btr_pcur_t* pcur;
btr_cur_t* btr_cur;
trx_t* trx;
dict_table_t* table;
- mem_heap_t* heap;
dtuple_t* entry;
- ulint* ext_vec;
- ulint n_ext_vec;
ulint err;
ut_ad(node);
@@ -961,17 +958,20 @@ row_upd_clust_rec_by_insert(
return(err);
}
+ /* Mark as not-owned the externally stored fields which the new
+ row inherits from the delete marked record: purge should not
+ free those externally stored fields even if the delete marked
+ record is removed from the index tree, or updated. */
+
+ btr_cur_mark_extern_inherited_fields(btr_cur_get_rec(btr_cur),
+ node->update, mtr);
}
mtr_commit(mtr);
node->state = UPD_NODE_INSERT_CLUSTERED;
- heap = mem_heap_create(1024);
-
- ext_vec = mem_heap_alloc(heap,
- sizeof(ulint) * dtuple_get_n_fields(node->row));
- n_ext_vec = 0;
+ heap = mem_heap_create(500);
entry = row_build_index_entry(node->row, index, heap);
@@ -979,10 +979,23 @@ row_upd_clust_rec_by_insert(
row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
+ /* If we return from a lock wait, for example, we may have
+ extern fields marked as not-owned in entry (marked if the
+ if-branch above). We must unmark them. */
+
+ btr_cur_unmark_dtuple_extern_fields(entry, node->ext_vec,
+ node->n_ext_vec);
+ /* We must mark non-updated extern fields in entry as inherited,
+ so that a possible rollback will not free them */
+
+ btr_cur_mark_dtuple_inherited_extern(entry, node->ext_vec,
+ node->n_ext_vec,
+ node->update);
+
err = row_ins_index_entry(index, entry, node->ext_vec,
node->n_ext_vec, thr);
- mem_heap_free(heap);
-
+ mem_heap_free(heap);
+
return(err);
}