Commit 33d8a283 authored by Sergei Golubchik's avatar Sergei Golubchik

5.6.43-84.3

parent a816eac9
# .clang-format file for Percona TokuDB
# Minimum required version of clang-format is 5.0.1. Earlier versions will work
# but may need removal of some parameters.
Language: Cpp
BasedOnStyle: Google
# The following parameters are default for Google style,
# but as they are important for our project they
# are set explicitly here
AlignAfterOpenBracket: Align
BreakBeforeBinaryOperators: None
ColumnLimit: 80
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
UseTab: Never
# Non-default parameters
NamespaceIndentation: All
IndentWidth: 4
TabWidth: 4
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackParameters: false
BinPackArguments: false
ExperimentalAutoDetectBinPacking: false
AllowAllParametersOfDeclarationOnNextLine: false
# not supported in 5.0.1
#AlignConsecutiveAssignments: yes
#AlignConsecutiveDeclarations: yes
BreakStringLiterals: false
ReflowComments: true
This diff is collapsed.
......@@ -104,11 +104,14 @@ All source code and test contributions must be provided under a [BSD 2-Clause][b
License
-------
Portions of the PerconaFT library (the 'locktree' and 'omt') are available under the Apache version 2 license.
PerconaFT is available under the GPL version 2, and AGPL version 3.
See [COPYING.AGPLv3][agpllicense],
See [COPYING.APACHEv2][apachelicense],
[COPYING.AGPLv3][agpllicense],
[COPYING.GPLv2][gpllicense], and
[PATENTS][patents].
[apachelicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.APACHEv2
[agpllicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.AGPLv3
[gpllicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.GPLv2
[patents]: http://github.com/Percona/PerconaFT/blob/master/PATENTS
......@@ -46,11 +46,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
void set_test_txn_sync_callback(void (*) (pthread_t, void*), void*);
#define toku_test_txn_sync_callback(a) ((test_txn_sync_callback)? test_txn_sync_callback( a,test_txn_sync_callback_extra) : (void) 0)
#if TOKU_DEBUG_TXN_SYNC
#if defined(TOKU_DEBUG_TXN_SYNC)
#define toku_debug_txn_sync(a) toku_test_txn_sync_callback(a)
#else
#define toku_debug_txn_sync(a) ((void) 0)
#endif
#endif // defined(TOKU_DEBUG_TXN_SYNC)
typedef struct txn_manager *TXN_MANAGER;
......
......@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -184,9 +184,9 @@ void toku_instr_file_io_end(toku_io_instrumentation &io_instr, ssize_t count) {
void toku_instr_mutex_init(const toku_instr_key &key, toku_mutex_t &mutex) {
mutex.psi_mutex = PSI_MUTEX_CALL(init_mutex)(key.id(), &mutex.pmutex);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
mutex.instr_key_id = key.id();
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
}
void toku_instr_mutex_destroy(PSI_mutex *&mutex_instr) {
......@@ -242,9 +242,9 @@ void toku_instr_mutex_unlock(PSI_mutex *mutex_instr) {
void toku_instr_cond_init(const toku_instr_key &key, toku_cond_t &cond) {
cond.psi_cond = PSI_COND_CALL(init_cond)(key.id(), &cond.pcond);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
cond.instr_key_id = key.id();
#endif
#endif // // defined(TOKU_PTHREAD_DEBUG)
}
void toku_instr_cond_destroy(PSI_cond *&cond_instr) {
......@@ -295,9 +295,9 @@ void toku_instr_cond_broadcast(const toku_cond_t &cond) {
void toku_instr_rwlock_init(const toku_instr_key &key,
toku_pthread_rwlock_t &rwlock) {
rwlock.psi_rwlock = PSI_RWLOCK_CALL(init_rwlock)(key.id(), &rwlock.rwlock);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
rwlock.instr_key_id = key.id();
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
}
void toku_instr_rwlock_destroy(PSI_rwlock *&rwlock_instr) {
......
......@@ -12,8 +12,15 @@
// undefine them here to avoid compilation errors.
#undef __STDC_FORMAT_MACROS
#undef __STDC_LIMIT_MACROS
#include <mysql/psi/mysql_file.h> // PSI_file
#include <mysql/psi/mysql_thread.h> // PSI_mutex
#include "mysql/psi/mysql_file.h" // PSI_file
#include "mysql/psi/mysql_thread.h" // PSI_mutex
#include "mysql/psi/mysql_stage.h" // PSI_stage
#if (MYSQL_VERSION_ID >= 80000)
#include "mysql/psi/mysql_cond.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/psi/mysql_rwlock.h"
#endif // (MYSQL_VERSION_ID >= nn)
#ifndef HAVE_PSI_MUTEX_INTERFACE
#error HAVE_PSI_MUTEX_INTERFACE required
......
......@@ -64,23 +64,23 @@ struct toku_mutex_t {
pthread_mutex_t pmutex;
struct PSI_mutex
*psi_mutex; /* The performance schema instrumentation hook */
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
pthread_t owner; // = pthread_self(); // for debugging
bool locked;
bool valid;
pfs_key_t instr_key_id;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
};
struct toku_cond_t {
pthread_cond_t pcond;
struct PSI_cond *psi_cond;
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
pfs_key_t instr_key_id;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
};
#ifdef TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_COND_INITIALIZER \
{ \
.pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr, \
......@@ -89,14 +89,14 @@ struct toku_cond_t {
#else
#define TOKU_COND_INITIALIZER \
{ .pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr }
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
struct toku_pthread_rwlock_t {
pthread_rwlock_t rwlock;
struct PSI_rwlock *psi_rwlock;
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
pfs_key_t instr_key_id;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
};
typedef struct toku_mutex_aligned {
......@@ -117,7 +117,7 @@ typedef struct toku_mutex_aligned {
#define ZERO_MUTEX_INITIALIZER \
{}
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_MUTEX_INITIALIZER \
{ \
.pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \
......@@ -126,12 +126,12 @@ typedef struct toku_mutex_aligned {
#else
#define TOKU_MUTEX_INITIALIZER \
{ .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr }
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
// Darwin doesn't provide adaptive mutexes
#if defined(__APPLE__)
#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ \
.pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \
......@@ -140,10 +140,10 @@ typedef struct toku_mutex_aligned {
#else
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr }
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
#else // __FreeBSD__, __linux__, at least
#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_ADAPTIVE_NP
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ \
.pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr, \
......@@ -152,8 +152,8 @@ typedef struct toku_mutex_aligned {
#else
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr }
#endif
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
#endif // defined(__APPLE__)
// Different OSes implement mutexes as different amounts of nested structs.
// C++ will fill out all missing values with zeroes if you provide at least one
......@@ -188,7 +188,7 @@ toku_mutexattr_destroy(toku_pthread_mutexattr_t *attr) {
assert_zero(r);
}
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) {
invariant(mutex->locked);
invariant(mutex->owner == pthread_self());
......@@ -197,7 +197,7 @@ static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) {
static inline void
toku_mutex_assert_locked(const toku_mutex_t *mutex __attribute__((unused))) {
}
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
// asserting that a mutex is unlocked only makes sense
// if the calling thread can guaruntee that no other threads
......@@ -207,7 +207,7 @@ toku_mutex_assert_locked(const toku_mutex_t *mutex __attribute__((unused))) {
// when a node is locked the caller knows that no other threads
// can be trying to lock its childrens' mutexes. the children
// are in one of two fixed states: locked or unlocked.
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
static inline void
toku_mutex_assert_unlocked(toku_mutex_t *mutex) {
invariant(mutex->owner == 0);
......@@ -216,7 +216,7 @@ toku_mutex_assert_unlocked(toku_mutex_t *mutex) {
#else
static inline void toku_mutex_assert_unlocked(toku_mutex_t *mutex
__attribute__((unused))) {}
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
#define toku_mutex_lock(M) \
toku_mutex_lock_with_source_location(M, __FILE__, __LINE__)
......@@ -231,13 +231,13 @@ static inline void toku_cond_init(toku_cond_t *cond,
toku_mutex_trylock_with_source_location(M, __FILE__, __LINE__)
inline void toku_mutex_unlock(toku_mutex_t *mutex) {
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->owner == pthread_self());
invariant(mutex->valid);
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
toku_instr_mutex_unlock(mutex->psi_mutex);
int r = pthread_mutex_unlock(&mutex->pmutex);
assert_zero(r);
......@@ -254,13 +254,13 @@ inline void toku_mutex_lock_with_source_location(toku_mutex_t *mutex,
toku_instr_mutex_lock_end(mutex_instr, r);
assert_zero(r);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->valid);
invariant(!mutex->locked);
invariant(mutex->owner == 0);
mutex->locked = true;
mutex->owner = pthread_self();
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
}
inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
......@@ -273,7 +273,7 @@ inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
const int r = pthread_mutex_lock(&mutex->pmutex);
toku_instr_mutex_lock_end(mutex_instr, r);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
if (r == 0) {
invariant(mutex->valid);
invariant(!mutex->locked);
......@@ -281,7 +281,7 @@ inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
mutex->locked = true;
mutex->owner = pthread_self();
}
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
return r;
}
......@@ -310,11 +310,11 @@ inline void toku_cond_wait_with_source_location(toku_cond_t *cond,
const char *src_file,
uint src_line) {
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
/* Instrumentation start */
toku_cond_instrumentation cond_instr;
......@@ -332,11 +332,11 @@ inline void toku_cond_wait_with_source_location(toku_cond_t *cond,
toku_instr_cond_wait_end(cond_instr, r);
assert_zero(r);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(!mutex->locked);
mutex->locked = true;
mutex->owner = pthread_self();
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
}
inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
......@@ -344,11 +344,11 @@ inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
toku_timespec_t *wakeup_at,
const char *src_file,
uint src_line) {
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
/* Instrumentation start */
toku_cond_instrumentation cond_instr;
......@@ -366,11 +366,11 @@ inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
/* Instrumentation end */
toku_instr_cond_wait_end(cond_instr, r);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(!mutex->locked);
mutex->locked = true;
mutex->owner = pthread_self();
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
return r;
}
......@@ -389,26 +389,26 @@ inline void toku_cond_broadcast(toku_cond_t *cond) {
inline void toku_mutex_init(const toku_instr_key &key,
toku_mutex_t *mutex,
const toku_pthread_mutexattr_t *attr) {
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
mutex->valid = true;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
toku_instr_mutex_init(key, *mutex);
const int r = pthread_mutex_init(&mutex->pmutex, attr);
assert_zero(r);
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
mutex->locked = false;
invariant(mutex->valid);
mutex->valid = true;
mutex->owner = 0;
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
}
inline void toku_mutex_destroy(toku_mutex_t *mutex) {
#if TOKU_PTHREAD_DEBUG
#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->valid);
mutex->valid = false;
invariant(!mutex->locked);
#endif
#endif // defined(TOKU_PTHREAD_DEBUG)
toku_instr_mutex_destroy(mutex->psi_mutex);
int r = pthread_mutex_destroy(&mutex->pmutex);
assert_zero(r);
......
......@@ -15,16 +15,12 @@ foreach(tool ${tools})
if ((CMAKE_BUILD_TYPE MATCHES "Debug") AND
(CMAKE_CXX_FLAGS_DEBUG MATCHES " -DENABLED_DEBUG_SYNC"))
if (MYSQL_BASE_VERSION VERSION_EQUAL "8.0")
target_link_libraries(${tool} sql_main sql_gis sql_main binlog rpl master slave ${ICU_LIBRARIES})
target_link_libraries(${tool} sql_main sql_gis sql_main sql_dd sql_gis binlog rpl master slave ${ICU_LIBRARIES})
else ()
target_link_libraries(${tool} sql binlog rpl master slave)
endif ()
else ()
if (MYSQL_BASE_VERSION VERSION_EQUAL "8.0")
target_link_libraries(${tool} mysqlclient)
else ()
target_link_libraries(${tool} perconaserverclient)
endif ()
target_link_libraries(${tool} perconaserverclient)
endif ()
endif ()
......
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
This diff is collapsed.
......@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
----------------------------------------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
......
......@@ -3365,15 +3365,17 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
int ha_tokudb::bulk_insert_poll(void* extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (thd_killed(context->thd)) {
sprintf(context->write_status_msg,
"The process has been killed, aborting bulk load.");
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"The process has been killed, aborting bulk load.");
return ER_ABORTING_CONNECTION;
}
float percentage = progress * 100;
sprintf(context->write_status_msg,
"Loading of data t %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"Loading of data t %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
thd_proc_info(context->thd, context->write_status_msg);
#ifdef HA_TOKUDB_HAS_THD_PROGRESS
thd_progress_report(context->thd, (unsigned long long)percentage, 100);
......@@ -7252,6 +7254,16 @@ int ha_tokudb::create(
tokudb_trx_data *trx = NULL;
THD* thd = ha_thd();
String database_name, table_name, dictionary_name;
tokudb_split_dname(name, database_name, table_name, dictionary_name);
if (database_name.is_empty() || table_name.is_empty()) {
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
ER_TABLE_NAME,
"TokuDB: Table Name or Database Name is empty");
DBUG_RETURN(ER_TABLE_NAME);
}
memset(&kc_info, 0, sizeof(kc_info));
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100999
......@@ -8523,15 +8535,17 @@ int ha_tokudb::tokudb_add_index(
int ha_tokudb::tokudb_add_index_poll(void* extra, float progress) {
LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
if (thd_killed(context->thd)) {
sprintf(context->write_status_msg,
"The process has been killed, aborting add index.");
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"The process has been killed, aborting add index.");
return ER_ABORTING_CONNECTION;
}
float percentage = progress * 100;
sprintf(context->write_status_msg,
"Adding of indexes to %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
snprintf(context->write_status_msg,
sizeof(context->write_status_msg),
"Adding of indexes to %s about %.1f%% done",
context->ha->share->full_table_name(),
percentage);
thd_proc_info(context->thd, context->write_status_msg);
#ifdef HA_TOKUDB_HAS_THD_PROGRESS
thd_progress_report(context->thd, (unsigned long long)percentage, 100);
......
......@@ -41,7 +41,7 @@ class ha_tokudb;
typedef struct loader_context {
THD* thd;
char write_status_msg[200];
char write_status_msg[1024];
ha_tokudb* ha;
} *LOADER_CONTEXT;
......
......@@ -31,6 +31,7 @@ int ha_tokudb::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
uint n_ranges, uint mode,
HANDLER_BUFFER *buf)
{
ds_mrr.init(this, table);
return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
}
......
......@@ -575,10 +575,10 @@ static int tokudb_init_func(void *p) {
db_env->set_update(db_env, tokudb_update_fun);
db_env_set_direct_io(tokudb::sysvars::directio == TRUE);
db_env_set_direct_io(tokudb::sysvars::directio);
db_env_set_compress_buffers_before_eviction(
tokudb::sysvars::compress_buffers_before_eviction == TRUE);
tokudb::sysvars::compress_buffers_before_eviction);
db_env->change_fsync_log_period(db_env, tokudb::sysvars::fsync_log_period);
......
......@@ -190,7 +190,6 @@ inline bool tokudb_killed_thd_callback(void* extra,
return thd_killed(thd) != 0;
}
extern HASH tokudb_open_tables;
extern const char* tokudb_hton_name;
extern int tokudb_hton_initialized;
extern tokudb::thread::rwlock_t tokudb_hton_initialized_lock;
......
CREATE TABLE `#mysql50#q.q`(f1 INT KEY) ENGINE=TOKUDB;
ERROR HY000: Got error 1632 from storage engine
include/assert.inc [Requires tokudb_dir_per_db=1]
CREATE DATABASE `new..............................................end`;
USE `new..............................................end`;
CREATE TABLE t1(a INT KEY,b INT)ENGINE=TokuDB;
INSERT INTO t1 VALUES(1,11),(2,12),(3,13),(4,14),(5,15);
USE test;
DROP DATABASE `new..............................................end`;
CREATE TABLE t1(c1 INT,c2 INT,c3 CHAR(10),c4 CHAR(10),c5 CHAR(10),PRIMARY KEY(c1),INDEX(c3,c4(1),c5(1)),INDEX(c2)) ENGINE=TokuDB;
INSERT INTO t1 VALUES(),(),(),(),();
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
UPDATE t1 SET c1=1 WHERE c1=1 OR c2=1;
DROP TABLE t1;
--source include/have_tokudb.inc
# PS-4979 : Dropping TokuDB table with non-alphanumeric characters could lead
# to a crash
#
# `#mysql50#q.q` is an invalid table name, but the server side doesn't detect it
# and complain. Instead it passes in an empty table name to the engine. The
# engine expects a table name in the form of a relative path like
# "./databasename/tablename". InnoDB detects this in parsing the table name
# during the creation and returns an error.
--error ER_GET_ERRNO
CREATE TABLE `#mysql50#q.q`(f1 INT KEY) ENGINE=TOKUDB;
# Test for PS-5163 : [PS8QA] handle_fatal_signal (sig=11) in DsMrr_impl::dsmrr_init
# and PS-4828 : Inserting data into TokuDB database with name that contains non-alphanumerical characters can lead to the ZN9ha_tokudb16bulk_insert_pollEPvf assertion
#
# The cause is a buffer overrun in LOADER_CONTEXT where the char buffer used for
# maintaining the proc info string was too small and no validation or prevention
# was being done to ensure the string stayed within the limits of the buffer.
# Normally this would have been difficult to hit, but, now with the combination
# of tokudb_dir_per_db=ON and the expansion of the database name from latin1
# (or whatever) to the fscs encoding the space required for a max length
# db.table name could be quite larger than the buffer was originally sized.
--source include/have_tokudb.inc
--let $assert_text= Requires tokudb_dir_per_db=1
--let $assert_cond= [SELECT @@tokudb_dir_per_db] = 1
--source include/assert.inc
CREATE DATABASE `new..............................................end`;
USE `new..............................................end`;
CREATE TABLE t1(a INT KEY,b INT)ENGINE=TokuDB;
#
# TokuDB bulk_insert_poll would crash here
#
INSERT INTO t1 VALUES(1,11),(2,12),(3,13),(4,14),(5,15);
USE test;
DROP DATABASE `new..............................................end`;
--source include/have_tokudb.inc
CREATE TABLE t1(c1 INT,c2 INT,c3 CHAR(10),c4 CHAR(10),c5 CHAR(10),PRIMARY KEY(c1),INDEX(c3,c4(1),c5(1)),INDEX(c2)) ENGINE=TokuDB;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES(),(),(),(),();
# 8.0 asserts here down in data dictionary because ha_tokudb::ds_mrr did not
# properly call ds_mrr.init(this, table)
UPDATE t1 SET c1=1 WHERE c1=1 OR c2=1;
DROP TABLE t1;
......@@ -182,14 +182,14 @@ void* job_manager_t::real_thread_func() {
if (res == tokudb::thread::semaphore_t::E_INTERRUPTED || _shutdown) {
break;
} else if (res == tokudb::thread::semaphore_t::E_SIGNALLED) {
#if TOKUDB_DEBUG
#if defined(TOKUDB_DEBUG)
if (TOKUDB_UNLIKELY(
tokudb::sysvars::debug_pause_background_job_manager)) {
_sem.signal();
tokudb::time::sleep_microsec(250000);
continue;
}
#endif // TOKUDB_DEBUG
#endif // defined(TOKUDB_DEBUG)
mutex_t_lock(_mutex);
assert_debug(_background_jobs.size() > 0);
......
......@@ -662,13 +662,13 @@ static MYSQL_THDVAR_ULONGLONG(
~0ULL,
1);
static MYSQL_THDVAR_STR(
last_lock_timeout,
PLUGIN_VAR_MEMALLOC,
"last lock timeout",
NULL,
NULL,
NULL);
static MYSQL_THDVAR_STR(last_lock_timeout,
PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_NOCMDOPT |
PLUGIN_VAR_READONLY,
"last lock timeout",
NULL,
NULL,
NULL);
static MYSQL_THDVAR_BOOL(
load_save_space,
......
......@@ -93,10 +93,10 @@ extern my_bool gdb_on_fatal;
extern my_bool check_jemalloc;
#if TOKUDB_DEBUG
#if defined(TOKUDB_DEBUG)
// used to control background job manager
extern my_bool debug_pause_background_job_manager;
#endif // TOKUDB_DEBUG
#endif // defined(TOKUDB_DEBUG)
// session/thread
my_bool alter_print_error(THD* thd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment