Merge mysql-5.1-innodb -> mysql-5.1-bugteam

This commit is contained in:
Vasil Dimov 2010-10-01 15:39:44 +03:00
commit 1ca8c7b5ef
52 changed files with 458 additions and 227 deletions

View File

@ -0,0 +1,118 @@
DROP TABLE IF EXISTS bug_53756 ;
CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB;
ALTER TABLE bug_53756 ADD PRIMARY KEY (pk);
INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
# Select a less restrictive isolation level.
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
COMMIT;
# Start a transaction in the default connection for isolation.
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
SELECT * FROM bug_53756;
pk c1
1 11
2 22
3 33
4 44
# connection con1 deletes row 1
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
DELETE FROM bug_53756 WHERE pk=1;
# connection con2 deletes row 2
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
DELETE FROM bug_53756 WHERE pk=2;
# connection con3 updates row 3
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
UPDATE bug_53756 SET c1=77 WHERE pk=3;
# connection con4 updates row 4
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
UPDATE bug_53756 SET c1=88 WHERE pk=4;
# connection con5 inserts row 5
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
INSERT INTO bug_53756 VALUES(5, 55);
# connection con6 inserts row 6
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
INSERT INTO bug_53756 VALUES(6, 66);
# connection con1 commits.
COMMIT;
# connection con3 commits.
COMMIT;
# connection con4 rolls back.
ROLLBACK;
# connection con6 rolls back.
ROLLBACK;
# The connections 2 and 5 stay open.
# connection default selects resulting data.
# Delete of row 1 was committed.
# Update of row 3 was committed.
# Due to isolation level read committed, these should be included.
# All other changes should not be included.
SELECT * FROM bug_53756;
pk c1
2 22
3 77
4 44
# connection default
#
# Crash server.
START TRANSACTION;
INSERT INTO bug_53756 VALUES (666,666);
SET SESSION debug="+d,crash_commit_before";
COMMIT;
ERROR HY000: Lost connection to MySQL server during query
#
# disconnect con1, con2, con3, con4, con5, con6.
#
# Restart server.
#
# Select recovered data.
# Delete of row 1 was committed.
# Update of row 3 was committed.
# These should be included.
# All other changes should not be included.
# Delete of row 2 and insert of row 5 should be rolled back
SELECT * FROM bug_53756;
pk c1
2 22
3 77
4 44
# Clean up.
DROP TABLE bug_53756;

View File

@ -0,0 +1 @@
--skip-stack-trace --skip-core-file

View File

@ -0,0 +1,184 @@
# This is the test case for bug #53756. Alter table operation could
# leave a deleted record for the temp table (later renamed to the altered
# table) in the SYS_TABLES secondary index, we should ignore this row and
# find the first non-deleted row for the specified table_id when load table
# metadata in the function dict_load_table_on_id() during crash recovery.
#
# innobackup needs to connect to the server. Not supported in embedded.
--source include/not_embedded.inc
#
# This test case needs to crash the server. Needs a debug server.
--source include/have_debug.inc
#
# Don't test this under valgrind, memory leaks will occur.
--source include/not_valgrind.inc
#
# This test case needs InnoDB.
-- source include/have_innodb_plugin.inc
#
# Precautionary clean up.
#
--disable_warnings
DROP TABLE IF EXISTS bug_53756 ;
--enable_warnings
#
# Create test data.
#
CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB;
ALTER TABLE bug_53756 ADD PRIMARY KEY (pk);
INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
--echo
--echo # Select a less restrictive isolation level.
# Don't use user variables. They won't survive server crash.
--let $global_isolation= `SELECT @@global.tx_isolation`;
--let $session_isolation= `SELECT @@session.tx_isolation`;
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
COMMIT;
--echo
--echo # Start a transaction in the default connection for isolation.
START TRANSACTION;
SELECT @@tx_isolation;
SELECT * FROM bug_53756;
--echo
--echo # connection con1 deletes row 1
--connect (con1,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
DELETE FROM bug_53756 WHERE pk=1;
--echo
--echo # connection con2 deletes row 2
--connect (con2,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
DELETE FROM bug_53756 WHERE pk=2;
--echo
--echo # connection con3 updates row 3
--connect (con3,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
UPDATE bug_53756 SET c1=77 WHERE pk=3;
--echo
--echo # connection con4 updates row 4
--connect (con4,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
UPDATE bug_53756 SET c1=88 WHERE pk=4;
--echo
--echo # connection con5 inserts row 5
--connect (con5,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
INSERT INTO bug_53756 VALUES(5, 55);
--echo
--echo # connection con6 inserts row 6
--connect (con6,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
INSERT INTO bug_53756 VALUES(6, 66);
--echo
--echo # connection con1 commits.
--connection con1
COMMIT;
--echo
--echo # connection con3 commits.
--connection con3
COMMIT;
--echo
--echo # connection con4 rolls back.
--connection con4
ROLLBACK;
--echo
--echo # connection con6 rolls back.
--connection con6
ROLLBACK;
--echo
--echo # The connections 2 and 5 stay open.
--echo
--echo # connection default selects resulting data.
--echo # Delete of row 1 was committed.
--echo # Update of row 3 was committed.
--echo # Due to isolation level read committed, these should be included.
--echo # All other changes should not be included.
--connection default
SELECT * FROM bug_53756;
--echo
--echo # connection default
--connection default
--echo #
--echo # Crash server.
#
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#
START TRANSACTION;
INSERT INTO bug_53756 VALUES (666,666);
#
# Request a crash on next execution of commit.
SET SESSION debug="+d,crash_commit_before";
#
# Execute the statement that causes the crash.
--error 2013
COMMIT;
--echo
--echo #
--echo # disconnect con1, con2, con3, con4, con5, con6.
--disconnect con1
--disconnect con2
--disconnect con3
--disconnect con4
--disconnect con5
--disconnect con6
--echo #
--echo # Restart server.
#
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#
# Turn on reconnect
--enable_reconnect
#
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
#
# Turn off reconnect again
--disable_reconnect
--echo
--echo #
--echo # Select recovered data.
--echo # Delete of row 1 was committed.
--echo # Update of row 3 was committed.
--echo # These should be included.
--echo # All other changes should not be included.
--echo # Delete of row 2 and insert of row 5 should be rolled back
SELECT * FROM bug_53756;
--echo
--echo # Clean up.
DROP TABLE bug_53756;
--disable_query_log
eval SET GLOBAL tx_isolation= '$global_isolation';
eval SET SESSION tx_isolation= '$session_isolation';
--enable_query_log

View File

@ -2060,7 +2060,6 @@ btr_compress(
ulint n_recs; ulint n_recs;
ulint max_ins_size; ulint max_ins_size;
ulint max_ins_size_reorg; ulint max_ins_size_reorg;
ulint level;
ulint comp; ulint comp;
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
@ -2072,7 +2071,6 @@ btr_compress(
MTR_MEMO_X_LOCK)); MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
level = btr_page_get_level(page, mtr);
space = dict_index_get_space(index); space = dict_index_get_space(index);
left_page_no = btr_page_get_prev(page, mtr); left_page_no = btr_page_get_prev(page, mtr);

View File

@ -3365,7 +3365,9 @@ btr_store_big_rec_extern_fields(
page_t* page; page_t* page;
ulint space_id; ulint space_id;
page_t* prev_page; page_t* prev_page;
#ifdef UNIV_SYNC_DEBUG
page_t* rec_page; page_t* rec_page;
#endif /* UNIV_SYNC_DEBUG */
ulint prev_page_no; ulint prev_page_no;
ulint hint_page_no; ulint hint_page_no;
ulint i; ulint i;
@ -3460,9 +3462,12 @@ btr_store_big_rec_extern_fields(
extern_len -= store_len; extern_len -= store_len;
rec_page = buf_page_get(space_id, #ifdef UNIV_SYNC_DEBUG
buf_frame_get_page_no(data), rec_page =
RW_X_LATCH, &mtr); #endif /* UNIV_SYNC_DEBUG */
buf_page_get(space_id,
buf_frame_get_page_no(data),
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
@ -3536,10 +3541,11 @@ btr_free_externally_stored_field(
X-latch to the index tree */ X-latch to the index tree */
{ {
page_t* page; page_t* page;
#ifdef UNIV_SYNC_DEBUG
page_t* rec_page; page_t* rec_page;
#endif /* UNIV_SYNC_DEBUG */
ulint space_id; ulint space_id;
ulint page_no; ulint page_no;
ulint offset;
ulint extern_len; ulint extern_len;
ulint next_page_no; ulint next_page_no;
ulint part_len; ulint part_len;
@ -3556,9 +3562,12 @@ btr_free_externally_stored_field(
for (;;) { for (;;) {
mtr_start(&mtr); mtr_start(&mtr);
rec_page = buf_page_get(buf_frame_get_space_id(data), #ifdef UNIV_SYNC_DEBUG
buf_frame_get_page_no(data), rec_page =
RW_X_LATCH, &mtr); #endif /* UNIV_SYNC_DEBUG */
buf_page_get(buf_frame_get_space_id(data),
buf_frame_get_page_no(data),
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
@ -3568,8 +3577,6 @@ btr_free_externally_stored_field(
page_no = mach_read_from_4(data + local_len page_no = mach_read_from_4(data + local_len
+ BTR_EXTERN_PAGE_NO); + BTR_EXTERN_PAGE_NO);
offset = mach_read_from_4(data + local_len
+ BTR_EXTERN_OFFSET);
extern_len = mach_read_from_4(data + local_len extern_len = mach_read_from_4(data + local_len
+ BTR_EXTERN_LEN + 4); + BTR_EXTERN_LEN + 4);

View File

@ -429,7 +429,6 @@ btr_pcur_move_backward_from_page(
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint prev_page_no; ulint prev_page_no;
ulint space;
page_t* page; page_t* page;
page_t* prev_page; page_t* prev_page;
ulint latch_mode; ulint latch_mode;
@ -465,7 +464,6 @@ btr_pcur_move_backward_from_page(
page = btr_pcur_get_page(cursor); page = btr_pcur_get_page(cursor);
prev_page_no = btr_page_get_prev(page, mtr); prev_page_no = btr_page_get_prev(page, mtr);
space = buf_frame_get_space_id(page);
if (btr_pcur_is_before_first_on_page(cursor, mtr) if (btr_pcur_is_before_first_on_page(cursor, mtr)
&& (prev_page_no != FIL_NULL)) { && (prev_page_no != FIL_NULL)) {

View File

@ -1401,7 +1401,6 @@ btr_search_update_hash_on_delete(
rec_t* rec; rec_t* rec;
ulint fold; ulint fold;
dulint index_id; dulint index_id;
ibool found;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
@ -1433,7 +1432,7 @@ btr_search_update_hash_on_delete(
} }
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
found = ha_search_and_delete_if_found(table, fold, rec); ha_search_and_delete_if_found(table, fold, rec);
rw_lock_x_unlock(&btr_search_latch); rw_lock_x_unlock(&btr_search_latch);
} }

View File

@ -841,7 +841,6 @@ buf_flush_batch(
{ {
buf_block_t* block; buf_block_t* block;
ulint page_count = 0; ulint page_count = 0;
ulint old_page_count;
ulint space; ulint space;
ulint offset; ulint offset;
ibool found; ibool found;
@ -913,15 +912,9 @@ buf_flush_batch(
mutex_exit(&block->mutex); mutex_exit(&block->mutex);
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
old_page_count = page_count;
/* Try to flush also all the neighbors */ /* Try to flush also all the neighbors */
page_count += buf_flush_try_neighbors( page_count += buf_flush_try_neighbors(
space, offset, flush_type); space, offset, flush_type);
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
page_count - old_page_count); */
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));

View File

@ -367,18 +367,13 @@ eval_notfound(
/*==========*/ /*==========*/
func_node_t* func_node) /* in: function node */ func_node_t* func_node) /* in: function node */
{ {
que_node_t* arg1;
que_node_t* arg2;
sym_node_t* cursor; sym_node_t* cursor;
sel_node_t* sel_node; sel_node_t* sel_node;
ibool ibool_val; ibool ibool_val;
arg1 = func_node->args;
arg2 = que_node_get_next(arg1);
ut_ad(func_node->func == PARS_NOTFOUND_TOKEN); ut_ad(func_node->func == PARS_NOTFOUND_TOKEN);
cursor = arg1; cursor = func_node->args;
ut_ad(que_node_get_type(cursor) == QUE_NODE_SYMBOL); ut_ad(que_node_get_type(cursor) == QUE_NODE_SYMBOL);

View File

@ -5966,7 +5966,6 @@ innobase_drop_database(
trx_t* parent_trx; trx_t* parent_trx;
trx_t* trx; trx_t* trx;
char* ptr; char* ptr;
int error;
char* namebuf; char* namebuf;
THD* thd = current_thd; THD* thd = current_thd;
@ -6004,7 +6003,7 @@ innobase_drop_database(
trx->check_foreigns = FALSE; trx->check_foreigns = FALSE;
} }
error = row_drop_database_for_mysql(namebuf, trx); row_drop_database_for_mysql(namebuf, trx);
my_free(namebuf, MYF(0)); my_free(namebuf, MYF(0));
/* Flush the log to reduce probability that the .frm files and /* Flush the log to reduce probability that the .frm files and
@ -6020,13 +6019,7 @@ innobase_drop_database(
innobase_commit_low(trx); innobase_commit_low(trx);
trx_free_for_mysql(trx); trx_free_for_mysql(trx);
#ifdef NO_LONGER_INTERESTED_IN_DROP_DB_ERROR
error = convert_error_code_to_mysql(error, NULL);
return(error);
#else
return; return;
#endif
} }
/************************************************************************* /*************************************************************************
@ -7543,12 +7536,9 @@ innodb_show_status(
mutex_exit_noninline(&srv_monitor_file_mutex); mutex_exit_noninline(&srv_monitor_file_mutex);
bool result = FALSE; stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
STRING_WITH_LEN(""), str, flen);
if (stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
STRING_WITH_LEN(""), str, flen)) {
result= TRUE;
}
my_free(str, MYF(0)); my_free(str, MYF(0));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);

View File

@ -67,9 +67,6 @@ ut_rnd_gen_ulint(void)
/* out: the 'random' number */ /* out: the 'random' number */
{ {
ulint rnd; ulint rnd;
ulint n_bits;
n_bits = 8 * sizeof(ulint);
ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2; ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;

View File

@ -4296,7 +4296,6 @@ lock_print_info_all_transactions(
lock_t* lock; lock_t* lock;
ulint space; ulint space;
ulint page_no; ulint page_no;
page_t* page;
ibool load_page_first = TRUE; ibool load_page_first = TRUE;
ulint nth_trx = 0; ulint nth_trx = 0;
ulint nth_lock = 0; ulint nth_lock = 0;
@ -4410,8 +4409,7 @@ loop:
mtr_start(&mtr); mtr_start(&mtr);
page = buf_page_get_with_no_latch( buf_page_get_with_no_latch(space, page_no, &mtr);
space, page_no, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);

View File

@ -400,10 +400,8 @@ recv_synchronize_groups(
dulint start_lsn; dulint start_lsn;
dulint end_lsn; dulint end_lsn;
dulint recovered_lsn; dulint recovered_lsn;
dulint limit_lsn;
recovered_lsn = recv_sys->recovered_lsn; recovered_lsn = recv_sys->recovered_lsn;
limit_lsn = recv_sys->limit_lsn;
/* Read the last recovered log block to the recovery system buffer: /* Read the last recovered log block to the recovery system buffer:
the block is always incomplete */ the block is always incomplete */
@ -2506,7 +2504,9 @@ recv_recovery_from_checkpoint_start(
dulint old_scanned_lsn; dulint old_scanned_lsn;
dulint group_scanned_lsn; dulint group_scanned_lsn;
dulint contiguous_lsn; dulint contiguous_lsn;
#ifdef UNIV_LOG_ARCHIVE
dulint archived_lsn; dulint archived_lsn;
#endif /* UNIV_LOG_ARCHIVE */
ulint capacity; ulint capacity;
byte* buf; byte* buf;
byte log_hdr_buf[LOG_FILE_HDR_SIZE]; byte log_hdr_buf[LOG_FILE_HDR_SIZE];
@ -2552,7 +2552,9 @@ recv_recovery_from_checkpoint_start(
checkpoint_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_LSN); checkpoint_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_LSN);
checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO); checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_LOG_ARCHIVE
archived_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN); archived_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN);
#endif /* UNIV_LOG_ARCHIVE */
/* Read the first log file header to print a note if this is /* Read the first log file header to print a note if this is
a recovery from a restored InnoDB Hot Backup */ a recovery from a restored InnoDB Hot Backup */

View File

@ -1314,8 +1314,6 @@ try_again:
int create_flag; int create_flag;
ibool retry; ibool retry;
const char* mode_str = NULL; const char* mode_str = NULL;
const char* type_str = NULL;
const char* purpose_str = NULL;
try_again: try_again:
ut_a(name); ut_a(name);
@ -1335,26 +1333,9 @@ try_again:
ut_error; ut_error;
} }
if (type == OS_LOG_FILE) { ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE);
type_str = "LOG"; ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
} else if (type == OS_DATA_FILE) {
type_str = "DATA";
} else {
ut_error;
}
if (purpose == OS_FILE_AIO) {
purpose_str = "AIO";
} else if (purpose == OS_FILE_NORMAL) {
purpose_str = "NORMAL";
} else {
ut_error;
}
#if 0
fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
name, mode_str, type_str, purpose_str);
#endif
#ifdef O_SYNC #ifdef O_SYNC
/* We let O_SYNC only affect log files; note that we map O_DSYNC to /* We let O_SYNC only affect log files; note that we map O_DSYNC to
O_SYNC because the datasync options seemed to corrupt files in 2001 O_SYNC because the datasync options seemed to corrupt files in 2001

View File

@ -802,13 +802,11 @@ que_thr_dec_refer_count(
{ {
que_fork_t* fork; que_fork_t* fork;
trx_t* trx; trx_t* trx;
sess_t* sess;
ulint fork_type; ulint fork_type;
ibool stopped; ibool stopped;
fork = thr->common.parent; fork = thr->common.parent;
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
sess = trx->sess;
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
@ -1292,18 +1290,13 @@ que_run_threads_low(
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
que_thr_t* next_thr; que_thr_t* next_thr;
ulint cumul_resource;
ulint loop_count; ulint loop_count;
ut_ad(thr->state == QUE_THR_RUNNING); ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS); ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
ut_ad(!mutex_own(&kernel_mutex)); ut_ad(!mutex_own(&kernel_mutex));
/* cumul_resource counts how much resources the OS thread (NOT the
query thread) has spent in this function */
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK; loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
cumul_resource = 0;
loop: loop:
/* Check that there is enough space in the log to accommodate /* Check that there is enough space in the log to accommodate
possible log entries by this query step; if the operation can touch possible log entries by this query step; if the operation can touch

View File

@ -1447,7 +1447,12 @@ run_again:
srv_n_rows_updated++; srv_n_rows_updated++;
} }
row_update_statistics_if_needed(prebuilt->table); /* We update table statistics only if it is a DELETE or UPDATE
that changes indexed columns, UPDATEs that change only non-indexed
columns would not affect statistics. */
if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
row_update_statistics_if_needed(prebuilt->table);
}
trx->op_info = ""; trx->op_info = "";

View File

@ -667,7 +667,7 @@ row_purge_step(
err = row_purge(node, thr); err = row_purge(node, thr);
ut_ad(err == DB_SUCCESS); ut_a(err == DB_SUCCESS);
return(thr); return(thr);
} }

View File

@ -89,12 +89,17 @@ row_undo_mod_clust_low(
btr_pcur_t* pcur; btr_pcur_t* pcur;
btr_cur_t* btr_cur; btr_cur_t* btr_cur;
ulint err; ulint err;
#ifdef UNIV_DEBUG
ibool success; ibool success;
#endif /* UNIV_DEBUG */
pcur = &(node->pcur); pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur); btr_cur = btr_pcur_get_btr_cur(pcur);
success = btr_pcur_restore_position(mode, pcur, mtr); #ifdef UNIV_DEBUG
success =
#endif /* UNIV_DEBUG */
btr_pcur_restore_position(mode, pcur, mtr);
ut_ad(success); ut_ad(success);

View File

@ -2037,7 +2037,9 @@ row_upd_in_place_in_select(
upd_node_t* node; upd_node_t* node;
btr_pcur_t* pcur; btr_pcur_t* pcur;
btr_cur_t* btr_cur; btr_cur_t* btr_cur;
#ifdef UNIV_DEBUG
ulint err; ulint err;
#endif /* UNIV_DEBUG */
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
@ -2074,8 +2076,11 @@ row_upd_in_place_in_select(
ut_ad(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE); ut_ad(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE);
ut_ad(node->select_will_do_update); ut_ad(node->select_will_do_update);
err = btr_cur_update_in_place(BTR_NO_LOCKING_FLAG, btr_cur, #ifdef UNIV_DEBUG
node->update, node->cmpl_info, err =
thr, mtr); #endif /* UNIV_DEBUG */
btr_cur_update_in_place(BTR_NO_LOCKING_FLAG, btr_cur,
node->update, node->cmpl_info,
thr, mtr);
ut_ad(err == DB_SUCCESS); ut_ad(err == DB_SUCCESS);
} }

View File

@ -59,7 +59,9 @@ row_vers_impl_x_locked_off_kernel(
trx_t* trx; trx_t* trx;
ulint vers_del; ulint vers_del;
ulint rec_del; ulint rec_del;
#ifdef UNIV_DEBUG
ulint err; ulint err;
#endif /* UNIV_DEBUG */
mtr_t mtr; mtr_t mtr;
ulint comp; ulint comp;
@ -152,9 +154,12 @@ row_vers_impl_x_locked_off_kernel(
heap2 = heap; heap2 = heap;
heap = mem_heap_create(1024); heap = mem_heap_create(1024);
err = trx_undo_prev_version_build(clust_rec, &mtr, version, #ifdef UNIV_DEBUG
clust_index, clust_offsets, err =
heap, &prev_version); #endif /* UNIV_DEBUG */
trx_undo_prev_version_build(clust_rec, &mtr, version,
clust_index, clust_offsets,
heap, &prev_version);
mem_heap_free(heap2); /* free version and clust_offsets */ mem_heap_free(heap2); /* free version and clust_offsets */
if (prev_version) { if (prev_version) {

View File

@ -249,9 +249,10 @@ trx_purge_add_update_undo_to_history(
trx_undo_t* undo; trx_undo_t* undo;
trx_rseg_t* rseg; trx_rseg_t* rseg;
trx_rsegf_t* rseg_header; trx_rsegf_t* rseg_header;
#ifdef UNIV_DEBUG
trx_usegf_t* seg_header; trx_usegf_t* seg_header;
#endif /* UNIV_DEBUG */
trx_ulogf_t* undo_header; trx_ulogf_t* undo_header;
trx_upagef_t* page_header;
ulint hist_size; ulint hist_size;
undo = trx->update_undo; undo = trx->update_undo;
@ -265,8 +266,9 @@ trx_purge_add_update_undo_to_history(
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr); rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
undo_header = undo_page + undo->hdr_offset; undo_header = undo_page + undo->hdr_offset;
#ifdef UNIV_DEBUG
seg_header = undo_page + TRX_UNDO_SEG_HDR; seg_header = undo_page + TRX_UNDO_SEG_HDR;
page_header = undo_page + TRX_UNDO_PAGE_HDR; #endif /* UNIV_DEBUG */
if (undo->state != TRX_UNDO_CACHED) { if (undo->state != TRX_UNDO_CACHED) {
/* The undo log segment will not be reused */ /* The undo log segment will not be reused */
@ -594,7 +596,6 @@ trx_purge_rseg_get_next_history_log(
{ {
page_t* undo_page; page_t* undo_page;
trx_ulogf_t* log_hdr; trx_ulogf_t* log_hdr;
trx_usegf_t* seg_hdr;
fil_addr_t prev_log_addr; fil_addr_t prev_log_addr;
dulint trx_no; dulint trx_no;
ibool del_marks; ibool del_marks;
@ -615,7 +616,6 @@ trx_purge_rseg_get_next_history_log(
undo_page = trx_undo_page_get_s_latched(rseg->space, undo_page = trx_undo_page_get_s_latched(rseg->space,
rseg->last_page_no, &mtr); rseg->last_page_no, &mtr);
log_hdr = undo_page + rseg->last_offset; log_hdr = undo_page + rseg->last_offset;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
/* Increase the purge page count by one for every handled log */ /* Increase the purge page count by one for every handled log */
@ -1004,12 +1004,8 @@ trx_purge_rec_release(
/*==================*/ /*==================*/
trx_undo_inf_t* cell) /* in: storage cell */ trx_undo_inf_t* cell) /* in: storage cell */
{ {
trx_undo_arr_t* arr;
mutex_enter(&(purge_sys->mutex)); mutex_enter(&(purge_sys->mutex));
arr = purge_sys->arr;
trx_purge_arr_remove_info(cell); trx_purge_arr_remove_info(cell);
mutex_exit(&(purge_sys->mutex)); mutex_exit(&(purge_sys->mutex));

View File

@ -713,13 +713,8 @@ trx_undo_arr_remove_info(
dulint undo_no)/* in: undo number */ dulint undo_no)/* in: undo number */
{ {
trx_undo_inf_t* cell; trx_undo_inf_t* cell;
ulint n_used;
ulint n;
ulint i; ulint i;
n_used = arr->n_used;
n = 0;
for (i = 0;; i++) { for (i = 0;; i++) {
cell = trx_undo_arr_get_nth_info(arr, i); cell = trx_undo_arr_get_nth_info(arr, i);

View File

@ -165,7 +165,9 @@ trx_sys_create_doublewrite_buf(void)
{ {
page_t* page; page_t* page;
page_t* page2; page_t* page2;
#ifdef UNIV_SYNC_DEBUG
page_t* new_page; page_t* new_page;
#endif /* UNIV_SYNC_DEBUG */
byte* doublewrite; byte* doublewrite;
byte* fseg_header; byte* fseg_header;
ulint page_no; ulint page_no;
@ -271,8 +273,11 @@ start_again:
the page position in the tablespace, then the page the page position in the tablespace, then the page
has not been written to in doublewrite. */ has not been written to in doublewrite. */
new_page = buf_page_get(TRX_SYS_SPACE, page_no, #ifdef UNIV_SYNC_DEBUG
RW_X_LATCH, &mtr); new_page =
#endif /* UNIV_SYNC_DEBUG */
buf_page_get(TRX_SYS_SPACE, page_no,
RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(new_page, SYNC_NO_ORDER_CHECK); buf_page_dbg_add_level(new_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */

View File

@ -1827,7 +1827,6 @@ trx_prepare_off_kernel(
/*===================*/ /*===================*/
trx_t* trx) /* in: transaction */ trx_t* trx) /* in: transaction */
{ {
page_t* update_hdr_page;
trx_rseg_t* rseg; trx_rseg_t* rseg;
ibool must_flush_log = FALSE; ibool must_flush_log = FALSE;
dulint lsn; dulint lsn;
@ -1863,7 +1862,7 @@ trx_prepare_off_kernel(
} }
if (trx->update_undo) { if (trx->update_undo) {
update_hdr_page = trx_undo_set_state_at_prepare( trx_undo_set_state_at_prepare(
trx, trx->update_undo, &mtr); trx, trx->update_undo, &mtr);
} }

View File

@ -1012,14 +1012,11 @@ trx_undo_truncate_end(
ulint last_page_no; ulint last_page_no;
trx_undo_rec_t* rec; trx_undo_rec_t* rec;
trx_undo_rec_t* trunc_here; trx_undo_rec_t* trunc_here;
trx_rseg_t* rseg;
mtr_t mtr; mtr_t mtr;
ut_ad(mutex_own(&(trx->undo_mutex))); ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&(trx->rseg->mutex))); ut_ad(mutex_own(&(trx->rseg->mutex)));
rseg = trx->rseg;
for (;;) { for (;;) {
mtr_start(&mtr); mtr_start(&mtr);
@ -1798,7 +1795,6 @@ trx_undo_set_state_at_prepare(
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
trx_usegf_t* seg_hdr; trx_usegf_t* seg_hdr;
trx_upagef_t* page_hdr;
trx_ulogf_t* undo_header; trx_ulogf_t* undo_header;
page_t* undo_page; page_t* undo_page;
ulint offset; ulint offset;
@ -1815,7 +1811,6 @@ trx_undo_set_state_at_prepare(
undo_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr); undo_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR; seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
/*------------------------------*/ /*------------------------------*/
undo->state = TRX_UNDO_PREPARED; undo->state = TRX_UNDO_PREPARED;

View File

@ -1,3 +1,7 @@
2010-09-06 The InnoDB Team
* dict/dict0load.c, innodb_bug53756.test innodb_bug53756.result
Fix Bug #53756 ALTER TABLE ADD PRIMARY KEY affects crash recovery
2010-08-24 The InnoDB Team 2010-08-24 The InnoDB Team
* handler/ha_innodb.c, dict/dict0dict.c: * handler/ha_innodb.c, dict/dict0dict.c:

View File

@ -1895,7 +1895,6 @@ btr_page_split_and_insert(
buf_block_t* left_block; buf_block_t* left_block;
buf_block_t* right_block; buf_block_t* right_block;
buf_block_t* insert_block; buf_block_t* insert_block;
page_t* insert_page;
page_cur_t* page_cursor; page_cur_t* page_cursor;
rec_t* first_rec; rec_t* first_rec;
byte* buf = 0; /* remove warning */ byte* buf = 0; /* remove warning */
@ -2153,8 +2152,6 @@ insert_empty:
insert_block = right_block; insert_block = right_block;
} }
insert_page = buf_block_get_frame(insert_block);
/* 7. Reposition the cursor for insert and try insertion */ /* 7. Reposition the cursor for insert and try insertion */
page_cursor = btr_cur_get_page_cur(cursor); page_cursor = btr_cur_get_page_cur(cursor);
@ -2166,8 +2163,12 @@ insert_empty:
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
{ {
page_t* insert_page
= buf_block_get_frame(insert_block);
page_zip_des_t* insert_page_zip page_zip_des_t* insert_page_zip
= buf_block_get_page_zip(insert_block); = buf_block_get_page_zip(insert_block);
ut_a(!insert_page_zip ut_a(!insert_page_zip
|| page_zip_validate(insert_page_zip, insert_page)); || page_zip_validate(insert_page_zip, insert_page));
} }
@ -2560,7 +2561,6 @@ btr_compress(
ulint n_recs; ulint n_recs;
ulint max_ins_size; ulint max_ins_size;
ulint max_ins_size_reorg; ulint max_ins_size_reorg;
ulint level;
block = btr_cur_get_block(cursor); block = btr_cur_get_block(cursor);
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
@ -2570,7 +2570,6 @@ btr_compress(
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index), ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK)); MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
level = btr_page_get_level(page, mtr);
space = dict_index_get_space(index); space = dict_index_get_space(index);
zip_size = dict_table_zip_size(index->table); zip_size = dict_table_zip_size(index->table);

View File

@ -1836,7 +1836,6 @@ btr_cur_optimistic_update(
page_t* page; page_t* page;
page_zip_des_t* page_zip; page_zip_des_t* page_zip;
rec_t* rec; rec_t* rec;
rec_t* orig_rec;
ulint max_size; ulint max_size;
ulint new_rec_size; ulint new_rec_size;
ulint old_rec_size; ulint old_rec_size;
@ -1850,7 +1849,7 @@ btr_cur_optimistic_update(
block = btr_cur_get_block(cursor); block = btr_cur_get_block(cursor);
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
orig_rec = rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
index = cursor->index; index = cursor->index;
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table)); ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
@ -4279,12 +4278,17 @@ btr_free_externally_stored_field(
} }
for (;;) { for (;;) {
#ifdef UNIV_SYNC_DEBUG
buf_block_t* rec_block; buf_block_t* rec_block;
#endif /* UNIV_SYNC_DEBUG */
buf_block_t* ext_block; buf_block_t* ext_block;
mtr_start(&mtr); mtr_start(&mtr);
rec_block = buf_page_get(page_get_space_id( #ifdef UNIV_SYNC_DEBUG
rec_block =
#endif /* UNIV_SYNC_DEBUG */
buf_page_get(page_get_space_id(
page_align(field_ref)), page_align(field_ref)),
rec_zip_size, rec_zip_size,
page_get_page_no( page_get_page_no(

View File

@ -452,7 +452,6 @@ btr_pcur_move_backward_from_page(
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
ulint prev_page_no; ulint prev_page_no;
ulint space;
page_t* page; page_t* page;
buf_block_t* prev_block; buf_block_t* prev_block;
ulint latch_mode; ulint latch_mode;
@ -488,7 +487,6 @@ btr_pcur_move_backward_from_page(
page = btr_pcur_get_page(cursor); page = btr_pcur_get_page(cursor);
prev_page_no = btr_page_get_prev(page, mtr); prev_page_no = btr_page_get_prev(page, mtr);
space = buf_block_get_space(btr_pcur_get_block(cursor));
if (prev_page_no == FIL_NULL) { if (prev_page_no == FIL_NULL) {
} else if (btr_pcur_is_before_first_on_page(cursor)) { } else if (btr_pcur_is_before_first_on_page(cursor)) {

View File

@ -1495,7 +1495,6 @@ btr_search_update_hash_on_delete(
rec_t* rec; rec_t* rec;
ulint fold; ulint fold;
dulint index_id; dulint index_id;
ibool found;
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
rec_offs_init(offsets_); rec_offs_init(offsets_);
@ -1528,7 +1527,7 @@ btr_search_update_hash_on_delete(
} }
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
found = ha_search_and_delete_if_found(table, fold, rec); ha_search_and_delete_if_found(table, fold, rec);
rw_lock_x_unlock(&btr_search_latch); rw_lock_x_unlock(&btr_search_latch);
} }

View File

@ -128,10 +128,15 @@ buf_flush_delete_from_flush_rbt(
buf_page_t* bpage) /*!< in: bpage to be removed. */ buf_page_t* bpage) /*!< in: bpage to be removed. */
{ {
#ifdef UNIV_DEBUG
ibool ret = FALSE; ibool ret = FALSE;
#endif /* UNIV_DEBUG */
ut_ad(buf_pool_mutex_own()); ut_ad(buf_pool_mutex_own());
ret = rbt_delete(buf_pool->flush_rbt, &bpage); #ifdef UNIV_DEBUG
ret =
#endif /* UNIV_DEBUG */
rbt_delete(buf_pool->flush_rbt, &bpage);
ut_ad(ret); ut_ad(ret);
} }
@ -1266,7 +1271,6 @@ buf_flush_batch(
{ {
buf_page_t* bpage; buf_page_t* bpage;
ulint page_count = 0; ulint page_count = 0;
ulint old_page_count;
ulint space; ulint space;
ulint offset; ulint offset;
@ -1338,15 +1342,9 @@ flush_next:
buf_pool_mutex_exit(); buf_pool_mutex_exit();
old_page_count = page_count;
/* Try to flush also all the neighbors */ /* Try to flush also all the neighbors */
page_count += buf_flush_try_neighbors( page_count += buf_flush_try_neighbors(
space, offset, flush_type); space, offset, flush_type);
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
page_count - old_page_count); */
buf_pool_mutex_enter(); buf_pool_mutex_enter();
goto flush_next; goto flush_next;

View File

@ -627,7 +627,6 @@ dict_create_index_tree_step(
{ {
dict_index_t* index; dict_index_t* index;
dict_table_t* sys_indexes; dict_table_t* sys_indexes;
dict_table_t* table;
dtuple_t* search_tuple; dtuple_t* search_tuple;
ulint zip_size; ulint zip_size;
btr_pcur_t pcur; btr_pcur_t pcur;
@ -636,7 +635,6 @@ dict_create_index_tree_step(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
index = node->index; index = node->index;
table = node->table;
sys_indexes = dict_sys->sys_indexes; sys_indexes = dict_sys->sys_indexes;

View File

@ -4441,7 +4441,6 @@ dict_index_print_low(
{ {
ib_int64_t n_vals; ib_int64_t n_vals;
ulint i; ulint i;
const char* type_string;
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
@ -4456,14 +4455,6 @@ dict_index_print_low(
dict_index_stat_mutex_exit(index); dict_index_stat_mutex_exit(index);
if (dict_index_is_clust(index)) {
type_string = "clustered index";
} else if (dict_index_is_unique(index)) {
type_string = "unique index";
} else {
type_string = "secondary index";
}
fprintf(stderr, fprintf(stderr,
" INDEX: name %s, id %lu %lu, fields %lu/%lu," " INDEX: name %s, id %lu %lu, fields %lu/%lu,"
" uniq %lu, type %lu\n" " uniq %lu, type %lu\n"

View File

@ -1072,6 +1072,8 @@ dict_load_table_on_id(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
table = NULL;
/* NOTE that the operation of this function is protected by /* NOTE that the operation of this function is protected by
the dictionary mutex, and therefore no deadlocks can occur the dictionary mutex, and therefore no deadlocks can occur
with other dictionary operations. */ with other dictionary operations. */
@ -1098,15 +1100,17 @@ dict_load_table_on_id(
BTR_SEARCH_LEAF, &pcur, &mtr); BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur); rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur) if (!btr_pcur_is_on_user_rec(&pcur)) {
|| rec_get_deleted_flag(rec, 0)) {
/* Not found */ /* Not found */
goto func_exit;
}
btr_pcur_close(&pcur); /* Find the first record that is not delete marked */
mtr_commit(&mtr); while (rec_get_deleted_flag(rec, 0)) {
mem_heap_free(heap); if (!btr_pcur_move_to_next_user_rec(&pcur, &mtr)) {
goto func_exit;
return(NULL); }
rec = btr_pcur_get_rec(&pcur);
} }
/*---------------------------------------------------*/ /*---------------------------------------------------*/
@ -1119,19 +1123,14 @@ dict_load_table_on_id(
/* Check if the table id in record is the one searched for */ /* Check if the table id in record is the one searched for */
if (ut_dulint_cmp(table_id, mach_read_from_8(field)) != 0) { if (ut_dulint_cmp(table_id, mach_read_from_8(field)) != 0) {
goto func_exit;
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
return(NULL);
} }
/* Now we get the table name from the record */ /* Now we get the table name from the record */
field = rec_get_nth_field_old(rec, 1, &len); field = rec_get_nth_field_old(rec, 1, &len);
/* Load the table definition to memory */ /* Load the table definition to memory */
table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len)); table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len));
func_exit:
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
mem_heap_free(heap); mem_heap_free(heap);

View File

@ -384,18 +384,13 @@ eval_notfound(
/*==========*/ /*==========*/
func_node_t* func_node) /*!< in: function node */ func_node_t* func_node) /*!< in: function node */
{ {
que_node_t* arg1;
que_node_t* arg2;
sym_node_t* cursor; sym_node_t* cursor;
sel_node_t* sel_node; sel_node_t* sel_node;
ibool ibool_val; ibool ibool_val;
arg1 = func_node->args;
arg2 = que_node_get_next(arg1);
ut_ad(func_node->func == PARS_NOTFOUND_TOKEN); ut_ad(func_node->func == PARS_NOTFOUND_TOKEN);
cursor = arg1; cursor = func_node->args;
ut_ad(que_node_get_type(cursor) == QUE_NODE_SYMBOL); ut_ad(que_node_get_type(cursor) == QUE_NODE_SYMBOL);

View File

@ -7007,7 +7007,6 @@ innobase_drop_database(
ulint len = 0; ulint len = 0;
trx_t* trx; trx_t* trx;
char* ptr; char* ptr;
int error;
char* namebuf; char* namebuf;
THD* thd = current_thd; THD* thd = current_thd;
@ -7050,7 +7049,7 @@ innobase_drop_database(
#else #else
trx = innobase_trx_allocate(thd); trx = innobase_trx_allocate(thd);
#endif #endif
error = row_drop_database_for_mysql(namebuf, trx); row_drop_database_for_mysql(namebuf, trx);
my_free(namebuf, MYF(0)); my_free(namebuf, MYF(0));
/* Flush the log to reduce probability that the .frm files and /* Flush the log to reduce probability that the .frm files and
@ -8848,12 +8847,9 @@ innodb_show_status(
mutex_exit(&srv_monitor_file_mutex); mutex_exit(&srv_monitor_file_mutex);
bool result = FALSE; stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
STRING_WITH_LEN(""), str, flen);
if (stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name),
STRING_WITH_LEN(""), str, flen)) {
result= TRUE;
}
my_free(str, MYF(0)); my_free(str, MYF(0));
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);

View File

@ -1012,6 +1012,7 @@ trx_i_s_common_fill_table(
deadlock occurs between the mysqld server and mysql client, deadlock occurs between the mysqld server and mysql client,
see http://bugs.mysql.com/29900 ; when that bug is resolved see http://bugs.mysql.com/29900 ; when that bug is resolved
we can enable the DBUG_RETURN(ret) above */ we can enable the DBUG_RETURN(ret) above */
ret++; // silence a gcc46 warning
DBUG_RETURN(0); DBUG_RETURN(0);
#endif #endif
} }

View File

@ -330,7 +330,7 @@ amount of increment. */
Returns the old value of *ptr, atomically sets *ptr to new_val */ Returns the old value of *ptr, atomically sets *ptr to new_val */
# define os_atomic_test_and_set_byte(ptr, new_val) \ # define os_atomic_test_and_set_byte(ptr, new_val) \
__sync_lock_test_and_set(ptr, new_val) __sync_lock_test_and_set(ptr, (byte) new_val)
#elif defined(HAVE_IB_SOLARIS_ATOMICS) #elif defined(HAVE_IB_SOLARIS_ATOMICS)

View File

@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0 #define INNODB_VERSION_MINOR 0
#define INNODB_VERSION_BUGFIX 12 #define INNODB_VERSION_BUGFIX 13
/* The following is the InnoDB version as shown in /* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins; SELECT plugin_version FROM information_schema.plugins;

View File

@ -85,9 +85,6 @@ ut_rnd_gen_ulint(void)
/*==================*/ /*==================*/
{ {
ulint rnd; ulint rnd;
ulint n_bits;
n_bits = 8 * sizeof(ulint);
ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2; ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;

View File

@ -559,10 +559,8 @@ recv_synchronize_groups(
ib_uint64_t start_lsn; ib_uint64_t start_lsn;
ib_uint64_t end_lsn; ib_uint64_t end_lsn;
ib_uint64_t recovered_lsn; ib_uint64_t recovered_lsn;
ib_uint64_t limit_lsn;
recovered_lsn = recv_sys->recovered_lsn; recovered_lsn = recv_sys->recovered_lsn;
limit_lsn = recv_sys->limit_lsn;
/* Read the last recovered log block to the recovery system buffer: /* Read the last recovered log block to the recovery system buffer:
the block is always incomplete */ the block is always incomplete */
@ -2891,7 +2889,9 @@ recv_recovery_from_checkpoint_start_func(
ib_uint64_t old_scanned_lsn; ib_uint64_t old_scanned_lsn;
ib_uint64_t group_scanned_lsn; ib_uint64_t group_scanned_lsn;
ib_uint64_t contiguous_lsn; ib_uint64_t contiguous_lsn;
#ifdef UNIV_LOG_ARCHIVE
ib_uint64_t archived_lsn; ib_uint64_t archived_lsn;
#endif /* UNIV_LOG_ARCHIVE */
byte* buf; byte* buf;
byte log_hdr_buf[LOG_FILE_HDR_SIZE]; byte log_hdr_buf[LOG_FILE_HDR_SIZE];
ulint err; ulint err;
@ -2946,7 +2946,9 @@ recv_recovery_from_checkpoint_start_func(
checkpoint_lsn = mach_read_ull(buf + LOG_CHECKPOINT_LSN); checkpoint_lsn = mach_read_ull(buf + LOG_CHECKPOINT_LSN);
checkpoint_no = mach_read_ull(buf + LOG_CHECKPOINT_NO); checkpoint_no = mach_read_ull(buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_LOG_ARCHIVE
archived_lsn = mach_read_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN); archived_lsn = mach_read_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN);
#endif /* UNIV_LOG_ARCHIVE */
/* Read the first log file header to print a note if this is /* Read the first log file header to print a note if this is
a recovery from a restored InnoDB Hot Backup */ a recovery from a restored InnoDB Hot Backup */

View File

@ -1367,8 +1367,6 @@ try_again:
int create_flag; int create_flag;
ibool retry; ibool retry;
const char* mode_str = NULL; const char* mode_str = NULL;
const char* type_str = NULL;
const char* purpose_str = NULL;
try_again: try_again:
ut_a(name); ut_a(name);
@ -1388,26 +1386,9 @@ try_again:
ut_error; ut_error;
} }
if (type == OS_LOG_FILE) { ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE);
type_str = "LOG"; ut_a(purpose == OS_FILE_AIO || purpose == OS_FILE_NORMAL);
} else if (type == OS_DATA_FILE) {
type_str = "DATA";
} else {
ut_error;
}
if (purpose == OS_FILE_AIO) {
purpose_str = "AIO";
} else if (purpose == OS_FILE_NORMAL) {
purpose_str = "NORMAL";
} else {
ut_error;
}
#if 0
fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
name, mode_str, type_str, purpose_str);
#endif
#ifdef O_SYNC #ifdef O_SYNC
/* We let O_SYNC only affect log files; note that we map O_DSYNC to /* We let O_SYNC only affect log files; note that we map O_DSYNC to
O_SYNC because the datasync options seemed to corrupt files in 2001 O_SYNC because the datasync options seemed to corrupt files in 2001

View File

@ -1284,18 +1284,13 @@ que_run_threads_low(
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {
que_thr_t* next_thr; que_thr_t* next_thr;
ulint cumul_resource;
ulint loop_count; ulint loop_count;
ut_ad(thr->state == QUE_THR_RUNNING); ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS); ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
ut_ad(!mutex_own(&kernel_mutex)); ut_ad(!mutex_own(&kernel_mutex));
/* cumul_resource counts how much resources the OS thread (NOT the
query thread) has spent in this function */
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK; loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
cumul_resource = 0;
loop: loop:
/* Check that there is enough space in the log to accommodate /* Check that there is enough space in the log to accommodate
possible log entries by this query step; if the operation can touch possible log entries by this query step; if the operation can touch

View File

@ -1422,7 +1422,12 @@ run_again:
srv_n_rows_updated++; srv_n_rows_updated++;
} }
row_update_statistics_if_needed(prebuilt->table); /* We update table statistics only if it is a DELETE or UPDATE
that changes indexed columns, UPDATEs that change only non-indexed
columns would not affect statistics. */
if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
row_update_statistics_if_needed(prebuilt->table);
}
trx->op_info = ""; trx->op_info = "";

View File

@ -684,7 +684,9 @@ row_purge_step(
que_thr_t* thr) /*!< in: query thread */ que_thr_t* thr) /*!< in: query thread */
{ {
purge_node_t* node; purge_node_t* node;
#ifdef UNIV_DEBUG
ulint err; ulint err;
#endif /* UNIV_DEBUG */
ut_ad(thr); ut_ad(thr);
@ -692,7 +694,10 @@ row_purge_step(
ut_ad(que_node_get_type(node) == QUE_NODE_PURGE); ut_ad(que_node_get_type(node) == QUE_NODE_PURGE);
err = row_purge(node, thr); #ifdef UNIV_DEBUG
err =
#endif /* UNIV_DEBUG */
row_purge(node, thr);
ut_ad(err == DB_SUCCESS); ut_ad(err == DB_SUCCESS);

View File

@ -114,12 +114,17 @@ row_undo_mod_clust_low(
btr_pcur_t* pcur; btr_pcur_t* pcur;
btr_cur_t* btr_cur; btr_cur_t* btr_cur;
ulint err; ulint err;
#ifdef UNIV_DEBUG
ibool success; ibool success;
#endif /* UNIV_DEBUG */
pcur = &(node->pcur); pcur = &(node->pcur);
btr_cur = btr_pcur_get_btr_cur(pcur); btr_cur = btr_pcur_get_btr_cur(pcur);
success = btr_pcur_restore_position(mode, pcur, mtr); #ifdef UNIV_DEBUG
success =
#endif /* UNIV_DEBUG */
btr_pcur_restore_position(mode, pcur, mtr);
ut_ad(success); ut_ad(success);

View File

@ -71,7 +71,9 @@ row_vers_impl_x_locked_off_kernel(
warning */ warning */
trx_t* trx; trx_t* trx;
ulint rec_del; ulint rec_del;
#ifdef UNIV_DEBUG
ulint err; ulint err;
#endif /* UNIV_DEBUG */
mtr_t mtr; mtr_t mtr;
ulint comp; ulint comp;
@ -169,9 +171,12 @@ row_vers_impl_x_locked_off_kernel(
heap2 = heap; heap2 = heap;
heap = mem_heap_create(1024); heap = mem_heap_create(1024);
err = trx_undo_prev_version_build(clust_rec, &mtr, version, #ifdef UNIV_DEBUG
clust_index, clust_offsets, err =
heap, &prev_version); #endif /* UNIV_DEBUG */
trx_undo_prev_version_build(clust_rec, &mtr, version,
clust_index, clust_offsets,
heap, &prev_version);
mem_heap_free(heap2); /* free version and clust_offsets */ mem_heap_free(heap2); /* free version and clust_offsets */
if (prev_version == NULL) { if (prev_version == NULL) {

View File

@ -304,9 +304,10 @@ trx_purge_add_update_undo_to_history(
trx_undo_t* undo; trx_undo_t* undo;
trx_rseg_t* rseg; trx_rseg_t* rseg;
trx_rsegf_t* rseg_header; trx_rsegf_t* rseg_header;
#ifdef UNIV_DEBUG
trx_usegf_t* seg_header; trx_usegf_t* seg_header;
#endif /* UNIV_DEBUG */
trx_ulogf_t* undo_header; trx_ulogf_t* undo_header;
trx_upagef_t* page_header;
ulint hist_size; ulint hist_size;
undo = trx->update_undo; undo = trx->update_undo;
@ -321,8 +322,9 @@ trx_purge_add_update_undo_to_history(
rseg->page_no, mtr); rseg->page_no, mtr);
undo_header = undo_page + undo->hdr_offset; undo_header = undo_page + undo->hdr_offset;
#ifdef UNIV_DEBUG
seg_header = undo_page + TRX_UNDO_SEG_HDR; seg_header = undo_page + TRX_UNDO_SEG_HDR;
page_header = undo_page + TRX_UNDO_PAGE_HDR; #endif /* UNIV_DEBUG */
if (undo->state != TRX_UNDO_CACHED) { if (undo->state != TRX_UNDO_CACHED) {
/* The undo log segment will not be reused */ /* The undo log segment will not be reused */
@ -655,7 +657,6 @@ trx_purge_rseg_get_next_history_log(
{ {
page_t* undo_page; page_t* undo_page;
trx_ulogf_t* log_hdr; trx_ulogf_t* log_hdr;
trx_usegf_t* seg_hdr;
fil_addr_t prev_log_addr; fil_addr_t prev_log_addr;
trx_id_t trx_no; trx_id_t trx_no;
ibool del_marks; ibool del_marks;
@ -676,7 +677,6 @@ trx_purge_rseg_get_next_history_log(
undo_page = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size, undo_page = trx_undo_page_get_s_latched(rseg->space, rseg->zip_size,
rseg->last_page_no, &mtr); rseg->last_page_no, &mtr);
log_hdr = undo_page + rseg->last_offset; log_hdr = undo_page + rseg->last_offset;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
/* Increase the purge page count by one for every handled log */ /* Increase the purge page count by one for every handled log */
@ -1068,12 +1068,8 @@ trx_purge_rec_release(
/*==================*/ /*==================*/
trx_undo_inf_t* cell) /*!< in: storage cell */ trx_undo_inf_t* cell) /*!< in: storage cell */
{ {
trx_undo_arr_t* arr;
mutex_enter(&(purge_sys->mutex)); mutex_enter(&(purge_sys->mutex));
arr = purge_sys->arr;
trx_purge_arr_remove_info(cell); trx_purge_arr_remove_info(cell);
mutex_exit(&(purge_sys->mutex)); mutex_exit(&(purge_sys->mutex));

View File

@ -740,13 +740,8 @@ trx_undo_arr_remove_info(
undo_no_t undo_no)/*!< in: undo number */ undo_no_t undo_no)/*!< in: undo number */
{ {
trx_undo_inf_t* cell; trx_undo_inf_t* cell;
ulint n_used;
ulint n;
ulint i; ulint i;
n_used = arr->n_used;
n = 0;
for (i = 0;; i++) { for (i = 0;; i++) {
cell = trx_undo_arr_get_nth_info(arr, i); cell = trx_undo_arr_get_nth_info(arr, i);

View File

@ -241,7 +241,9 @@ trx_sys_create_doublewrite_buf(void)
{ {
buf_block_t* block; buf_block_t* block;
buf_block_t* block2; buf_block_t* block2;
#ifdef UNIV_SYNC_DEBUG
buf_block_t* new_block; buf_block_t* new_block;
#endif /* UNIV_SYNC_DEBUG */
byte* doublewrite; byte* doublewrite;
byte* fseg_header; byte* fseg_header;
ulint page_no; ulint page_no;
@ -344,8 +346,11 @@ start_again:
the page position in the tablespace, then the page the page position in the tablespace, then the page
has not been written to in doublewrite. */ has not been written to in doublewrite. */
new_block = buf_page_get(TRX_SYS_SPACE, 0, page_no, #ifdef UNIV_SYNC_DEBUG
RW_X_LATCH, &mtr); new_block =
#endif /* UNIV_SYNC_DEBUG */
buf_page_get(TRX_SYS_SPACE, 0, page_no,
RW_X_LATCH, &mtr);
buf_block_dbg_add_level(new_block, buf_block_dbg_add_level(new_block,
SYNC_NO_ORDER_CHECK); SYNC_NO_ORDER_CHECK);

View File

@ -1805,7 +1805,6 @@ trx_prepare_off_kernel(
/*===================*/ /*===================*/
trx_t* trx) /*!< in: transaction */ trx_t* trx) /*!< in: transaction */
{ {
page_t* update_hdr_page;
trx_rseg_t* rseg; trx_rseg_t* rseg;
ib_uint64_t lsn = 0; ib_uint64_t lsn = 0;
mtr_t mtr; mtr_t mtr;
@ -1838,7 +1837,7 @@ trx_prepare_off_kernel(
} }
if (trx->update_undo) { if (trx->update_undo) {
update_hdr_page = trx_undo_set_state_at_prepare( trx_undo_set_state_at_prepare(
trx, trx->update_undo, &mtr); trx, trx->update_undo, &mtr);
} }

View File

@ -1066,14 +1066,11 @@ trx_undo_truncate_end(
ulint last_page_no; ulint last_page_no;
trx_undo_rec_t* rec; trx_undo_rec_t* rec;
trx_undo_rec_t* trunc_here; trx_undo_rec_t* trunc_here;
trx_rseg_t* rseg;
mtr_t mtr; mtr_t mtr;
ut_ad(mutex_own(&(trx->undo_mutex))); ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&(trx->rseg->mutex))); ut_ad(mutex_own(&(trx->rseg->mutex)));
rseg = trx->rseg;
for (;;) { for (;;) {
mtr_start(&mtr); mtr_start(&mtr);
@ -1868,7 +1865,6 @@ trx_undo_set_state_at_prepare(
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
trx_usegf_t* seg_hdr; trx_usegf_t* seg_hdr;
trx_upagef_t* page_hdr;
trx_ulogf_t* undo_header; trx_ulogf_t* undo_header;
page_t* undo_page; page_t* undo_page;
ulint offset; ulint offset;
@ -1886,7 +1882,6 @@ trx_undo_set_state_at_prepare(
undo->hdr_page_no, mtr); undo->hdr_page_no, mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR; seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
/*------------------------------*/ /*------------------------------*/
undo->state = TRX_UNDO_PREPARED; undo->state = TRX_UNDO_PREPARED;