diff options
Diffstat (limited to 'innobase/btr/btr0cur.c')
-rw-r--r-- | innobase/btr/btr0cur.c | 88 |
1 files changed, 41 insertions, 47 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c index c7863ba08e4..8974200efe8 100644 --- a/innobase/btr/btr0cur.c +++ b/innobase/btr/btr0cur.c @@ -831,6 +831,24 @@ btr_cur_ins_lock_and_undo( } /***************************************************************** +Report information about a transaction. */ +static +void +btr_cur_trx_report( +/*===============*/ + const trx_t* trx, /* in: transaction */ + const dict_index_t* index, /* in: index */ + const char* op) /* in: operation */ +{ + fprintf(stderr, "Trx with id %lu %lu going to ", + ut_dulint_get_high(trx->id), + ut_dulint_get_low(trx->id)); + fputs(op, stderr); + dict_index_name_print(stderr, index); + putc('\n', stderr); +} + +/***************************************************************** Tries to perform an insert to a page in an index tree, next to cursor. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too little space on the page. If there is just @@ -877,18 +895,13 @@ btr_cur_optimistic_insert( index = cursor->index; if (!dtuple_check_typed_no_assert(entry)) { - fprintf(stderr, -"InnoDB: Error in a tuple to insert into table %s index %s\n", - index->table_name, index->name); + fputs("InnoDB: Error in a tuple to insert into ", stderr); + dict_index_name_print(stderr, index); } if (btr_cur_print_record_ops && thr) { - printf( - "Trx with id %lu %lu going to insert to table %s index %s\n", - ut_dulint_get_high(thr_get_trx(thr)->id), - ut_dulint_get_low(thr_get_trx(thr)->id), - index->table_name, index->name); - dtuple_print(entry); + btr_cur_trx_report(thr_get_trx(thr), index, "insert into "); + dtuple_print(stderr, entry); } ut_ad(mtr_memo_contains(mtr, buf_block_align(page), @@ -981,20 +994,15 @@ calculate_sizes_again: *rec = page_cur_tuple_insert(page_cursor, entry, mtr); - if (!(*rec)) { - char* err_buf = mem_alloc(1000); - - dtuple_sprintf(err_buf, 900, entry); - - fprintf(stderr, - "InnoDB: Error: cannot insert tuple %s to index %s of table %s\n" - "InnoDB: max insert size %lu\n", - err_buf, index->name, index->table->name, max_size); - - mem_free(err_buf); + if (!*rec) { + fputs("InnoDB: Error: cannot insert tuple ", stderr); + dtuple_print(stderr, entry); + fputs(" into ", stderr); + dict_index_name_print(stderr, index); + fprintf(stderr, "\nInnoDB: max insert size %lu\n", + max_size); + ut_error; } - - ut_a(*rec); /* <- We calculated above the record would fit */ } #ifdef BTR_CUR_HASH_ADAPT @@ -1010,7 +1018,8 @@ calculate_sizes_again: lock_update_insert(*rec); } -/* printf("Insert to page %lu, max ins size %lu, rec %lu ind type %lu\n", +/* fprintf(stderr, "Insert into page %lu, max ins size %lu," + " rec %lu ind type %lu\n", buf_frame_get_page_no(page), max_size, rec_size + PAGE_DIR_SLOT_SIZE, type); */ @@ -1361,12 +1370,8 @@ btr_cur_update_in_place( trx = thr_get_trx(thr); if (btr_cur_print_record_ops && thr) { - printf( - "Trx with id %lu %lu going to update table %s index %s\n", - ut_dulint_get_high(thr_get_trx(thr)->id), - ut_dulint_get_low(thr_get_trx(thr)->id), - index->table_name, index->name); - rec_print(rec); + btr_cur_trx_report(trx, index, "update "); + rec_print(stderr, rec); } /* Do lock checking and undo logging */ @@ -1465,12 +1470,8 @@ btr_cur_optimistic_update( index = cursor->index; if (btr_cur_print_record_ops && thr) { - printf( - "Trx with id %lu %lu going to update table %s index %s\n", - ut_dulint_get_high(thr_get_trx(thr)->id), - ut_dulint_get_low(thr_get_trx(thr)->id), - index->table_name, index->name); - rec_print(rec); + btr_cur_trx_report(thr_get_trx(thr), index, "update "); + rec_print(stderr, rec); } ut_ad(mtr_memo_contains(mtr, buf_block_align(page), @@ -2012,12 +2013,8 @@ btr_cur_del_mark_set_clust_rec( index = cursor->index; if (btr_cur_print_record_ops && thr) { - printf( - "Trx with id %lu %lu going to del mark table %s index %s\n", - ut_dulint_get_high(thr_get_trx(thr)->id), - ut_dulint_get_low(thr_get_trx(thr)->id), - index->table_name, index->name); - rec_print(rec); + btr_cur_trx_report(thr_get_trx(thr), index, "del mark "); + rec_print(stderr, rec); } ut_ad(index->type & DICT_CLUSTERED); @@ -2152,12 +2149,9 @@ btr_cur_del_mark_set_sec_rec( rec = btr_cur_get_rec(cursor); if (btr_cur_print_record_ops && thr) { - printf( - "Trx with id %lu %lu going to del mark table %s index %s\n", - ut_dulint_get_high(thr_get_trx(thr)->id), - ut_dulint_get_low(thr_get_trx(thr)->id), - cursor->index->table_name, cursor->index->name); - rec_print(rec); + btr_cur_trx_report(thr_get_trx(thr), cursor->index, + "del mark "); + rec_print(stderr, rec); } err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index, |