summaryrefslogtreecommitdiff
path: root/innobase/trx/trx0undo.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-03-16 22:41:30 +0200
committerunknown <monty@mysql.com>2004-03-16 22:41:30 +0200
commita8aacf87648f64e7489220dab7d8729c5c01e13d (patch)
treeaf285d8080c003d1ecb1479ec43c9b6996fd567f /innobase/trx/trx0undo.c
parent17f8d3d725f4b465a8a0dc8e96b04cd973c47fd5 (diff)
parent277cf702da7e6f0642742eb10582cfc382e537ec (diff)
downloadmariadb-git-a8aacf87648f64e7489220dab7d8729c5c01e13d.tar.gz
merge with 4.0
BitKeeper/etc/logging_ok: auto-union VC++Files/innobase/innobase.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged acinclude.m4: Auto merged configure.in: Auto merged BitKeeper/deleted/.del-com0shm.c~6a16f0c3d81de1f: Auto merged BitKeeper/deleted/.del-mysql_fix_privilege_tables.sql: Auto merged extra/replace.c: Auto merged include/my_sys.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/btr/btr0sea.c: Auto merged innobase/configure.in: Auto merged innobase/data/data0data.c: Auto merged innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/ha/ha0ha.c: Auto merged innobase/ha/hash0hash.c: Auto merged innobase/include/btr0btr.ic: Auto merged innobase/include/data0type.ic: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/log0log.ic: Auto merged innobase/include/mach0data.ic: Auto merged innobase/include/mtr0log.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/row0upd.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0rseg.ic: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0recv.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/mtr/mtr0log.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0file.c: Auto merged innobase/page/page0cur.c: Auto merged innobase/page/page0page.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/read/read0read.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/rem/rem0rec.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/row/row0undo.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/thr/thr0loc.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0rec.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/trx/trx0undo.c: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/rpl_error_ignored_table.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysys/mf_iocache.c: Auto merged mysys/mf_pack.c: Auto merged mysys/my_getopt.c: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sql_cache.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged tests/thread_test.c: Auto merged client/mysqldump.c: Keep original indentation mysql-test/r/merge.result: keep old file scripts/mysql_fix_privilege_tables.sh: Keep old structure in merge with 4.0 sql/table.cc: merge with 4.0 + simple optimizations
Diffstat (limited to 'innobase/trx/trx0undo.c')
-rw-r--r--innobase/trx/trx0undo.c61
1 files changed, 43 insertions, 18 deletions
diff --git a/innobase/trx/trx0undo.c b/innobase/trx/trx0undo.c
index f3f93734a49..f2b7227d84a 100644
--- a/innobase/trx/trx0undo.c
+++ b/innobase/trx/trx0undo.c
@@ -391,7 +391,9 @@ trx_undo_seg_create(
ibool success;
ut_ad(mtr && id && rseg_hdr);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
/*
if (type == TRX_UNDO_INSERT) {
printf("Creating insert undo log segment\n");
@@ -431,7 +433,9 @@ trx_undo_seg_create(
return(NULL);
}
+#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE);
+#endif /* UNIV_SYNC_DEBUG */
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
@@ -737,13 +741,14 @@ trx_undo_add_page(
ulint n_reserved;
ibool success;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(!mutex_own(&kernel_mutex));
+ ut_ad(mutex_own(&(trx->rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
- ut_ad(mutex_own(&(rseg->mutex)));
-
if (rseg->curr_size == rseg->max_size) {
return(FIL_NULL);
@@ -813,8 +818,10 @@ trx_undo_free_page(
UT_NOT_USED(hdr_offset);
ut_a(hdr_page_no != page_no);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get(space, page_no, mtr);
@@ -861,7 +868,9 @@ trx_undo_free_page_in_rollback(
ulint last_page_no;
ut_ad(undo->hdr_page_no != page_no);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
last_page_no = trx_undo_free_page(undo->rseg, FALSE, undo->space,
undo->hdr_page_no, undo->hdr_offset,
@@ -915,12 +924,13 @@ trx_undo_truncate_end(
trx_rseg_t* rseg;
mtr_t mtr;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
+ ut_ad(mutex_own(&(trx->rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
- ut_ad(mutex_own(&(rseg->mutex)));
-
for (;;) {
mtr_start(&mtr);
@@ -994,7 +1004,9 @@ trx_undo_truncate_start(
ulint page_no;
mtr_t mtr;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
if (0 == ut_dulint_cmp(limit, ut_dulint_zero)) {
@@ -1060,8 +1072,9 @@ trx_undo_seg_free(
while (!finished) {
mtr_start(&mtr);
-
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
seg_header = trx_undo_page_get(undo->space, undo->hdr_page_no,
@@ -1117,7 +1130,7 @@ trx_undo_mem_create_at_db_start(
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: undo->id is %lu\n", (ulong) id);
- ut_a(0);
+ ut_error;
}
undo_page = trx_undo_page_get(rseg->space, page_no, mtr);
@@ -1134,8 +1147,7 @@ trx_undo_mem_create_at_db_start(
undo_header = undo_page + offset;
- trx_id = mtr_read_dulint(undo_header + TRX_UNDO_TRX_ID, MLOG_8BYTES,
- mtr);
+ trx_id = mtr_read_dulint(undo_header + TRX_UNDO_TRX_ID, mtr);
mutex_enter(&(rseg->mutex));
undo = trx_undo_mem_create(rseg, id, type, trx_id, page_no, offset);
@@ -1145,8 +1157,7 @@ trx_undo_mem_create_at_db_start(
undo->dict_operation = mtr_read_ulint(
undo_header + TRX_UNDO_DICT_OPERATION,
MLOG_2BYTES, mtr);
- undo->table_id = mtr_read_dulint(undo_header + TRX_UNDO_TABLE_ID,
- MLOG_8BYTES, mtr);
+ undo->table_id = mtr_read_dulint(undo_header + TRX_UNDO_TABLE_ID, mtr);
undo->state = state;
undo->size = flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr);
@@ -1270,12 +1281,14 @@ trx_undo_mem_create(
{
trx_undo_t* undo;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: undo->id is %lu\n", (ulong) id);
- ut_a(0);
+ ut_error;
}
undo = mem_alloc(sizeof(trx_undo_t));
@@ -1314,14 +1327,16 @@ trx_undo_mem_init_for_reuse(
is created */
ulint offset) /* in: undo log header byte offset on page */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&((undo->rseg)->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
- ut_a(0);
+ ut_error;
}
undo->state = TRX_UNDO_ACTIVE;
@@ -1345,7 +1360,7 @@ trx_undo_mem_free(
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
"InnoDB: Error: undo->id is %lu\n", (ulong) undo->id);
- ut_a(0);
+ ut_error;
}
mem_free(undo);
@@ -1373,7 +1388,9 @@ trx_undo_create(
trx_undo_t* undo;
page_t* undo_page;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
if (rseg->curr_size == rseg->max_size) {
@@ -1424,7 +1441,9 @@ trx_undo_reuse_cached(
page_t* undo_page;
ulint offset;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
if (type == TRX_UNDO_INSERT) {
@@ -1448,13 +1467,12 @@ trx_undo_reuse_cached(
}
ut_ad(undo->size == 1);
- ut_ad(undo->hdr_page_no == undo->top_page_no);
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
- ut_a(0);
+ ut_error;
}
undo_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr);
@@ -1495,7 +1513,7 @@ trx_undo_mark_as_dict_operation(
trx->dict_operation, MLOG_2BYTES, mtr);
mlog_write_dulint(hdr_page + undo->hdr_offset + TRX_UNDO_TABLE_ID,
- trx->table_id, MLOG_8BYTES, mtr);
+ trx->table_id, mtr);
undo->dict_operation = trx->dict_operation;
undo->table_id = trx->table_id;
@@ -1522,11 +1540,15 @@ trx_undo_assign_undo(
rseg = trx->rseg;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
+#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
undo = trx_undo_reuse_cached(rseg, type, trx->id, &mtr);
@@ -1587,7 +1609,7 @@ trx_undo_set_state_at_finish(
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
- ut_a(0);
+ ut_error;
}
undo_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr);
@@ -1632,8 +1654,9 @@ trx_undo_update_cleanup(
undo = trx->update_undo;
rseg = trx->rseg;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-
+#endif /* UNIV_SYNC_DEBUG */
trx_purge_add_update_undo_to_history(trx, undo_page, mtr);
UT_LIST_REMOVE(undo_list, rseg->update_undo_list, undo);
@@ -1672,8 +1695,10 @@ trx_undo_update_cleanup_by_discard(
undo = trx->update_undo;
rseg = trx->rseg;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
ut_ad(mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(undo->size == 1);
ut_ad(undo->del_marks == FALSE);
ut_ad(UT_LIST_GET_LEN(trx_sys->view_list) == 1);