diff options
author | Marc Alff <marc.alff@oracle.com> | 2010-11-16 09:36:42 +0100 |
---|---|---|
committer | Marc Alff <marc.alff@oracle.com> | 2010-11-16 09:36:42 +0100 |
commit | ce89012c8bfdecded7b7e96b7ea0fb91b199155b (patch) | |
tree | 46ab98bbfcee79ca19c187422a9fc24ae4ca2d0a /storage/perfschema | |
parent | d6d16303cd5e2ba623f51a115f12954fe4a0ce2c (diff) | |
download | mariadb-git-ce89012c8bfdecded7b7e96b7ea0fb91b199155b.tar.gz |
Bug#56760 PFS_lock::allocated_to_free() assert failures on osx10.5-x86-64bit
Before this fix, an assert could fail in PFS_lock::allocated_to_free(), during shutdown.
The assert itself is valid, and detects an anomaly caused by bug 56666.
While bug 56666 has no real consequences in production,
the failure caused by this new assert in the code is negatively
impacting the test suite with automated tests.
This fix is a work around only, that relaxes the integrity checks
during the server shutdown.
Diffstat (limited to 'storage/perfschema')
-rw-r--r-- | storage/perfschema/pfs_lock.h | 20 | ||||
-rw-r--r-- | storage/perfschema/unittest/pfs-t.cc | 1 | ||||
-rw-r--r-- | storage/perfschema/unittest/pfs_instr-oom-t.cc | 1 | ||||
-rw-r--r-- | storage/perfschema/unittest/pfs_instr-t.cc | 2 | ||||
-rw-r--r-- | storage/perfschema/unittest/pfs_instr_class-oom-t.cc | 1 | ||||
-rw-r--r-- | storage/perfschema/unittest/pfs_instr_class-t.cc | 2 | ||||
-rw-r--r-- | storage/perfschema/unittest/stub_server_misc.h | 21 |
7 files changed, 47 insertions, 1 deletions
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h index 5c74d3944ba..d253cfa4366 100644 --- a/storage/perfschema/pfs_lock.h +++ b/storage/perfschema/pfs_lock.h @@ -135,7 +135,25 @@ struct pfs_lock */ void allocated_to_free(void) { - DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED); +#ifndef DBUG_OFF + extern volatile bool ready_to_exit; +#endif + + /* + If this record is not in the ALLOCATED state and the caller is trying + to free it, this is a bug: the caller is confused, + and potentially damaging data owned by another thread or object. + The correct assert to use here to guarantee data integrity is simply: + DBUG_ASSERT(m_state == PFS_LOCK_ALLOCATED); + Now, because of Bug#56666 (Race condition between the server main thread + and the kill server thread), this assert actually fails during shutdown, + and the failure is legitimate, on concurrent calls to mysql_*_destroy(), + when destroying the instrumentation of an object ... twice. + During shutdown this has no consequences for the performance schema, + so the assert is relaxed with the "|| ready_to_exit" condition as a work + around until Bug#56666 is fixed. + */ + DBUG_ASSERT((m_state == PFS_LOCK_ALLOCATED) || ready_to_exit); PFS_atomic::store_32(&m_state, PFS_LOCK_FREE); } diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index c51f358c4d8..20e736a546f 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -25,6 +25,7 @@ #include <memory.h> #include "stub_print_error.h" +#include "stub_server_misc.h" /* test helpers, to simulate the setup */ diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc index 9a3b179aa56..13335326932 100644 --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -21,6 +21,7 @@ #include <tap.h> #include "stub_pfs_global.h" +#include "stub_server_misc.h" void test_oom() { diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 7dcc8cec7f8..2ef9a5769ca 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -22,6 +22,8 @@ #include <memory.h> +#include "stub_server_misc.h" + void test_no_instruments() { int rc; diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc index 20fa0f3e6ff..9ccaf432ba2 100644 --- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc @@ -20,6 +20,7 @@ #include <tap.h> #include "stub_pfs_global.h" +#include "stub_server_misc.h" void test_oom() { diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc index c5a199727d5..f9a1ee510b1 100644 --- a/storage/perfschema/unittest/pfs_instr_class-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -21,6 +21,8 @@ #include <pfs_global.h> #include <tap.h> +#include "stub_server_misc.h" + void test_no_registration() { int rc; diff --git a/storage/perfschema/unittest/stub_server_misc.h b/storage/perfschema/unittest/stub_server_misc.h new file mode 100644 index 00000000000..17beadbb104 --- /dev/null +++ b/storage/perfschema/unittest/stub_server_misc.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + + 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 + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + Minimal code to be able to link a unit test. +*/ + +volatile bool ready_to_exit= false; + |