From 657e83cf4dee105ed0262acf14e3e9193cccd4b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 5 Dec 2010 01:12:10 +0200 Subject: [PATCH 1/2] The assert removed because it do not take into account case when previous and this buffers used for first time but previous buffer was not sent to disk yet (i.e. previous buffer was never sent to disk yet). --- storage/maria/ma_loghandler.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index a29c42cae68..97403920239 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -2466,14 +2466,6 @@ my_bool translog_prev_buffer_flush_wait(struct st_translog_buffer *buffer) LSN_IN_PARTS(buffer->prev_sent_to_disk), LSN_IN_PARTS(buffer->prev_buffer_offset))); translog_buffer_lock_assert_owner(buffer); - /* - if prev_sent_to_disk == LSN_IMPOSSIBLE then - prev_buffer_offset should be LSN_IMPOSSIBLE - because it means that this buffer was never used - */ - DBUG_ASSERT((buffer->prev_sent_to_disk == LSN_IMPOSSIBLE && - buffer->prev_buffer_offset == LSN_IMPOSSIBLE) || - buffer->prev_sent_to_disk != LSN_IMPOSSIBLE); if (buffer->prev_buffer_offset != buffer->prev_sent_to_disk) { do { From a585745d4fd04c557a0d8f2fdacf10a35d77c8a3 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 5 Dec 2010 14:25:01 +0200 Subject: [PATCH 2/2] Fixes to not trigger end-consistency testing of pagecache. - Moved end_pagecache() to after maria_close() - Flush page cache before closing files (in maria_pack) Fixed test suite failure for PBXT mysql-test/suite/pbxt/r/select.result: We mask out the 'rows' column because it may differ from run to run mysql-test/suite/pbxt/t/select.test: We mask out the 'rows' column because it may differ from run to run storage/maria/maria_chk.c: Moved end_pagecache() to after maria_close() to not trigger end-consistency testing of pagecache. storage/maria/maria_pack.c: Moved end_pagecache() to after maria_close() to not trigger end-consistency testing of pagecache. flush page cache before closing files. --- mysql-test/suite/pbxt/r/select.result | 8 +++----- mysql-test/suite/pbxt/t/select.test | 4 +++- storage/maria/maria_chk.c | 2 +- storage/maria/maria_pack.c | 4 +++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/pbxt/r/select.result b/mysql-test/suite/pbxt/r/select.result index 11244cd3689..c06dd06ea3e 100644 --- a/mysql-test/suite/pbxt/r/select.result +++ b/mysql-test/suite/pbxt/r/select.result @@ -3447,14 +3447,12 @@ insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C; analyze table t2; Table Op Msg_type Msg_text test.t2 analyze status OK -select 'In next EXPLAIN, B.rows must be exactly 10:' Z; -Z -In next EXPLAIN, B.rows must be exactly 10: +In next EXPLAIN, B.rows must be exactly 10 (when using MyISAM): explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE A range PRIMARY PRIMARY 12 NULL 1 Using where -1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 1 +1 SIMPLE A range PRIMARY PRIMARY 12 NULL # Using where +1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e # drop table t1, t2; CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b)); INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2), diff --git a/mysql-test/suite/pbxt/t/select.test b/mysql-test/suite/pbxt/t/select.test index 6b2781e6a5b..7074f4ac364 100644 --- a/mysql-test/suite/pbxt/t/select.test +++ b/mysql-test/suite/pbxt/t/select.test @@ -2910,8 +2910,10 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, b int, c int, e int, primary key(a,b,c)); insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C; analyze table t2; -select 'In next EXPLAIN, B.rows must be exactly 10:' Z; +-- echo In next EXPLAIN, B.rows must be exactly 10 (when using MyISAM): +# We mask out the 'rows' column because it may differ from run to run +--replace_column 9 # explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5); drop table t1, t2; diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index d065070693f..b9b0c681d0a 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -1339,12 +1339,12 @@ static int maria_chk(HA_CHECK *param, char *filename) maria_lock_database(info, F_UNLCK); end2: - end_pagecache(maria_pagecache, 1); if (maria_close(info)) { _ma_check_print_error(param, default_close_errmsg, my_errno, filename); DBUG_RETURN(1); } + end_pagecache(maria_pagecache, 1); if (error == 0) { if (param->out_flag & O_NEW_DATA) diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c index 3e0ea3d571c..c09a6310ff4 100644 --- a/storage/maria/maria_pack.c +++ b/storage/maria/maria_pack.c @@ -690,6 +690,8 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) error|=my_close(new_file,MYF(MY_WME)); if (!result_table) { + (void) flush_pagecache_blocks(isam_file->s->pagecache, &isam_file->dfile, + FLUSH_RELEASE); error|=my_close(isam_file->dfile.file, MYF(MY_WME)); isam_file->dfile.file= -1; /* Tell maria_close file is closed */ isam_file->s->bitmap.file.file= -1; @@ -763,13 +765,13 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) DBUG_RETURN(0); err: - end_pagecache(maria_pagecache, 1); free_counts_and_tree_and_queue(huff_trees,trees,huff_counts,fields); if (new_file >= 0) VOID(my_close(new_file,MYF(0))); if (join_maria_file >= 0) VOID(my_close(join_maria_file,MYF(0))); mrg_close(mrg); + end_pagecache(maria_pagecache, 1); VOID(fprintf(stderr, "Aborted: %s is not compressed\n", org_name)); DBUG_RETURN(-1); }