235
234
ut_ad(type == TRX_UNDO_INSERT_REC);
236
235
node->rec_type = type;
239
237
node->table = dict_table_get_on_id(table_id, node->trx);
241
/* Skip the UNDO if we can't find the table or the .ibd file. */
242
if (UNIV_UNLIKELY(node->table == NULL)) {
243
} else if (UNIV_UNLIKELY(node->table->ibd_file_missing)) {
239
if (node->table == NULL) {
244
if (node->table->ibd_file_missing) {
245
/* We skip undo operations to missing .ibd files */
244
246
node->table = NULL;
246
clust_index = dict_table_get_first_index(node->table);
248
ptr = trx_undo_rec_get_row_ref(
249
ptr, clust_index, &node->ref, node->heap);
251
clust_index = dict_table_get_first_index(node->table);
253
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
253
257
/***************************************************************
254
258
Undoes a fresh insert of a row to a table. A fresh insert means that
255
259
the same clustered index unique key did not have any record, even delete
256
260
marked, at the time of the insert. */
261
265
/* out: DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
262
266
undo_node_t* node) /* in: row undo node */
265
273
ut_ad(node->state == UNDO_NODE_INSERT);
267
275
row_undo_ins_parse_undo_rec(node);
269
if (!node->table || !row_undo_search_clust_to_pcur(node)) {
277
if (node->table == NULL) {
280
found = row_undo_search_clust_to_pcur(node);
270
284
trx_undo_rec_release(node->trx, node->undo_no);
272
286
return(DB_SUCCESS);
275
/* Iterate over all the indexes and undo the insert.*/
277
/* Skip the clustered index (the first index) */
278
289
node->index = dict_table_get_next_index(
279
290
dict_table_get_first_index(node->table));
281
292
while (node->index != NULL) {
285
entry = row_build_index_entry(node->row, node->ext,
286
node->index, node->heap);
293
entry = row_build_index_entry(node->row, node->index,
288
295
err = row_undo_ins_remove_sec(node->index, entry);
290
297
if (err != DB_SUCCESS) {