summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-12-04 23:18:46 +0200
committerMichael Widenius <monty@askmonty.org>2010-12-04 23:18:46 +0200
commitbafceea14f1bcc7edda379dcd874e21e2c173398 (patch)
tree295787e7712d88e743e973e61d9e5326e2e92fdd
parent8b4b8c8e65cb25121ae6c7274e6e190932157d8b (diff)
parentdfefc15db49c367dd59d790bbd50311ec423f5f4 (diff)
downloadmariadb-git-bafceea14f1bcc7edda379dcd874e21e2c173398.tar.gz
Automatic merge
-rwxr-xr-xCMakeLists.txt2
-rw-r--r--include/my_pthread.h1
-rw-r--r--mysql-test/extra/rpl_tests/rpl_auto_increment.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug38231.test5
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug38231.test6
-rwxr-xr-xscripts/make_win_bin_dist4
-rwxr-xr-xsql/CMakeLists.txt3
-rw-r--r--sql/set_var.cc2
-rw-r--r--storage/maria/ma_loghandler.c23
-rw-r--r--storage/maria/ma_pagecache.c53
-rw-r--r--storage/maria/unittest/ma_pagecache_consist.c1
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist.c1
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multithread-t.c5
-rw-r--r--storage/maria/unittest/ma_test_loghandler_pagecache-t.c2
-rw-r--r--storage/oqgraph/ha_oqgraph.cc10
15 files changed, 92 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5aa865d600f..67fd7a9d0d5 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,7 +116,7 @@ IF(MSVC)
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
- # set stack size (see bug#20815)
+ # generate map files, set stack size (see bug#20815)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:1048576")
# remove support for Exception handling
diff --git a/include/my_pthread.h b/include/my_pthread.h
index ef17ad48cb6..5cf6c5d5fac 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -128,7 +128,6 @@ struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
-
#ifndef ETIMEDOUT
#define ETIMEDOUT 145 /* Win32 doesn't have this */
#endif
diff --git a/mysql-test/extra/rpl_tests/rpl_auto_increment.test b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
index 06e3a154bc3..8d2f6c32233 100644
--- a/mysql-test/extra/rpl_tests/rpl_auto_increment.test
+++ b/mysql-test/extra/rpl_tests/rpl_auto_increment.test
@@ -251,6 +251,7 @@ connection master;
CREATE TABLE t1(s VARCHAR(10)) ENGINE=myisam;
# -slave.opt has --replicate-ignore-table=test.t_ignored1
CREATE TABLE t_ignored1(id INT AUTO_INCREMENT PRIMARY KEY) ENGINE=myisam;
+sync_slave_with_master;
connection slave;
diff --git a/mysql-test/suite/innodb/t/innodb_bug38231.test b/mysql-test/suite/innodb/t/innodb_bug38231.test
index 1611cb56203..5021f23d07e 100644
--- a/mysql-test/suite/innodb/t/innodb_bug38231.test
+++ b/mysql-test/suite/innodb/t/innodb_bug38231.test
@@ -76,6 +76,11 @@ UNLOCK TABLES;
UNLOCK TABLES;
-- connection con3
+#
+# We may get a timeout error here if the tables are locked in a different
+# order than expected. This is ok as the purpose of this patch is to ensure
+# we don't get a crash in the previous unlock tables.
+-- error 0, 1205
-- reap
UNLOCK TABLES;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test b/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test
index 05e39cc16ea..23d8061c9da 100644
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test
@@ -72,8 +72,12 @@ UNLOCK TABLES;
# clean up
-- connection con2
--- reap
+#
+# We may get a timeout error here if the tables are locked in a different
+# order than expected. This is ok as the purpose of this patch is to ensure
+# we don't get a crash in the previous unlock tables.
-- error 0, 1205
+-- reap
UNLOCK TABLES;
-- connection con3
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index 3691cf2ba77..37149440922 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -163,9 +163,7 @@ if [ -f "storage/pbxt/bin/xtstat.exe" ] ; then
cp storage/pbxt/bin/xtstat.{exe,pdb} $DESTDIR/bin
fi
-
-cp server-tools/instance-manager/$TARGET/*.exe $DESTDIR/bin/
-
+cp server-tools/instance-manager/$TARGET/*.exe $DESTDIR/bin/
if [ x"$TARGET" != x"release" ] ; then
cp server-tools/instance-manager/$TARGET/*.pdb $DESTDIR/bin/
cp client/$TARGET/mysql.pdb $DESTDIR/bin/
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 44b25cac9b4..7e8484eeb50 100755
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -18,8 +18,7 @@ SET(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi")
SET(CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi")
-
-SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
+SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/extra/yassl/include
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 38721c154e6..910deafc432 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -128,7 +128,9 @@ static void fix_net_write_timeout(THD *thd, enum_var_type type);
static void fix_net_retry_count(THD *thd, enum_var_type type);
static void fix_max_join_size(THD *thd, enum_var_type type);
static void fix_query_cache_size(THD *thd, enum_var_type type);
+#ifdef HAVE_QUERY_CACHE
static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type);
+#endif
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_max_binlog_size(THD *thd, enum_var_type type);
static void fix_max_relay_log_size(THD *thd, enum_var_type type);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index ab186b6468d..a8fcc639b58 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 MySQL AB & Sanja Belkin
+/* Copyright (C) 2007 MySQL AB & Sanja Belkin. 2010 Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -2598,11 +2598,10 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
{
/* some other flush in progress */
translog_wait_for_closing(buffer);
+ if (buffer->file != file || buffer->offset != offset || buffer->ver != ver)
+ DBUG_RETURN(0); /* some the thread flushed the buffer already */
}
- if (buffer->file != file || buffer->offset != offset || buffer->ver != ver)
- DBUG_RETURN(0); /* some the thread flushed the buffer already */
-
if (buffer->overlay && translog_prev_buffer_flush_wait(buffer))
DBUG_RETURN(0); /* some the thread flushed the buffer already */
@@ -7769,6 +7768,7 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
uint i;
uint8 last_buffer_no, start_buffer_no;
DBUG_ENTER("translog_flush_buffers");
+ LINT_INIT(last_buffer_no);
/*
We will recheck information when will lock buffers one by
@@ -7789,7 +7789,6 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
(uint) start_buffer_no, (uint) log_descriptor.bc.buffer_no,
LSN_IN_PARTS(log_descriptor.bc.buffer->prev_last_lsn)));
-
/*
if LSN up to which we have to flush bigger then maximum LSN of previous
buffer and at least one LSN was saved in the current buffer (last_lsn !=
@@ -7801,18 +7800,28 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
struct st_translog_buffer *buffer= log_descriptor.bc.buffer;
*lsn= log_descriptor.bc.buffer->last_lsn; /* fix lsn if it was horizon */
DBUG_PRINT("info", ("LSN to flush fixed to last lsn: (%lu,0x%lx)",
- LSN_IN_PARTS(log_descriptor.bc.buffer->last_lsn)));
+ LSN_IN_PARTS(*lsn)));
last_buffer_no= log_descriptor.bc.buffer_no;
log_descriptor.is_everything_flushed= 1;
translog_force_current_buffer_to_finish();
translog_buffer_unlock(buffer);
}
- else
+ else if (log_descriptor.bc.buffer->prev_last_lsn != LSN_IMPOSSIBLE)
{
+ /* fix lsn if it was horizon */
+ *lsn= log_descriptor.bc.buffer->prev_last_lsn;
+ DBUG_PRINT("info", ("LSN to flush fixed to prev last lsn: (%lu,0x%lx)",
+ LSN_IN_PARTS(*lsn)));
last_buffer_no= ((log_descriptor.bc.buffer_no + TRANSLOG_BUFFERS_NO -1) %
TRANSLOG_BUFFERS_NO);
translog_unlock();
}
+ else if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE)
+ {
+ DBUG_PRINT("info", ("There is no LSNs yet generated => do nothing"));
+ translog_unlock();
+ DBUG_VOID_RETURN;
+ }
/* flush buffers */
*sent_to_disk= translog_get_sent_to_disk();
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 1bb82ba92cd..8105c6f752d 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -1025,6 +1025,7 @@ finish:
*/
static inline void inc_counter_for_resize_op(PAGECACHE *pagecache)
{
+ safe_mutex_assert_owner(&pagecache->cache_lock);
pagecache->cnt_for_resize_op++;
}
@@ -1037,6 +1038,7 @@ static inline void dec_counter_for_resize_op(PAGECACHE *pagecache)
{
#ifdef THREAD
struct st_my_thread_var *last_thread;
+ safe_mutex_assert_owner(&pagecache->cache_lock);
if (!--pagecache->cnt_for_resize_op &&
(last_thread= pagecache->resize_queue.last_thread))
{
@@ -1085,6 +1087,37 @@ void change_pagecache_param(PAGECACHE *pagecache, uint division_limit,
/*
+ Check that pagecache was used and cleaned up properly.
+*/
+
+#ifndef DBUG_OFF
+void check_pagecache_is_cleaned_up(PAGECACHE *pagecache)
+{
+ DBUG_ENTER("check_pagecache_is_cleaned_up");
+ /*
+ Ensure we called inc_counter_for_resize_op and dec_counter_for_resize_op
+ the same number of times. (If not, a resize() could never happen.
+ */
+ DBUG_ASSERT(pagecache->cnt_for_resize_op == 0);
+
+ if (pagecache->disk_blocks > 0)
+ {
+ if (pagecache->block_mem)
+ {
+ uint i;
+ for (i=0 ; i < pagecache->blocks_used ; i++)
+ {
+ DBUG_ASSERT(pagecache->block_root[i].status == 0);
+ DBUG_ASSERT(pagecache->block_root[i].type == PAGECACHE_EMPTY_PAGE);
+ }
+ }
+ }
+ DBUG_VOID_RETURN;
+}
+#endif
+
+
+/*
Removes page cache from memory. Does NOT flush pages to disk.
SYNOPSIS
@@ -1106,6 +1139,10 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
if (pagecache->disk_blocks > 0)
{
+#ifndef DBUG_OFF
+ check_pagecache_is_cleaned_up(pagecache);
+#endif
+
if (pagecache->block_mem)
{
my_large_free(pagecache->block_mem, MYF(0));
@@ -2250,6 +2287,7 @@ static my_bool pagecache_wait_lock(PAGECACHE *pagecache,
&pagecache->cache_lock);
}
while(thread->next);
+ inc_counter_for_resize_op(pagecache);
#else
DBUG_ASSERT(0);
#endif
@@ -3457,7 +3495,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
{
/*
this call is just 'hint' for the cache to free the page so we will
- not interferes with flushing process but gust return success
+ not interferes with flushing process but must return success
*/
goto out;
}
@@ -3527,8 +3565,17 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
page_link->requests--;
/* See NOTE for pagecache_unlock about registering requests. */
free_block(pagecache, block);
+ dec_counter_for_resize_op(pagecache);
+ return 0;
out:
+ /* Cache is locked, so we can relese page before freeing it */
+ if (make_lock_and_pin(pagecache, block,
+ PAGECACHE_LOCK_WRITE_UNLOCK,
+ PAGECACHE_UNPIN, FALSE))
+ DBUG_ASSERT(0);
+ page_link->requests--;
+ unreg_request(pagecache, block, 1);
dec_counter_for_resize_op(pagecache);
return error;
}
@@ -3579,6 +3626,8 @@ my_bool pagecache_delete_by_link(PAGECACHE *pagecache,
*/
DBUG_ASSERT((block->status &
(PCBLOCK_IN_SWITCH | PCBLOCK_REASSIGNED)) == 0);
+
+ inc_counter_for_resize_op(pagecache);
/*
make_lock_and_pin() can't fail here, because we are keeping pin on the
block and it can't be evicted (which is cause of lock fail and retry)
@@ -3695,6 +3744,7 @@ restart:
if (!page_link)
{
DBUG_PRINT("info", ("There is no such page in the cache"));
+ dec_counter_for_resize_op(pagecache);
pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
DBUG_RETURN(0);
}
@@ -3707,6 +3757,7 @@ restart:
"reassigned" : "in switch")));
PCBLOCK_INFO(block);
page_link->requests--;
+ dec_counter_for_resize_op(pagecache);
goto end;
}
/* See NOTE for pagecache_unlock about registering requests. */
diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c
index 7dbdba433c6..0a9e5737c7e 100644
--- a/storage/maria/unittest/ma_pagecache_consist.c
+++ b/storage/maria/unittest/ma_pagecache_consist.c
@@ -476,6 +476,7 @@ int main(int argc __attribute__((unused)),
pthread_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info", ("thread ended"));
+ flush_pagecache_blocks(&pagecache, &file1, FLUSH_IGNORE_CHANGED);
end_pagecache(&pagecache, 1);
DBUG_PRINT("info", ("Page cache ended"));
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c
index a1a22b5e18d..ff386c48414 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist.c
@@ -341,6 +341,7 @@ int main(int argc __attribute__((unused)),
pthread_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info", ("thread ended"));
+ flush_pagecache_blocks(&pagecache, &file1, FLUSH_IGNORE_CHANGED);
end_pagecache(&pagecache, 1);
DBUG_PRINT("info", ("Page cache ended"));
diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
index 354f5d12e08..dbf47ad2ee1 100644
--- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
@@ -269,11 +269,6 @@ int main(int argc __attribute__((unused)),
int *param, error;
int rc;
- /* Disabled until Sanja tests */
- plan(1);
- ok(1, "disabled");
- exit(0);
-
plan(WRITERS + FLUSHERS +
ITERATIONS * WRITERS * 3 + FLUSH_ITERATIONS * FLUSHERS );
diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
index 1644aa4885c..1d21d8c6a23 100644
--- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
@@ -168,7 +168,7 @@ int main(int argc __attribute__((unused)), char *argv[])
PAGECACHE_PIN_LEFT_UNPINNED,
PAGECACHE_WRITE_DELAY,
0, LSN_IMPOSSIBLE);
- flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
+ flush_pagecache_blocks(&pagecache, &file1, FLUSH_RELEASE);
}
my_close(file1.file, MYF(MY_WME));
if ((file1.file= my_open(first_translog_file, O_RDONLY, MYF(MY_WME))) < 0)
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index e0c66134858..cf9ef3d8997 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -748,19 +748,19 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
if (row.latch_indicator)
{
field[0]->set_notnull();
- field[0]->store((longlong) row.latch);
+ field[0]->store((longlong) row.latch, 0);
}
if (row.orig_indicator)
{
field[1]->set_notnull();
- field[1]->store((longlong) row.orig);
+ field[1]->store((longlong) row.orig, 0);
}
if (row.dest_indicator)
{
field[2]->set_notnull();
- field[2]->store((longlong) row.dest);
+ field[2]->store((longlong) row.dest, 0);
}
if (row.weight_indicator)
@@ -772,13 +772,13 @@ int ha_oqgraph::fill_record(byte *record, const open_query::row &row)
if (row.seq_indicator)
{
field[4]->set_notnull();
- field[4]->store((longlong) row.seq);
+ field[4]->store((longlong) row.seq, 0);
}
if (row.link_indicator)
{
field[5]->set_notnull();
- field[5]->store((longlong) row.link);
+ field[5]->store((longlong) row.link, 0);
}
if (ptrdiff)