Commit dde558f2 authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch 'merge-tokudb-5.6' into 10.0-tokudb-merge

parents ca95cc60 f853a99a
SET(TOKUDB_VERSION 5.6.28-76.1)
SET(TOKUDB_VERSION 5.6.30-76.3)
# PerconaFT only supports x86-64 and cmake-2.8.9+
IF(CMAKE_VERSION VERSION_LESS "2.8.9")
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
......@@ -52,7 +52,7 @@ include(CheckCXXCompilerFlag)
# pick language dialect
check_cxx_compiler_flag(-std=c++11 HAVE_STDCXX11)
if (HAVE_STDCXX11)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "-std=c++11 -Wno-deprecated-declarations ${CMAKE_CXX_FLAGS}")
else ()
message(FATAL_ERROR "${CMAKE_CXX_COMPILER} doesn't support -std=c++11, you need one that does.")
endif ()
......
......@@ -95,8 +95,10 @@ set_cflags_if_supported(
-Wno-error=missing-format-attribute
-Wno-error=address-of-array-temporary
-Wno-error=tautological-constant-out-of-range-compare
-Wno-error=maybe-uninitialized
-Wno-ignored-attributes
-Wno-error=extern-c-compat
-Wno-pointer-bool-conversion
-fno-rtti
-fno-exceptions
)
......@@ -152,13 +154,18 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_C_FLAGS_RELEASE "-g -O3 ${CMAKE_C_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG")
else ()
if (APPLE)
set(FLTO_OPTS "-fwhole-program")
else ()
set(FLTO_OPTS "-fuse-linker-plugin")
endif()
# we overwrite this because the default passes -DNDEBUG and we don't want that
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-flto -fuse-linker-plugin ${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-flto -fuse-linker-plugin ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -O3 -UNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin ${CMAKE_C_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "-g -fuse-linker-plugin ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "-g -fuse-linker-plugin ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-flto ${FLTO_OPTS} ${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-flto ${FLTO_OPTS} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -O3 -UNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-g -O3 -flto ${FLTO_OPTS} ${CMAKE_C_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -flto ${FLTO_OPTS} ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "-g ${FLTO_OPTS} ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "-g ${FLTO_OPTS} ${CMAKE_SHARED_LINKER_FLAGS}")
endif ()
## set warnings
......@@ -192,15 +199,6 @@ endif ()
set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_FLAGS}")
## need to set -stdlib=libc++ to get real c++11 support on darwin
if (APPLE)
if (CMAKE_GENERATOR STREQUAL Xcode)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
else ()
add_definitions(-stdlib=libc++)
endif ()
endif ()
# pick language dialect
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
check_cxx_compiler_flag(-std=c++11 HAVE_STDCXX11)
......
......@@ -265,8 +265,8 @@ toku_maybe_upgrade_log(const char *env_dir, const char *log_dir, LSN * lsn_of_cl
TXNID last_xid = TXNID_NONE;
r = verify_clean_shutdown_of_log_version(log_dir, version_of_logs_on_disk, &last_lsn, &last_xid);
if (r != 0) {
if (TOKU_LOG_VERSION_25 <= version_of_logs_on_disk &&
version_of_logs_on_disk <= TOKU_LOG_VERSION_27 &&
if (version_of_logs_on_disk >= TOKU_LOG_VERSION_25 &&
version_of_logs_on_disk <= TOKU_LOG_VERSION_29 &&
TOKU_LOG_VERSION_29 == TOKU_LOG_VERSION) {
r = 0; // can do recovery on dirty shutdown
} else {
......
......@@ -67,7 +67,7 @@ int tokuft_recover(DB_ENV *env,
// Effect: Check the tokuft logs to determine whether or not we need to run recovery.
// If the log is empty or if there is a clean shutdown at the end of the log, then we
// dont need to run recovery.
// don't need to run recovery.
// Returns: true if we need recovery, otherwise false.
int tokuft_needs_recovery(const char *logdir, bool ignore_empty_log);
......
......@@ -112,11 +112,13 @@ if(BUILD_TESTING OR BUILD_FT_TESTS)
declare_custom_tests(test-upgrade-recovery-logs)
file(GLOB upgrade_tests "${TOKUDB_DATA}/upgrade-recovery-logs-??-clean")
file(GLOB upgrade_tests "${CMAKE_CURRENT_SOURCE_DIR}/upgrade.data/upgrade-recovery-logs-??-clean")
foreach(test ${upgrade_tests})
get_filename_component(test_basename "${test}" NAME)
add_ft_test_aux(test-${test_basename} test-upgrade-recovery-logs ${test})
endforeach(test)
file(GLOB upgrade_tests "${TOKUDB_DATA}/upgrade-recovery-logs-??-dirty")
file(GLOB upgrade_tests "${CMAKE_CURRENT_SOURCE_DIR}/upgrade.data/upgrade-recovery-logs-??-dirty")
foreach(test ${upgrade_tests})
get_filename_component(test_basename "${test}" NAME)
add_ft_test_aux(test-${test_basename} test-upgrade-recovery-logs ${test})
......
......@@ -87,7 +87,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
leafnode->max_msn_applied_to_node_on_disk = msn;
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -160,7 +160,7 @@ append_leaf(FT_HANDLE ft, FTNODE leafnode, void *key, uint32_t keylen, void *val
assert(pair2.call_count==2);
}
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -81,7 +81,7 @@ static void run_recovery(const char *testdir) {
bool upgrade_in_progress;
r = toku_maybe_upgrade_log(testdir, testdir, &lsn_of_clean_shutdown, &upgrade_in_progress);
if (strcmp(shutdown, "dirty") == 0 && log_version <= 24) {
CKERR2(r, TOKUDB_UPGRADE_FAILURE); // we dont support dirty upgrade from versions <= 24
CKERR2(r, TOKUDB_UPGRADE_FAILURE); // we don't support dirty upgrade from versions <= 24
return;
} else {
CKERR(r);
......
......@@ -92,7 +92,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
// Create bad tree (don't do following):
// leafnode->max_msn_applied_to_node = msn;
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL,
NULL);
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL,
NULL);
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL,
NULL);
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL,
NULL);
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -79,7 +79,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL,
NULL);
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL,
NULL);
// dont forget to dirty the node
// don't forget to dirty the node
leafnode->dirty = 1;
}
......
......@@ -47,10 +47,10 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "util/omt.h"
//this is only for testing
static void (* test_txn_sync_callback) (uint64_t, void *) = NULL;
static void (* test_txn_sync_callback) (pthread_t, void *) = NULL;
static void * test_txn_sync_callback_extra = NULL;
void set_test_txn_sync_callback(void (*cb) (uint64_t, void *), void *extra) {
void set_test_txn_sync_callback(void (*cb) (pthread_t, void *), void *extra) {
test_txn_sync_callback = cb;
test_txn_sync_callback_extra = extra;
}
......
......@@ -43,7 +43,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/txn/txn.h"
void set_test_txn_sync_callback(void (*) (uint64_t, void*), void*);
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
......
......@@ -2,6 +2,8 @@ include_directories(..)
include_directories(../../src)
include_directories(../../src/tests)
find_library(JEMALLOC_STATIC_LIBRARY libjemalloc.a)
if (BUILD_TESTING)
## reference implementation with simple size-doubling buffer without
## jemalloc size tricks
......@@ -24,15 +26,15 @@ if (BUILD_TESTING)
cursor_test
)
set(_testname ${impl}_${test})
if (with_jemalloc)
if (with_jemalloc AND JEMALLOC_STATIC_LIBRARY)
set(_testname ${_testname}_j)
endif ()
add_executable(${_testname} ${test})
if (with_jemalloc)
if (with_jemalloc AND JEMALLOC_STATIC_LIBRARY)
if (APPLE)
target_link_libraries(${_testname} -Wl,-force_load jemalloc)
target_link_libraries(${_testname} -Wl,-force_load ${JEMALLOC_STATIC_LIBRARY})
else ()
target_link_libraries(${_testname} -Wl,--whole-archive jemalloc -Wl,--no-whole-archive)
target_link_libraries(${_testname} -Wl,--whole-archive ${JEMALLOC_STATIC_LIBRARY} -Wl,--no-whole-archive)
endif ()
endif ()
target_link_libraries(${_testname} ${impl})
......
......@@ -521,14 +521,16 @@ Test output:
}))
def send_mail(toaddrs, subject, body):
m = MIMEText(body)
fromaddr = 'tim@tokutek.com'
m['From'] = fromaddr
m['To'] = ', '.join(toaddrs)
m['Subject'] = subject
s = SMTP('192.168.1.114')
s.sendmail(fromaddr, toaddrs, str(m))
s.quit()
# m = MIMEText(body)
# fromaddr = 'dev-private@percona.com'
# m['From'] = fromaddr
# m['To'] = ', '.join(toaddrs)
# m['Subject'] = subject
# s = SMTP('192.168.1.114')
# s.sendmail(fromaddr, toaddrs, str(m))
# s.quit()
info(subject);
info(body);
def update(tokudb):
info('Updating from git.')
......@@ -554,12 +556,12 @@ def rebuild(tokudb, builddir, tokudb_data, cc, cxx, tests):
env=newenv,
cwd=builddir)
if r != 0:
send_mail(['leif@tokutek.com'], 'Stress tests on %s failed to build.' % gethostname(), '')
send_mail(['dev-private@percona.com'], 'Stress tests on %s failed to build.' % gethostname(), '')
error('Building the tests failed.')
sys.exit(r)
r = call(['make', '-j8'], cwd=builddir)
if r != 0:
send_mail(['leif@tokutek.com'], 'Stress tests on %s failed to build.' % gethostname(), '')
send_mail(['dev-private@percona.com'], 'Stress tests on %s failed to build.' % gethostname(), '')
error('Building the tests failed.')
sys.exit(r)
......@@ -671,7 +673,7 @@ def main(opts):
sys.exit(0)
except Exception, e:
exception('Unhandled exception caught in main.')
send_mail(['leif@tokutek.com'], 'Stress tests caught unhandled exception in main, on %s' % gethostname(), format_exc())
send_mail(['dev-private@percona.com'], 'Stress tests caught unhandled exception in main, on %s' % gethostname(), format_exc())
raise e
if __name__ == '__main__':
......@@ -786,7 +788,7 @@ if __name__ == '__main__':
if not opts.send_emails:
opts.email = None
elif len(opts.email) == 0:
opts.email.append('tokueng@tokutek.com')
opts.email.append('dev-private@percona.com')
if opts.debug:
logging.basicConfig(level=logging.DEBUG)
......
......@@ -313,7 +313,7 @@ indexer_undo_do_provisional(DB_INDEXER *indexer, DB *hotdb, struct ule_prov_info
break;
if (outermost_xid_state != TOKUTXN_LIVE && xrindex > num_committed) {
// if the outermost is not live, then the inner state must be retired. thats the way that the txn API works.
// If the outermost is not live, then the inner state must be retired. That's the way that the txn API works.
assert(this_xid_state == TOKUTXN_RETIRED);
}
......
......@@ -54,9 +54,9 @@ populate_table(int start, int end, DB_TXN * parent, DB_ENV * env, DB * db) {
char str[220];
memset(kk, 0, sizeof kk);
memcpy(kk, &k, sizeof k);
memset(str,'a', sizeof str-1);
memset(str,'a', sizeof str);
DBT key = { .data = kk, .size = sizeof kk };
DBT val = { .data = str, .size = 220 };
DBT val = { .data = str, .size = sizeof str };
r = db->put(db, txn, &key, &val, 0);
assert_zero(r);
}
......
......@@ -83,7 +83,7 @@ static void add_records(DB* db, DB_TXN* txn, uint64_t start_id, uint64_t num) {
for (uint64_t i = 0, j=start_id; i < num; i++,j++) {
char key[100], val[256];
DBT k,v;
snprintf(key, 100, "%08lu", j);
snprintf(key, 100, "%08" PRIu64, j);
snprintf(val, 256, "%*s", 200, key);
r =
db->put(
......@@ -105,7 +105,7 @@ static void delete_records(
for (uint64_t i = 0, j=start_id; i < num; i++,j++) {
char key[100];
DBT k;
snprintf(key, 100, "%08lu", j);
snprintf(key, 100, "%08" PRIu64, j);
r =
db->del(
db,
......@@ -143,7 +143,7 @@ static void test_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf("%s : before commit %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : before commit %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
r = txn->commit(txn, 0);
assert(r == 0);
......@@ -153,7 +153,7 @@ static void test_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf("%s : after commit %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after commit %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
db->close(db, 0);
}
......@@ -175,7 +175,7 @@ static void test_insert_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf("%s : before delete %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : before delete %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
delete_records(db, txn, 0, num_records);
......@@ -184,7 +184,7 @@ static void test_insert_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf("%s : after delete %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after delete %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
r = txn->commit(txn, 0);
assert(r == 0);
......@@ -194,7 +194,7 @@ static void test_insert_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf("%s : after commit %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after commit %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
db->close(db, 0);
}
......@@ -217,7 +217,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf(
"%s : before insert commit %lu rows\n",
"%s : before insert commit %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -230,7 +230,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf(
"%s : after insert commit %lu rows\n",
"%s : after insert commit %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -244,7 +244,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf("%s : after delete %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after delete %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
r = txn->commit(txn, 0);
assert(r == 0);
......@@ -255,7 +255,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf(
"%s : after delete commit %lu rows\n",
"%s : after delete commit %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -279,7 +279,7 @@ static void test_insert_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf("%s : before rollback %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : before rollback %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
r = txn->abort(txn);
assert(r == 0);
......@@ -292,7 +292,7 @@ static void test_insert_rollback(DB_ENV* env) {
// MESSAGES ARE "IN-FLIGHT" IN THE TREE AND MUST BE APPLIED IN ORDER TO
// CORRECT THE RUNNING LOGICAL COUNT
if (verbose)
printf("%s : after rollback %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after rollback %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
full_optimize(db);
......@@ -302,7 +302,7 @@ static void test_insert_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf(
"%s : after rollback optimize %lu rows\n",
"%s : after rollback optimize %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -326,7 +326,7 @@ static void test_insert_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf("%s : before delete %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : before delete %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
delete_records(db, txn, 0, num_records);
......@@ -335,7 +335,7 @@ static void test_insert_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf("%s : after delete %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after delete %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
r = txn->abort(txn);
assert(r == 0);
......@@ -345,7 +345,7 @@ static void test_insert_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf("%s : after commit %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after commit %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
db->close(db, 0);
}
......@@ -368,7 +368,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf(
"%s : before insert commit %lu rows\n",
"%s : before insert commit %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -381,7 +381,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf(
"%s : after insert commit %lu rows\n",
"%s : after insert commit %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -395,7 +395,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats);
if (verbose)
printf("%s : after delete %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after delete %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
r = txn->abort(txn);
assert(r == 0);
......@@ -409,7 +409,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
// CORRECT THE RUNNING LOGICAL COUNT
if (verbose)
printf(
"%s : after delete rollback %lu rows\n",
"%s : after delete rollback %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -421,17 +421,12 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf(
"%s : after delete rollback optimize %lu rows\n",
"%s : after delete rollback optimize %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
db->close(db, 0);
}
static inline uint64_t time_in_microsec() {
struct timeval t;
gettimeofday(&t, NULL);
return t.tv_sec * (1UL * 1000 * 1000) + t.tv_usec;
}
static int test_recount_insert_commit_progress(
uint64_t count,
......@@ -440,7 +435,7 @@ static int test_recount_insert_commit_progress(
if (verbose)
printf(
"%s : count[%lu] deleted[%lu]\n",
"%s : count[%" PRIu64 "] deleted[%" PRIu64 "]\n",
__FUNCTION__,
count,
deleted);
......@@ -469,7 +464,7 @@ static void test_recount_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf(
"%s : before commit %lu rows\n",
"%s : before commit %" PRIu64 " rows\n",
__FUNCTION__,
stats.bt_ndata);
......@@ -481,7 +476,7 @@ static void test_recount_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats);
if (verbose)
printf("%s : after commit %lu rows\n", __FUNCTION__, stats.bt_ndata);
printf("%s : after commit %" PRIu64 " rows\n", __FUNCTION__, stats.bt_ndata);
// test that recount counted correct # of rows
r = db->recount_rows(db, test_recount_insert_commit_progress, NULL);
......
......@@ -92,19 +92,19 @@ struct start_txn_arg {
static struct test_sync sync_s;
static void test_callback(uint64_t self_tid, void * extra) {
static void test_callback(pthread_t self_tid, void * extra) {
pthread_t **p = (pthread_t **) extra;
pthread_t tid_1 = *p[0];
pthread_t tid_2 = *p[1];
assert(self_tid == tid_2);
printf("%s: the thread[%" PRIu64 "] is going to wait...\n", __func__, tid_1);
assert(pthread_equal(self_tid, tid_2));
printf("%s: the thread[%" PRIu64 "] is going to wait...\n", __func__, reinterpret_cast<uint64_t>(tid_1));
test_sync_next_state(&sync_s);
sleep(3);
//test_sync_sleep(&sync_s,3);
//using test_sync_sleep/test_sync_next_state pair can sync threads better, however
//after the fix, this might cause a deadlock. just simply use sleep to do a proof-
//of-concept test.
printf("%s: the thread[%" PRIu64 "] is resuming...\n", __func__, tid_1);
printf("%s: the thread[%" PRIu64 "] is resuming...\n", __func__, reinterpret_cast<uint64_t>(tid_1));
return;
}
......@@ -114,7 +114,7 @@ static void * start_txn2(void * extra) {
DB * db = args->db;
DB_TXN * parent = args->parent;
test_sync_sleep(&sync_s, 1);
printf("start %s [thread %" PRIu64 "]\n", __func__, pthread_self());
printf("start %s [thread %" PRIu64 "]\n", __func__, reinterpret_cast<uint64_t>(pthread_self()));
DB_TXN *txn;
int r = env->txn_begin(env, parent, &txn, DB_READ_COMMITTED);
assert(r == 0);
......@@ -127,7 +127,7 @@ static void * start_txn2(void * extra) {
r = txn->commit(txn, 0);
assert(r == 0);
printf("%s done[thread %" PRIu64 "]\n", __func__, pthread_self());
printf("%s done[thread %" PRIu64 "]\n", __func__, reinterpret_cast<uint64_t>(pthread_self()));
return extra;
}
......@@ -135,14 +135,14 @@ static void * start_txn1(void * extra) {
struct start_txn_arg * args = (struct start_txn_arg *) extra;
DB_ENV * env = args -> env;
DB * db = args->db;
printf("start %s: [thread %" PRIu64 "]\n", __func__, pthread_self());
printf("start %s: [thread %" PRIu64 "]\n", __func__, reinterpret_cast<uint64_t>(pthread_self()));
DB_TXN *txn;
int r = env->txn_begin(env, NULL, &txn, DB_READ_COMMITTED);
assert(r == 0);
printf("%s: txn began by [thread %" PRIu64 "], will wait\n", __func__, pthread_self());
printf("%s: txn began by [thread %" PRIu64 "], will wait\n", __func__, reinterpret_cast<uint64_t>(pthread_self()));
test_sync_next_state(&sync_s);
test_sync_sleep(&sync_s,2);
printf("%s: [thread %" PRIu64 "] resumed\n", __func__, pthread_self());
printf("%s: [thread %" PRIu64 "] resumed\n", __func__, reinterpret_cast<uint64_t>(pthread_self()));
//do some random things...
DBT key, data;
dbt_init(&key, "hello", 6);
......@@ -151,7 +151,7 @@ static void * start_txn1(void * extra) {
db->get(db, txn, &key, &data, 0);
r = txn->commit(txn, 0);
assert(r == 0);
printf("%s: done[thread %" PRIu64 "]\n", __func__, pthread_self());
printf("%s: done[thread %" PRIu64 "]\n", __func__, reinterpret_cast<uint64_t>(pthread_self()));
//test_sync_next_state(&sync_s);
return extra;
}
......
......@@ -3148,7 +3148,7 @@ toku_test_get_latest_lsn(DB_ENV *env) {
return rval.lsn;
}
void toku_set_test_txn_sync_callback(void (* cb) (uint64_t, void *), void * extra) {
void toku_set_test_txn_sync_callback(void (* cb) (pthread_t, void *), void * extra) {
set_test_txn_sync_callback(cb, extra);
}
......
......@@ -60,4 +60,4 @@ extern "C" uint64_t toku_test_get_latest_lsn(DB_ENV *env) __attribute__((__visib
extern "C" int toku_test_get_checkpointing_user_data_status(void) __attribute__((__visibility__("default")));
// test-only function
extern "C" void toku_set_test_txn_sync_callback(void (* ) (uint64_t, void *), void * extra) __attribute__((__visibility__("default")));
extern "C" void toku_set_test_txn_sync_callback(void (* ) (pthread_t, void *), void * extra) __attribute__((__visibility__("default")));
This diff is collapsed.
......@@ -61,9 +61,9 @@ typedef struct loader_context {
class TOKUDB_SHARE {
public:
enum share_state_t {
CLOSED,
OPENED,
ERROR
CLOSED = 0,
OPENED = 1,
ERROR = 2
};
// one time, start up init
......@@ -88,6 +88,9 @@ public:
// exactly 0 _use_count
static void drop_share(TOKUDB_SHARE* share);
// returns state string for logging/reporting
static const char* get_state_string(share_state_t state);
void* operator new(size_t sz);
void operator delete(void* p);
......@@ -306,7 +309,6 @@ private:
// cardinality counts
uint32_t _rec_per_keys;
uint64_t* _rec_per_key;
bool _card_changed;
void init(const char* table_name);
void destroy();
......@@ -315,17 +317,34 @@ inline int TOKUDB_SHARE::use_count() const {
return _use_count;
}
inline void TOKUDB_SHARE::lock() const {
TOKUDB_SHARE_DBUG_ENTER("file[%s]:state[%s]:use_count[%d]",
_full_table_name.ptr(),
get_state_string(_state),
_use_count);
_mutex.lock();
TOKUDB_SHARE_DBUG_VOID_RETURN();
}
inline void TOKUDB_SHARE::unlock() const {
TOKUDB_SHARE_DBUG_ENTER("file[%s]:state[%s]:use_count[%d]",
_full_table_name.ptr(),
get_state_string(_state),
_use_count);
_mutex.unlock();
TOKUDB_SHARE_DBUG_VOID_RETURN();
}
inline TOKUDB_SHARE::share_state_t TOKUDB_SHARE::state() const {
return _state;
}
inline void TOKUDB_SHARE::set_state(TOKUDB_SHARE::share_state_t state) {
TOKUDB_SHARE_DBUG_ENTER("file[%s]:state[%s]:use_count[%d]:new_state[%s]",
_full_table_name.ptr(),
get_state_string(_state),
_use_count,
get_state_string(state));
assert_debug(_mutex.is_owned_by_me());
_state = state;
TOKUDB_SHARE_DBUG_VOID_RETURN();
}
inline const char* TOKUDB_SHARE::full_table_name() const {
return _full_table_name.ptr();
......@@ -346,6 +365,13 @@ inline uint TOKUDB_SHARE::table_name_length() const {
return _table_name.length();
}
inline void TOKUDB_SHARE::set_row_count(uint64_t rows, bool locked) {
TOKUDB_SHARE_DBUG_ENTER("file[%s]:state[%s]:use_count[%d]:rows[%" PRIu64 "]:locked[%d]",
_full_table_name.ptr(),
get_state_string(_state),
_use_count,
rows,
locked);
if (!locked) {
lock();
} else {
......@@ -358,6 +384,7 @@ inline void TOKUDB_SHARE::set_row_count(uint64_t rows, bool locked) {
if (!locked) {
unlock();
}
TOKUDB_SHARE_DBUG_VOID_RETURN();
}
inline ha_rows TOKUDB_SHARE::row_count() const {
return _rows;
......@@ -371,7 +398,6 @@ inline void TOKUDB_SHARE::init_cardinality_counts(
assert_always(_rec_per_key == NULL && _rec_per_keys == 0);
_rec_per_keys = rec_per_keys;
_rec_per_key = rec_per_key;
_card_changed = true;
}
inline void TOKUDB_SHARE::update_cardinality_counts(
uint32_t rec_per_keys,
......@@ -382,7 +408,6 @@ inline void TOKUDB_SHARE::update_cardinality_counts(
assert_always(rec_per_keys == _rec_per_keys);
assert_always(rec_per_key != NULL);
memcpy(_rec_per_key, rec_per_key, _rec_per_keys * sizeof(uint64_t));
_card_changed = true;
}
inline void TOKUDB_SHARE::disallow_auto_analysis() {
assert_debug(_mutex.is_owned_by_me());
......@@ -878,9 +903,8 @@ public:
#endif
// ICP introduced in MariaDB 5.5
Item* idx_cond_push(uint keyno, class Item* idx_cond);
void cancel_pushed_idx_cond();
#if TOKU_INCLUDE_ALTER_56
public:
......@@ -966,13 +990,13 @@ public:
int fill_range_query_buf(
bool need_val,
DBT const *key,
DBT const *row,
DBT const* key,
DBT const* row,
int direction,
THD* thd,
uchar* buf,
DBT* key_to_compare
);
DBT* key_to_compare);
#if TOKU_INCLUDE_ROW_TYPE_COMPRESSION
enum row_type get_row_type() const;
#endif
......@@ -982,9 +1006,7 @@ private:
int get_next(uchar* buf, int direction, DBT* key_to_compare, bool do_key_read);
int read_data_from_range_query_buff(uchar* buf, bool need_val, bool do_key_read);
// for ICP, only in MariaDB and MySQL 5.6
#if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
enum icp_result toku_handler_index_cond_check(Item* pushed_idx_cond);
#endif
void invalidate_bulk_fetch();
void invalidate_icp();
int delete_all_rows_internal();
......
......@@ -374,6 +374,7 @@ void standard_t::on_run() {
_local_txn = false;
}
assert_always(_share->key_file[0] != NULL);
_result = _share->key_file[0]->stat64(_share->key_file[0], _txn, &stat64);
if (_result != 0) {
_result = HA_ADMIN_FAILED;
......@@ -575,6 +576,7 @@ int standard_t::analyze_key_progress(void) {
int standard_t::analyze_key(uint64_t* rec_per_key_part) {
int error = 0;
DB* db = _share->key_file[_current_key];
assert_always(db != NULL);
uint64_t num_key_parts = _share->_key_descriptors[_current_key]._parts;
uint64_t unique_rows[num_key_parts];
bool is_unique = _share->_key_descriptors[_current_key]._is_unique;
......@@ -610,8 +612,8 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) {
analyze_standard_cursor_callback,
this);
memset(&key, 0, sizeof(DBT)); key.flags = DB_DBT_REALLOC;
memset(&prev_key, 0, sizeof(DBT)); prev_key.flags = DB_DBT_REALLOC;
memset(&key, 0, sizeof(DBT));
memset(&prev_key, 0, sizeof(DBT));
copy_key = true;
}
......@@ -679,7 +681,6 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) {
_key_elapsed_time >= _half_time &&
_rows < _half_rows)) {
tokudb::memory::free(key.data); key.data = NULL;
tokudb::memory::free(prev_key.data); prev_key.data = NULL;
close_error = cursor->c_close(cursor);
assert_always(close_error == 0);
......@@ -688,7 +689,6 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) {
}
}
// cleanup
if (key.data) tokudb::memory::free(key.data);
if (prev_key.data) tokudb::memory::free(prev_key.data);
if (cursor) close_error = cursor->c_close(cursor);
assert_always(close_error == 0);
......@@ -770,10 +770,11 @@ int TOKUDB_SHARE::analyze_standard(THD* thd, DB_TXN* txn) {
int result = HA_ADMIN_OK;
// stub out analyze if optimize is remapped to alter recreate + analyze
// when not auto analyze
if (txn &&
thd_sql_command(thd) != SQLCOM_ANALYZE &&
thd_sql_command(thd) != SQLCOM_ALTER_TABLE) {
// when not auto analyze or if this is an alter
if ((txn &&
thd_sql_command(thd) != SQLCOM_ANALYZE &&
thd_sql_command(thd) != SQLCOM_ALTER_TABLE) ||
thd_sql_command(thd) == SQLCOM_ALTER_TABLE) {
TOKUDB_HANDLER_DBUG_RETURN(result);
}
......@@ -897,6 +898,7 @@ int ha_tokudb::do_optimize(THD* thd) {
}
DB* db = share->key_file[i];
assert_always(db != NULL);
error = db->optimize(db);
if (error) {
goto cleanup;
......@@ -1016,7 +1018,8 @@ int ha_tokudb::check(THD* thd, HA_CHECK_OPT* check_opt) {
write_status_msg);
}
for (uint i = 0; i < num_DBs; i++) {
DB *db = share->key_file[i];
DB* db = share->key_file[i];
assert_always(db != NULL);
const char* kname =
i == primary_key ? "primary" : table_share->key_info[i].name;
snprintf(
......
......@@ -680,7 +680,7 @@ int ha_tokudb::alter_table_add_index(
KEY *key = &key_info[i];
*key = ha_alter_info->key_info_buffer[ha_alter_info->index_add_buffer[i]];
for (KEY_PART_INFO* key_part = key->key_part;
key_part < key->key_part + get_key_parts(key);
key_part < key->key_part + key->user_defined_key_parts;
key_part++) {
key_part->field = table->field[key_part->fieldnr];
}
......@@ -1123,7 +1123,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(
// Return true if a field is part of a key
static bool field_in_key(KEY *key, Field *field) {
for (uint i = 0; i < get_key_parts(key); i++) {
for (uint i = 0; i < key->user_defined_key_parts; i++) {
KEY_PART_INFO *key_part = &key->key_part[i];
if (strcmp(key_part->field->field_name, field->field_name) == 0)
return true;
......
......@@ -75,8 +75,8 @@ static bool tables_have_same_keys(
if (print_error) {
sql_print_error(
"keys disagree on if they are clustering, %d, %d",
get_key_parts(curr_orig_key),
get_key_parts(curr_altered_key));
curr_orig_key->user_defined_key_parts,
curr_altered_key->user_defined_key_parts);
}
retval = false;
goto cleanup;
......@@ -86,18 +86,19 @@ static bool tables_have_same_keys(
if (print_error) {
sql_print_error(
"keys disagree on if they are unique, %d, %d",
get_key_parts(curr_orig_key),
get_key_parts(curr_altered_key));
curr_orig_key->user_defined_key_parts,
curr_altered_key->user_defined_key_parts);
}
retval = false;
goto cleanup;
}
if (get_key_parts(curr_orig_key) != get_key_parts(curr_altered_key)) {
if (curr_orig_key->user_defined_key_parts !=
curr_altered_key->user_defined_key_parts) {
if (print_error) {
sql_print_error(
"keys have different number of parts, %d, %d",
get_key_parts(curr_orig_key),
get_key_parts(curr_altered_key));
curr_orig_key->user_defined_key_parts,
curr_altered_key->user_defined_key_parts);
}
retval = false;
goto cleanup;
......@@ -105,7 +106,7 @@ static bool tables_have_same_keys(
//
// now verify that each field in the key is the same
//
for (uint32_t j = 0; j < get_key_parts(curr_orig_key); j++) {
for (uint32_t j = 0; j < curr_orig_key->user_defined_key_parts; j++) {
KEY_PART_INFO* curr_orig_part = &curr_orig_key->key_part[j];
KEY_PART_INFO* curr_altered_part = &curr_altered_key->key_part[j];
Field* curr_orig_field = curr_orig_part->field;
......
......@@ -453,7 +453,7 @@ static bool check_all_update_expressions(
static bool full_field_in_key(TABLE* table, Field* field) {
assert_always(table->s->primary_key < table->s->keys);
KEY* key = &table->s->key_info[table->s->primary_key];
for (uint i = 0; i < get_key_parts(key); i++) {
for (uint i = 0; i < key->user_defined_key_parts; i++) {
KEY_PART_INFO* key_part = &key->key_part[i];
if (strcmp(field->field_name, key_part->field->field_name) == 0) {
return key_part->length == field->field_length;
......@@ -519,7 +519,7 @@ static bool check_point_update(Item* conds, TABLE* table) {
if (bitmap_init(&pk_fields, NULL, table->s->fields, FALSE)) // 1 -> failure
return false;
KEY *key = &table->s->key_info[table->s->primary_key];
for (uint i = 0; i < get_key_parts(key); i++)
for (uint i = 0; i < key->user_defined_key_parts; i++)
bitmap_set_bit(&pk_fields, key->key_part[i].field->field_index);
switch (conds->type()) {
......
......@@ -1010,7 +1010,7 @@ static int create_toku_key_descriptor_for_key(KEY* key, uchar* buf) {
uchar* pos = buf;
uint32_t num_bytes_in_field = 0;
uint32_t charset_num = 0;
for (uint i = 0; i < get_key_parts(key); i++){
for (uint i = 0; i < key->user_defined_key_parts; i++) {
Field* field = key->key_part[i].field;
//
// The first byte states if there is a null byte
......@@ -1881,7 +1881,7 @@ static uint32_t pack_desc_pk_offset_info(
bool is_constant_offset = true;
uint32_t offset = 0;
for (uint i = 0; i < get_key_parts(prim_key); i++) {
for (uint i = 0; i < prim_key->user_defined_key_parts; i++) {
KEY_PART_INFO curr = prim_key->key_part[i];
uint16 curr_field_index = curr.field->field_index;
......@@ -2503,8 +2503,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
//
// store number of parts
//
assert_always(get_key_parts(prim_key) < 128);
pos[0] = 2 * get_key_parts(prim_key);
assert_always(prim_key->user_defined_key_parts < 128);
pos[0] = 2 * prim_key->user_defined_key_parts;
pos++;
//
// for each part, store if it is a fixed field or var field
......@@ -2514,7 +2514,7 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
//
pk_info = pos;
uchar* tmp = pos;
for (uint i = 0; i < get_key_parts(prim_key); i++) {
for (uint i = 0; i < prim_key->user_defined_key_parts; i++) {
tmp += pack_desc_pk_info(
tmp,
kc_info,
......@@ -2525,11 +2525,11 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
//
// asserting that we moved forward as much as we think we have
//
assert_always(tmp - pos == (2 * get_key_parts(prim_key)));
assert_always(tmp - pos == (2 * prim_key->user_defined_key_parts));
pos = tmp;
}
for (uint i = 0; i < get_key_parts(key_info); i++) {
for (uint i = 0; i < key_info->user_defined_key_parts; i++) {
KEY_PART_INFO curr_kpi = key_info->key_part[i];
uint16 field_index = curr_kpi.field->field_index;
Field* field = table_share->field[field_index];
......
......@@ -36,10 +36,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "sql_class.h"
#include "sql_show.h"
#include "discover.h"
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || (50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799)
#include <binlog.h>
#endif
//#include <binlog.h>
#include "debug_sync.h"
#undef PACKAGE
#undef VERSION
......
......@@ -394,6 +394,16 @@ static int tokudb_init_func(void *p) {
db_env->set_errcall(db_env, tokudb_print_error);
db_env->set_errpfx(db_env, tokudb_hton_name);
// Handle deprecated options
if (tokudb::sysvars::pk_insert_mode(NULL) != 1) {
TOKUDB_TRACE("Using tokudb_pk_insert_mode is deprecated and the "
"parameter may be removed in future releases. "
"tokudb_pk_insert_mode=0 is now forbidden. "
"See documentation and release notes for details");
if (tokudb::sysvars::pk_insert_mode(NULL) < 1)
tokudb::sysvars::set_pk_insert_mode(NULL, 1);
}
//
// set default comparison functions
//
......@@ -662,6 +672,7 @@ int tokudb_end(handlerton* hton, ha_panic_function type) {
// count the total number of prepared txn's that we discard
long total_prepared = 0;
#if TOKU_INCLUDE_XA
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "begin XA cleanup");
while (1) {
// get xid's
const long n_xid = 1;
......@@ -686,6 +697,7 @@ int tokudb_end(handlerton* hton, ha_panic_function type) {
}
total_prepared += n_prepared;
}
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "end XA cleanup");
#endif
error = db_env->close(
db_env,
......@@ -910,19 +922,25 @@ static int tokudb_rollback(handlerton * hton, THD * thd, bool all) {
#if TOKU_INCLUDE_XA
static bool tokudb_sync_on_prepare(void) {
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "enter");
// skip sync of log if fsync log period > 0
if (tokudb::sysvars::fsync_log_period > 0)
if (tokudb::sysvars::fsync_log_period > 0) {
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit");
return false;
else
} else {
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit");
return true;
}
}
static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
TOKUDB_DBUG_ENTER("");
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "enter");
int r = 0;
// if tokudb_support_xa is disable, just return
if (!tokudb::sysvars::support_xa(thd)) {
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit %d", r);
TOKUDB_DBUG_RETURN(r);
}
......@@ -932,7 +950,7 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
if (txn) {
uint32_t syncflag = tokudb_sync_on_prepare() ? 0 : DB_TXN_NOSYNC;
TOKUDB_TRACE_FOR_FLAGS(
TOKUDB_DEBUG_TXN,
TOKUDB_DEBUG_XA,
"doing txn prepare:%d:%p",
all,
txn);
......@@ -945,15 +963,18 @@ static int tokudb_xa_prepare(handlerton* hton, THD* thd, bool all) {
// test hook to induce a crash on a debug build
DBUG_EXECUTE_IF("tokudb_crash_prepare_after", DBUG_SUICIDE(););
} else {
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_TXN, "nothing to prepare %d", all);
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "nothing to prepare %d", all);
}
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit %d", r);
TOKUDB_DBUG_RETURN(r);
}
static int tokudb_xa_recover(handlerton* hton, XID* xid_list, uint len) {
TOKUDB_DBUG_ENTER("");
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "enter");
int r = 0;
if (len == 0 || xid_list == NULL) {
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit %d", 0);
TOKUDB_DBUG_RETURN(0);
}
long num_returned = 0;
......@@ -964,11 +985,13 @@ static int tokudb_xa_recover(handlerton* hton, XID* xid_list, uint len) {
&num_returned,
DB_NEXT);
assert_always(r == 0);
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit %ld", num_returned);
TOKUDB_DBUG_RETURN((int)num_returned);
}
static int tokudb_commit_by_xid(handlerton* hton, XID* xid) {
TOKUDB_DBUG_ENTER("");
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "enter");
int r = 0;
DB_TXN* txn = NULL;
TOKU_XA_XID* toku_xid = (TOKU_XA_XID*)xid;
......@@ -981,11 +1004,13 @@ static int tokudb_commit_by_xid(handlerton* hton, XID* xid) {
r = 0;
cleanup:
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit %d", r);
TOKUDB_DBUG_RETURN(r);
}
static int tokudb_rollback_by_xid(handlerton* hton, XID* xid) {
TOKUDB_DBUG_ENTER("");
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "enter");
int r = 0;
DB_TXN* txn = NULL;
TOKU_XA_XID* toku_xid = (TOKU_XA_XID*)xid;
......@@ -998,6 +1023,7 @@ static int tokudb_rollback_by_xid(handlerton* hton, XID* xid) {
r = 0;
cleanup:
TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_XA, "exit %d", r);
TOKUDB_DBUG_RETURN(r);
}
......
......@@ -199,14 +199,4 @@ void tokudb_pretty_left_key(const DB* db, const DBT* key, String* out);
void tokudb_pretty_right_key(const DB* db, const DBT* key, String* out);
const char *tokudb_get_index_name(DB* db);
inline uint get_key_parts(const KEY *key) {
#if (50609 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) || \
(100009 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099)
return key->user_defined_key_parts;
#else
return key->key_parts;
#endif
}
#endif //#ifdef _HATOKU_HTON
SET SESSION tokudb_pk_insert_mode = 2;
Warnings:
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
include/master-slave.inc
[connection master]
==========MASTER==========
......
......@@ -10,8 +10,10 @@ select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
set autocommit=0;
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=600000;
insert into t values (1);
set autocommit=0;
set tokudb_lock_timeout=600000;
insert into t values (1);
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
......@@ -38,9 +40,11 @@ locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right lo
select * from information_schema.tokudb_lock_waits;
requesting_trx_id blocking_trx_id lock_waits_dname lock_waits_key_left lock_waits_key_right lock_waits_start_time lock_waits_table_schema lock_waits_table_name lock_waits_table_dictionary_name
set autocommit=0;
set tokudb_lock_timeout=600000;
set tokudb_prelock_empty=OFF;
replace into t values (1);
set autocommit=0;
set tokudb_lock_timeout=600000;
replace into t values (1);
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
......
......@@ -12,7 +12,9 @@ set autocommit=0;
set tokudb_prelock_empty=OFF;
insert into t values (1);
set autocommit=0;
insert into t values (1);
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=60000;
replace into t values (1);
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
......
......@@ -3,8 +3,8 @@ set tokudb_prelock_empty=false;
drop table if exists t;
create table t (id int primary key);
set autocommit=0;
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
select locks_dname,locks_key_left,locks_key_right,locks_table_schema,locks_table_name,locks_table_dictionary_name from information_schema.tokudb_locks where locks_table_schema='test' and locks_table_name='t' and locks_table_dictionary_name='main' order by locks_key_left, locks_key_right;
locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
insert into t values (1);
insert into t values (3);
insert into t values (5);
......@@ -12,17 +12,17 @@ set autocommit=0;
insert into t values (2);
insert into t values (4);
insert into t values (6);
select * from information_schema.tokudb_locks order by locks_trx_id,locks_key_left;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
TRX_ID MYSQL_ID ./test/t-main 0001000000 0001000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0003000000 0003000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0005000000 0005000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0002000000 0002000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0004000000 0004000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0006000000 0006000000 test t main
select locks_dname,locks_key_left,locks_key_right,locks_table_schema,locks_table_name,locks_table_dictionary_name from information_schema.tokudb_locks where locks_table_schema='test' and locks_table_name='t' and locks_table_dictionary_name='main' order by locks_key_left, locks_key_right;
locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
./test/t-main 0001000000 0001000000 test t main
./test/t-main 0002000000 0002000000 test t main
./test/t-main 0003000000 0003000000 test t main
./test/t-main 0004000000 0004000000 test t main
./test/t-main 0005000000 0005000000 test t main
./test/t-main 0006000000 0006000000 test t main
commit;
commit;
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
select locks_dname,locks_key_left,locks_key_right,locks_table_schema,locks_table_name,locks_table_dictionary_name from information_schema.tokudb_locks where locks_table_schema='test' and locks_table_name='t' and locks_table_dictionary_name='main' order by locks_key_left, locks_key_right;
locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
commit;
drop table t;
......@@ -9,6 +9,8 @@ set autocommit=0;
set tokudb_prelock_empty=OFF;
insert into t values (1);
set autocommit=0;
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=600000;
insert into t values (1);
select * from information_schema.tokudb_locks;
locks_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
......
set default_storage_engine='tokudb';
set tokudb_prelock_empty=false;
drop table if exists t;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
trx_id trx_mysql_thread_id
set autocommit=0;
create table t (id int primary key);
insert into t values (1);
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TXN_ID_DEFAULT CLIENT_ID_DEFAULT
select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
count(trx_mysql_thread_id)
1
commit;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
trx_id trx_mysql_thread_id
set autocommit=0;
insert into t values (2);
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
trx_id trx_mysql_thread_id
TXN_ID_A CLIENT_ID_A
select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
count(trx_mysql_thread_id)
1
select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
count(trx_mysql_thread_id)
0
commit;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
trx_id trx_mysql_thread_id
drop table t;
......@@ -2,25 +2,27 @@ mvcc-19: tokutek
mvcc-20: tokutek
mvcc-27: tokutek
storage_engine_default: tokudb is not the default storage engine
fast_update_blobs : https://tokutek.atlassian.net/browse/DB-871
fast_update_binlog_mixed : https://tokutek.atlassian.net/browse/DB-871
fast_update_binlog_row : https://tokutek.atlassian.net/browse/DB-871
fast_update_binlog_statement : https://tokutek.atlassian.net/browse/DB-871
fast_update_blobs_fixed_varchar : https://tokutek.atlassian.net/browse/DB-871
fast_update_blobs : https://tokutek.atlassian.net/browse/DB-871
fast_update_blobs_with_varchar : https://tokutek.atlassian.net/browse/DB-871
fast_update_char : https://tokutek.atlassian.net/browse/DB-871
fast_update_decr_floor : https://tokutek.atlassian.net/browse/DB-871
fast_update_int : https://tokutek.atlassian.net/browse/DB-871
fast_update_int_bounds : https://tokutek.atlassian.net/browse/DB-871
fast_update_uint_bounds : https://tokutek.atlassian.net/browse/DB-871
fast_update_varchar : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_char : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_int : https://tokutek.atlassian.net/browse/DB-871
fast_update_binlog_statement : https://tokutek.atlassian.net/browse/DB-871
fast_update_deadlock : https://tokutek.atlassian.net/browse/DB-871
fast_update_error : https://tokutek.atlassian.net/browse/DB-871
fast_update_decr_floor : https://tokutek.atlassian.net/browse/DB-871
fast_update_disable_slow_update : https://tokutek.atlassian.net/browse/DB-871
fast_update_error : https://tokutek.atlassian.net/browse/DB-871
fast_update_int_bounds : https://tokutek.atlassian.net/browse/DB-871
fast_update_int : https://tokutek.atlassian.net/browse/DB-871
fast_update_key : https://tokutek.atlassian.net/browse/DB-871
fast_update_sqlmode : https://tokutek.atlassian.net/browse/DB-871
fast_update_uint_bounds : https://tokutek.atlassian.net/browse/DB-871
fast_update_varchar : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_bin_pad : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_char : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_deadlock : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_int : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_key : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_sqlmode : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_values : https://tokutek.atlassian.net/browse/DB-871
......@@ -25,10 +25,12 @@ select * from information_schema.tokudb_lock_waits;
connect (conn_a,localhost,root,,);
set autocommit=0;
set tokudb_prelock_empty=OFF; # disable the bulk loader
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
insert into t values (1);
connect (conn_b,localhost,root,,);
set autocommit=0;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
send insert into t values (1);
# should find the presence of a lock on 1st transaction
......@@ -74,11 +76,13 @@ select * from information_schema.tokudb_lock_waits;
connect (conn_a,localhost,root,,);
set autocommit=0;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
set tokudb_prelock_empty=OFF; # disable the bulk loader
replace into t values (1);
connect (conn_b,localhost,root,,);
set autocommit=0;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
send replace into t values (1);
# should find the presence of a lock on 1st transaction
......
......@@ -21,11 +21,14 @@ insert into t values (1);
connect (conn_b,localhost,root,,);
set autocommit=0;
send insert into t values (1);
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=60000; # set lock wait timeout to 1 minute
send replace into t values (1);
# should find the presence of a lock on 1st transaction
connection default;
let $wait_condition= select count(*)=1 from information_schema.processlist where info='insert into t values (1)' and state='update';
let $wait_condition= select count(*)=1 from information_schema.processlist where info='replace into t values (1)' and state='update';
source include/wait_condition.inc;
real_sleep 1; # delay a little to shorten the update -> write row -> lock wait race
......@@ -41,7 +44,9 @@ replace_column 1 TRX_ID 2 MYSQL_ID;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a;
sleep 5; # sleep longer than the lock timer to force a lock timeout on txn_b
real_sleep 45; # sleep till we get close to timeout since wait_condidion will timeout @ 30 seconds
let $wait_condition= select count(*)=0 from information_schema.processlist where info='replace into t values (1)' and state='update';
source include/wait_condition.inc;
commit;
# verify that the lock on the 1st transaction is released and replaced by the lock for the 2nd transaction
......
......@@ -12,7 +12,7 @@ set autocommit=0;
let $default_id=`select connection_id()`;
# should be empty
select * from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right,locks_table_schema,locks_table_name,locks_table_dictionary_name from information_schema.tokudb_locks where locks_table_schema='test' and locks_table_name='t' and locks_table_dictionary_name='main' order by locks_key_left, locks_key_right;
insert into t values (1);
insert into t values (3);
......@@ -28,8 +28,7 @@ insert into t values (6);
# should find 3 locks for 2 transactions
connection default;
replace_column 1 TRX_ID 2 MYSQL_ID;
eval select * from information_schema.tokudb_locks order by locks_trx_id,locks_key_left;
eval select locks_dname,locks_key_left,locks_key_right,locks_table_schema,locks_table_name,locks_table_dictionary_name from information_schema.tokudb_locks where locks_table_schema='test' and locks_table_name='t' and locks_table_dictionary_name='main' order by locks_key_left, locks_key_right;
connection conn_a;
commit;
......@@ -37,9 +36,9 @@ connection default;
commit;
# should be empty
select * from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right,locks_table_schema,locks_table_name,locks_table_dictionary_name from information_schema.tokudb_locks where locks_table_schema='test' and locks_table_name='t' and locks_table_dictionary_name='main' order by locks_key_left, locks_key_right;
commit;
disconnect conn_a;
drop table t;
\ No newline at end of file
drop table t;
......@@ -27,6 +27,8 @@ insert into t values (1);
connect (conn_b,localhost,root,,);
set autocommit=0;
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
send insert into t values (1);
......
......@@ -8,35 +8,32 @@ drop table if exists t;
enable_warnings;
# should be empty
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
# should have my txn
let $default_id=`select connection_id()`;
set autocommit=0;
create table t (id int primary key);
insert into t values (1);
replace_column 1 TXN_ID_DEFAULT 2 CLIENT_ID_DEFAULT;
eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
# should be empty
commit;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
connect(conn_a,localhost,root,,);
let a_id=`select connection_id()`;
set autocommit=0;
insert into t values (2);
select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
connection default;
replace_column 1 TXN_ID_A 2 CLIENT_ID_A;
eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
connection conn_a;
commit;
connection default;
# should be empty
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
disconnect conn_a;
drop table t;
\ No newline at end of file
drop table t;
......@@ -10,12 +10,6 @@ insert into t1 select t1.file_id+40, t1.file_number+40 from t1;
insert into t1 select t1.file_id+100, t1.file_number+100 from t1;
insert into t1 select t1.file_id+200, t1.file_number+200 from t1;
insert into t1 select t1.file_id+400, t1.file_number+400 from t1;
insert into t1 select t1.file_id+1000, t1.file_number+1000 from t1;
insert into t1 select t1.file_id+10000, t1.file_number+10000 from t1;
insert into t1 select t1.file_id+100000, t1.file_number+100000 from t1;
insert into t1 select t1.file_id+1000000, t1.file_number+1000000 from t1;
insert into t1 select t1.file_id+10000000, t1.file_number+10000000 from t1;
insert into t1 select t1.file_id+100000000, t1.file_number+100000000 from t1;
create table t2 (
file_id bigint unsigned not null,
country char(2) not null,
......
SET SESSION tokudb_auto_analyze = 0;
SET SESSION tokudb_analyze_in_background = 0;
CREATE TABLE t1(
`id` int(10) unsigned NOT NULL,
`k` int(10) unsigned NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
KEY `xid` (`id`),
KEY `k` (`k`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES(1, 1, '1', '1'), (2, 2, '2', '2'), (3, 3, '3', '3'), (4, 4, '4', '4'),
(5, 5, '5', '5'), (6, 6, '6', '6'), (6, 6, '6', '6'), (7, 7, '7', '7'),
(8, 8, '8', '8'), (9, 9, '9', '9'), (10, 10, '10', '10'), (11, 11, '11', '11');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
set DEBUG_SYNC = 'tokudb_icp_desc_scan_invalidate SIGNAL hit1 WAIT_FOR done1';
SELECT c FROM t1 WHERE id BETWEEN 5 AND 8 ORDER BY id DESC;
set DEBUG_SYNC = 'now WAIT_FOR hit1';
set DEBUG_SYNC = 'now SIGNAL done1';
c
8
7
6
6
5
set DEBUG_SYNC = 'tokudb_icp_asc_scan_out_of_range SIGNAL hit2 WAIT_FOR done2';
SELECT c FROM t1 WHERE id BETWEEN 5 AND 8 ORDER BY id ASC;
set DEBUG_SYNC = 'now WAIT_FOR hit2';
set DEBUG_SYNC = 'now SIGNAL done2';
c
5
6
6
7
8
drop table t1;
......@@ -25,11 +25,11 @@ select col1,action from t1_audit;
col1 action
0 DUMMY
1 BEFORE DEL
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0200000000000000 0200000000000000
./test/t1-main ff01000000 0101000000
./test/t1-main 0001000000 0001000000
./test/t1-main ff01000000 0101000000
./test/t1_audit-main 0200000000000000 0200000000000000
commit;
drop trigger t1_trigger;
create trigger t1_trigger after delete on t1
......@@ -46,11 +46,11 @@ col1 action
0 DUMMY
1 BEFORE DEL
2 AFTER DELE
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0300000000000000 0300000000000000
./test/t1-main ff02000000 0102000000
./test/t1-main 0002000000 0002000000
./test/t1-main ff02000000 0102000000
./test/t1_audit-main 0300000000000000 0300000000000000
commit;
drop trigger t1_trigger;
drop table t1;
......
......@@ -25,10 +25,10 @@ select col1,action from t1_audit;
col1 action
0 DUMMY
1 BEFORE INSERT
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0200000000000000 0200000000000000
./test/t1-main 0001000000 0001000000
./test/t1_audit-main 0200000000000000 0200000000000000
commit;
drop trigger t1_trigger;
create trigger t1_trigger after insert on t1
......@@ -46,10 +46,10 @@ col1 action
0 DUMMY
1 BEFORE INSERT
2 AFTER INSERT
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0300000000000000 0300000000000000
./test/t1-main 0002000000 0002000000
./test/t1_audit-main 0300000000000000 0300000000000000
commit;
drop trigger t1_trigger;
drop table t1;
......
......@@ -25,11 +25,11 @@ select col1,action from t1_audit;
col1 action
0 DUMMY
1 BEFORE UPDATE
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0200000000000000 0200000000000000
./test/t1-main ff01000000 0101000000
./test/t1-main 0001000000 0001000000
./test/t1-main ff01000000 0101000000
./test/t1_audit-main 0200000000000000 0200000000000000
commit;
drop trigger t1_trigger;
create trigger t1_trigger after update on t1
......@@ -48,11 +48,11 @@ col1 action
0 DUMMY
1 BEFORE UPDATE
2 AFTER UPDATE
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0300000000000000 0300000000000000
./test/t1-main ff02000000 0102000000
./test/t1-main 0002000000 0002000000
./test/t1-main ff02000000 0102000000
./test/t1_audit-main 0300000000000000 0300000000000000
commit;
drop trigger t1_trigger;
drop table t1, t1_audit;
......@@ -100010,5 +100010,7 @@ insert into t (id,a) values (999,98);
insert into t (id,a) values (999,99);
delete from t where id=404;
set tokudb_pk_insert_mode=2;
Warnings:
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
replace into t values (404,0,0,0);
drop table t;
......@@ -17,5 +17,5 @@ test.t analyze status OK
show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 7 NULL NULL BTREE
t 1 x 1 x A 7 NULL NULL YES BTREE
t 1 x 1 x A 3 NULL NULL YES BTREE
drop table t;
......@@ -46,5 +46,5 @@ show indexes from t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t 0 PRIMARY 1 id A 9 NULL NULL BTREE
t 1 x 1 x A 9 NULL NULL YES BTREE
t 1 y 1 y A 4 NULL NULL YES BTREE
t 1 y 1 y A 9 NULL NULL YES BTREE
drop table t;
drop table if exists t1;
set @orig_table_open_cache = @@global.table_open_cache;
create table t1(a int) engine = tokudb partition by key(a) partitions 2 (partition p0 engine = tokudb, partition p1 engine = tokudb);
lock tables t1 read;
set @@global.table_open_cache = 1;
begin;
insert into t1 values(1),(1);
select * from t1 where c like _ucs2 0x039C0025 collate ucs2_unicode_ci;
ERROR 42S22: Unknown column 'c' in 'where clause'
create table t1(c1 binary (1), c2 varbinary(1));
ERROR 42S01: Table 't1' already exists
unlock tables;
drop table t1;
set @@global.table_open_cache = @orig_table_open_cache;
set @orig_auto_analyze = @@session.tokudb_auto_analyze;
set @orig_in_background = @@session.tokudb_analyze_in_background;
set @orig_mode = @@session.tokudb_analyze_mode;
set @orig_throttle = @@session.tokudb_analyze_throttle;
set @orig_time = @@session.tokudb_analyze_time;
set @orig_scale_percent = @@global.tokudb_cardinality_scale_percent;
set @orig_default_storage_engine = @@session.default_storage_engine;
set @orig_pause_background_job_manager = @@global.tokudb_debug_pause_background_job_manager;
set session default_storage_engine = 'tokudb';
set session tokudb_auto_analyze = 1;
set session tokudb_analyze_in_background = 1;
set session tokudb_analyze_mode = tokudb_analyze_standard;
set session tokudb_analyze_throttle = 0;
set session tokudb_analyze_time = 0;
set global tokudb_cardinality_scale_percent = DEFAULT;
set global tokudb_debug_pause_background_job_manager = TRUE;
create table t1 (a int not null auto_increment, b int, c int, primary key(a), key kb(b), key kc(c), key kabc(a,b,c), key kab(a,b), key kbc(b,c));
insert into t1(b,c) values(0,0), (1,1), (2,2), (3,3);
select database_name, table_name, job_type, job_params, scheduler from information_schema.tokudb_background_job_status;
database_name table_name job_type job_params scheduler
test t1 TOKUDB_ANALYZE_MODE_STANDARD TOKUDB_ANALYZE_DELETE_FRACTION=1.000000; TOKUDB_ANALYZE_TIME=0; TOKUDB_ANALYZE_THROTTLE=0; AUTO
set DEBUG_SYNC = 'tokudb_after_truncate_all_dictionarys SIGNAL closed WAIT_FOR done';
TRUNCATE TABLE t1;
set global tokudb_debug_pause_background_job_manager = FALSE;
set DEBUG_SYNC = 'now SIGNAL done';
drop table t1;
set session tokudb_auto_analyze = @orig_auto_analyze;
set session tokudb_analyze_in_background = @orig_in_background;
set session tokudb_analyze_mode = @orig_mode;
set session tokudb_analyze_throttle = @orig_throttle;
set session tokudb_analyze_time = @orig_time;
set global tokudb_cardinality_scale_percent = @orig_scale_percent;
set session default_storage_engine = @orig_default_storage_engine;
set global tokudb_debug_pause_background_job_manager = @orig_pause_background_job_manager;
set default_storage_engine='tokudb';
drop table if exists t1;
set session tokudb_auto_analyze = 1;
set session tokudb_analyze_in_background = true;
set session tokudb_analyze_mode = TOKUDB_ANALYZE_STANDARD;
set session tokudb_analyze_throttle = 0;
set session tokudb_analyze_time = 0;
create table t1(a int, b text(1), c text(1), filler text(1), primary key(a, b(1)), unique key (a, c(1)));
lock tables t1 write, t1 as a read, t1 as b read;
insert into t1(a) values(1);
alter table t1 drop key a;
unlock tables;
......@@ -110,7 +110,7 @@ a b c d e
5 1 10 NULL NULL
show status like '%Handler_read_prev%';
Variable_name Value
Handler_read_prev 41
Handler_read_prev 799
flush status;
show status like '%Handler_read_prev%';
Variable_name Value
......@@ -142,7 +142,7 @@ a b c d e
20 1 10 NULL NULL
show status like '%Handler_read_prev%';
Variable_name Value
Handler_read_prev 21
Handler_read_prev 399
flush status;
show status like '%Handler_read_next%';
Variable_name Value
......
......@@ -19,12 +19,6 @@ insert into t1 select t1.file_id+40, t1.file_number+40 from t1;
insert into t1 select t1.file_id+100, t1.file_number+100 from t1;
insert into t1 select t1.file_id+200, t1.file_number+200 from t1;
insert into t1 select t1.file_id+400, t1.file_number+400 from t1;
insert into t1 select t1.file_id+1000, t1.file_number+1000 from t1;
insert into t1 select t1.file_id+10000, t1.file_number+10000 from t1;
insert into t1 select t1.file_id+100000, t1.file_number+100000 from t1;
insert into t1 select t1.file_id+1000000, t1.file_number+1000000 from t1;
insert into t1 select t1.file_id+10000000, t1.file_number+10000000 from t1;
insert into t1 select t1.file_id+100000000, t1.file_number+100000000 from t1;
create table t2 (
file_id bigint unsigned not null,
......
# This test for DB-233 tests that icp descending range scans stop properly once
# it fails to find a key match instead of continuing to scan all the way to the
# beginning of the index.
-- source include/have_tokudb.inc
-- source include/have_debug.inc
-- source include/have_debug_sync.inc
-- enable_query_log
SET SESSION tokudb_auto_analyze = 0;
SET SESSION tokudb_analyze_in_background = 0;
CREATE TABLE t1(
`id` int(10) unsigned NOT NULL,
`k` int(10) unsigned NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
KEY `xid` (`id`),
KEY `k` (`k`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES(1, 1, '1', '1'), (2, 2, '2', '2'), (3, 3, '3', '3'), (4, 4, '4', '4'),
(5, 5, '5', '5'), (6, 6, '6', '6'), (6, 6, '6', '6'), (7, 7, '7', '7'),
(8, 8, '8', '8'), (9, 9, '9', '9'), (10, 10, '10', '10'), (11, 11, '11', '11');
ANALYZE TABLE t1;
# lets flip to another connection
connect(conn1, localhost, root);
# set up the DEBUG_SYNC point
set DEBUG_SYNC = 'tokudb_icp_desc_scan_invalidate SIGNAL hit1 WAIT_FOR done1';
# send the query
send SELECT c FROM t1 WHERE id BETWEEN 5 AND 8 ORDER BY id DESC;
# back to default connection
connection default;
# wait for the ICP reverse scan to invalidate
set DEBUG_SYNC = 'now WAIT_FOR hit1';
# lets release and clean up
set DEBUG_SYNC = 'now SIGNAL done1';
connection conn1;
reap;
# set up the DEBUG_SYNC point again, but for the out of range
set DEBUG_SYNC = 'tokudb_icp_asc_scan_out_of_range SIGNAL hit2 WAIT_FOR done2';
# send the query
send SELECT c FROM t1 WHERE id BETWEEN 5 AND 8 ORDER BY id ASC;
# back to default connection
connection default;
# wait for the ICP reverse scan to invalidate
set DEBUG_SYNC = 'now WAIT_FOR hit2';
# lets release and clean up
set DEBUG_SYNC = 'now SIGNAL done2';
connection conn1;
reap;
connection default;
disconnect conn1;
drop table t1;
......@@ -28,7 +28,7 @@ start transaction;
delete from t1 where col1 = 1;
select col1,col2 from t1;
select col1,action from t1_audit;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
# note the locks on t1 and t1_audit
commit;
drop trigger t1_trigger;
......@@ -41,10 +41,10 @@ start transaction;
delete from t1 where col1 = 2;
select col1,col2 from t1;
select col1,action from t1_audit;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
# note the locks on t1 and t1_audit
commit;
drop trigger t1_trigger;
drop table t1;
drop table t1_audit;
\ No newline at end of file
drop table t1_audit;
......@@ -27,7 +27,7 @@ start transaction;
insert into t1 (col1, col2) values (1,1);
select col1,col2 from t1;
select col1,action from t1_audit;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
# note the locks on t1 and t1_audit
commit;
drop trigger t1_trigger;
......@@ -39,10 +39,10 @@ start transaction;
insert into t1 (col1, col2) values (2,2);
select col1,col2 from t1;
select col1,action from t1_audit;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
# note the locks on t1 and t1_audit
commit;
drop trigger t1_trigger;
drop table t1;
drop table t1_audit;
\ No newline at end of file
drop table t1_audit;
......@@ -29,7 +29,7 @@ start transaction;
update t1 set col2=1000 where col1 = 1;
select col1,col2 from t1;
select col1,action from t1_audit;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
# check locks on t1 and t1_audit
commit;
drop trigger t1_trigger;
......@@ -43,7 +43,7 @@ start transaction;
update t1 set col2=1001 where col1 = 2;
select col1,col2 from t1;
select col1,action from t1_audit;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks;
select locks_dname,locks_key_left,locks_key_right from information_schema.tokudb_locks order by locks_dname,locks_key_left,locks_key_right;
# check locks on t1 and t1_audit
commit;
drop trigger t1_trigger;
......
# test DB-917
# test that table/share open lock timeout does not crash the server on subsequent access
source include/have_tokudb.inc;
disable_warnings;
drop table if exists t1;
enable_warnings;
set @orig_table_open_cache = @@global.table_open_cache;
create table t1(a int) engine = tokudb partition by key(a) partitions 2 (partition p0 engine = tokudb, partition p1 engine = tokudb);
lock tables t1 read;
set @@global.table_open_cache = 1;
begin;
insert into t1 values(1),(1);
# when the bug is present, this results in a lock wait timeout
--error ER_BAD_FIELD_ERROR
select * from t1 where c like _ucs2 0x039C0025 collate ucs2_unicode_ci;
# when the bug exists, this results in the assertion
# kc_info->cp_info[keynr] == NULL in tokudb/ha_tokudb.cc initialize_col_pack_info
--error ER_TABLE_EXISTS_ERROR
create table t1(c1 binary (1), c2 varbinary(1));
unlock tables;
drop table t1;
set @@global.table_open_cache = @orig_table_open_cache;
# This test for DB-938 tests a race condition where a scheduled background job
# (analyze) ends up operating on a set of DB* key_file[] in TOKUDB_SHARE that
# were set to NULL during a TRUNCATE TABLE operation.
-- source include/have_tokudb.inc
-- source include/have_debug.inc
-- source include/have_debug_sync.inc
-- enable_query_log
set @orig_auto_analyze = @@session.tokudb_auto_analyze;
set @orig_in_background = @@session.tokudb_analyze_in_background;
set @orig_mode = @@session.tokudb_analyze_mode;
set @orig_throttle = @@session.tokudb_analyze_throttle;
set @orig_time = @@session.tokudb_analyze_time;
set @orig_scale_percent = @@global.tokudb_cardinality_scale_percent;
set @orig_default_storage_engine = @@session.default_storage_engine;
set @orig_pause_background_job_manager = @@global.tokudb_debug_pause_background_job_manager;
# first, lets set up to auto analyze in the background with about any activity
set session default_storage_engine = 'tokudb';
set session tokudb_auto_analyze = 1;
set session tokudb_analyze_in_background = 1;
set session tokudb_analyze_mode = tokudb_analyze_standard;
set session tokudb_analyze_throttle = 0;
set session tokudb_analyze_time = 0;
set global tokudb_cardinality_scale_percent = DEFAULT;
# in debug build, we can prevent the background job manager from running,
# let's do it to hold a job from running until we get the TRUNCATE TABLE
# in action
set global tokudb_debug_pause_background_job_manager = TRUE;
create table t1 (a int not null auto_increment, b int, c int, primary key(a), key kb(b), key kc(c), key kabc(a,b,c), key kab(a,b), key kbc(b,c));
insert into t1(b,c) values(0,0), (1,1), (2,2), (3,3);
# insert above should have triggered an analyze, but since the bjm is paused,
# we will see it sitting in the queue
select database_name, table_name, job_type, job_params, scheduler from information_schema.tokudb_background_job_status;
# lets flip to another connection
connect(conn1, localhost, root);
# set up the DEBUG_SYNC point
set DEBUG_SYNC = 'tokudb_after_truncate_all_dictionarys SIGNAL closed WAIT_FOR done';
# send the truncat table
send TRUNCATE TABLE t1;
# back to default connection
connection default;
# release the bjm
set global tokudb_debug_pause_background_job_manager = FALSE;
# if the bug is present, the bjm should crash here within 1/4 of a second
sleep 5;
# lets release and clean up
set DEBUG_SYNC = 'now SIGNAL done';
connection conn1;
reap;
connection default;
disconnect conn1;
drop table t1;
set session tokudb_auto_analyze = @orig_auto_analyze;
set session tokudb_analyze_in_background = @orig_in_background;
set session tokudb_analyze_mode = @orig_mode;
set session tokudb_analyze_throttle = @orig_throttle;
set session tokudb_analyze_time = @orig_time;
set global tokudb_cardinality_scale_percent = @orig_scale_percent;
set session default_storage_engine = @orig_default_storage_engine;
set global tokudb_debug_pause_background_job_manager = @orig_pause_background_job_manager;
source include/have_tokudb.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists t1;
enable_warnings;
set session tokudb_auto_analyze = 1;
set session tokudb_analyze_in_background = true;
set session tokudb_analyze_mode = TOKUDB_ANALYZE_STANDARD;
set session tokudb_analyze_throttle = 0;
set session tokudb_analyze_time = 0;
create table t1(a int, b text(1), c text(1), filler text(1), primary key(a, b(1)), unique key (a, c(1)));
lock tables t1 write, t1 as a read, t1 as b read;
insert into t1(a) values(1);
alter table t1 drop key a;
unlock tables;
# wait for the bjm queue to empty
-- disable_query_log
let $wait_condition=select count(*)=0 from information_schema.tokudb_background_job_status;
-- source include/wait_condition.inc
drop table t1;
-- source include/have_innodb.inc
-- source include/have_tokudb.inc
-- source include/have_debug.inc
# Valgrind would report memory leaks on the intentional crashes
-- source include/not_valgrind.inc
# Embedded server does not support crashing
-- source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
-- source include/not_crashrep.inc
--disable_warnings
drop table if exists t1, t2;
......
-- source include/have_innodb.inc
-- source include/have_tokudb.inc
-- source include/have_debug.inc
# Valgrind would report memory leaks on the intentional crashes
-- source include/not_valgrind.inc
# Embedded server does not support crashing
-- source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
-- source include/not_crashrep.inc
--disable_warnings
drop table if exists t1, t2;
......
--source include/have_tokudb.inc
--source include/have_debug.inc
# Valgrind would report memory leaks on the intentional crashes
-- source include/not_valgrind.inc
# Embedded server does not support crashing
-- source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
-- source include/not_crashrep.inc
--disable_warnings
drop table if exists t1;
......
partition_basic_symlink_tokudb : tokudb_file_per_table is not supported
partition_reorganize_tokudb : tokudb_file_per_table is not supported
partition_mgm_lc0_tokudb : https://tokutek.atlassian.net/browse/DB-637
partition_mgm_lc1_tokudb : https://tokutek.atlassian.net/browse/DB-637
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master]
call mtr.add_suppression("read free replication is disabled for tokudb table");
CREATE TABLE t (a int(11), b char(20)) ENGINE = TokuDB;
INSERT INTO t (a, b) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e');
SELECT * FROM t;
a b
1 a
2 b
3 c
4 d
5 e
UPDATE t SET a = a + 10 WHERE b = 'b';
SELECT * FROM t;
a b
1 a
12 b
3 c
4 d
5 e
SELECT * FROM t;
a b
1 a
12 b
3 c
4 d
5 e
UPDATE t SET a = a + 10 WHERE b = 'b';
SELECT * FROM t;
a b
1 a
22 b
3 c
4 d
5 e
SELECT * FROM t;
a b
1 a
22 b
3 c
4 d
5 e
DROP TABLE t;
include/rpl_end.inc
--read-only=true --tokudb-rpl-unique-checks=false --tokudb-rpl-lookup-rows=false
# Test case for bug#1536663
#
# When read-free-replication is enabled for tokudb and there is no explicit
# pk for replicated table there can be dublicated records in the table on
# update operation.
#
# Consider this update operation:
# UPDATE t SET a = a + 10 WHERE b = 'b';
# The master does rows lookup and updates the rows which values correspond to
# the condition. The update events are written to binary log with
# rows values from the master. As rows lookup is forbidden for slave
# the new rows are added instead of updating corresponding rows.
#
# Without the fix there will be several rows with b = 'b' in the table on slave
# instead of one updated row.
#
--source include/have_tokudb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
call mtr.add_suppression("read free replication is disabled for tokudb table");
--connection master
CREATE TABLE t (a int(11), b char(20)) ENGINE = TokuDB;
INSERT INTO t (a, b) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e');
--sync_slave_with_master
--sorted_result
SELECT * FROM t;
--let $i = 2
--while($i) {
--dec $i
--connection master
UPDATE t SET a = a + 10 WHERE b = 'b';
--sorted_result
SELECT * FROM t;
--sync_slave_with_master
--sorted_result
SELECT * FROM t;
}
--connection master
DROP TABLE t;
--sync_slave_with_master
--source include/rpl_end.inc
SET @orig_global = @@global.tokudb_pk_insert_mode;
SELECT @orig_global;
@orig_global
1
SET @orig_session = @@session.tokudb_pk_insert_mode;
SELECT @orig_session;
@orig_session
1
SET GLOBAL tokudb_pk_insert_mode = 10;
Warnings:
Warning 1292 Truncated incorrect tokudb_pk_insert_mode value: '10'
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@global.tokudb_pk_insert_mode;
@@global.tokudb_pk_insert_mode
2
SET GLOBAL tokudb_pk_insert_mode = 0;
Warnings:
Warning 131 Using tokudb_pk_insert_mode=0 is deprecated and the parameter may be removed in future releases. Only tokudb_pk_insert_mode=1|2 is allowed.Resettig the value to 1.
SELECT @@global.tokudb_pk_insert_mode;
@@global.tokudb_pk_insert_mode
1
SET GLOBAL tokudb_pk_insert_mode = DEFAULT;
Warnings:
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@global.tokudb_pk_insert_mode;
@@global.tokudb_pk_insert_mode
1
SET GLOBAL tokudb_pk_insert_mode = 'foobar';
ERROR 42000: Incorrect argument type to variable 'tokudb_pk_insert_mode'
SELECT @@global.tokudb_pk_insert_mode;
@@global.tokudb_pk_insert_mode
1
SET SESSION tokudb_pk_insert_mode = 10;
Warnings:
Warning 1292 Truncated incorrect tokudb_pk_insert_mode value: '10'
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@session.tokudb_pk_insert_mode;
@@session.tokudb_pk_insert_mode
2
SET SESSION tokudb_pk_insert_mode = 0;
Warnings:
Warning 131 Using tokudb_pk_insert_mode=0 is deprecated and the parameter may be removed in future releases. Only tokudb_pk_insert_mode=1|2 is allowed.Resettig the value to 1.
SELECT @@session.tokudb_pk_insert_mode;
@@session.tokudb_pk_insert_mode
1
SET SESSION tokudb_pk_insert_mode = DEFAULT;
Warnings:
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@session.tokudb_pk_insert_mode;
@@session.tokudb_pk_insert_mode
1
SET SESSION tokudb_pk_insert_mode = 'foobar';
ERROR 42000: Incorrect argument type to variable 'tokudb_pk_insert_mode'
SELECT @@session.tokudb_pk_insert_mode;
@@session.tokudb_pk_insert_mode
1
SET GLOBAL tokudb_pk_insert_mode = 12;
Warnings:
Warning 1292 Truncated incorrect tokudb_pk_insert_mode value: '12'
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SET SESSION tokudb_pk_insert_mode = 13;
Warnings:
Warning 1292 Truncated incorrect tokudb_pk_insert_mode value: '13'
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@global.tokudb_pk_insert_mode;
@@global.tokudb_pk_insert_mode
2
SELECT @@session.tokudb_pk_insert_mode;
@@session.tokudb_pk_insert_mode
2
SHOW VARIABLES LIKE 'tokudb_pk_insert_mode';
Variable_name Value
tokudb_pk_insert_mode 2
SET SESSION tokudb_pk_insert_mode = @orig_session;
Warnings:
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@session.tokudb_pk_insert_mode;
@@session.tokudb_pk_insert_mode
1
SET GLOBAL tokudb_pk_insert_mode = @orig_global;
Warnings:
Warning 131 Using tokudb_pk_insert_mode is deprecated and the parameter may be removed in future releases.
SELECT @@global.tokudb_pk_insert_mode;
@@global.tokudb_pk_insert_mode
1
--source include/have_tokudb.inc
--enable_warnings
# Check the default value
SET @orig_global = @@global.tokudb_pk_insert_mode;
SELECT @orig_global;
SET @orig_session = @@session.tokudb_pk_insert_mode;
SELECT @orig_session;
# Test global
SET GLOBAL tokudb_pk_insert_mode = 10;
SELECT @@global.tokudb_pk_insert_mode;
SET GLOBAL tokudb_pk_insert_mode = 0;
SELECT @@global.tokudb_pk_insert_mode;
SET GLOBAL tokudb_pk_insert_mode = DEFAULT;
SELECT @@global.tokudb_pk_insert_mode;
-- error ER_WRONG_TYPE_FOR_VAR
SET GLOBAL tokudb_pk_insert_mode = 'foobar';
SELECT @@global.tokudb_pk_insert_mode;
# Test session
SET SESSION tokudb_pk_insert_mode = 10;
SELECT @@session.tokudb_pk_insert_mode;
SET SESSION tokudb_pk_insert_mode = 0;
SELECT @@session.tokudb_pk_insert_mode;
SET SESSION tokudb_pk_insert_mode = DEFAULT;
SELECT @@session.tokudb_pk_insert_mode;
-- error ER_WRONG_TYPE_FOR_VAR
SET SESSION tokudb_pk_insert_mode = 'foobar';
SELECT @@session.tokudb_pk_insert_mode;
# both
SET GLOBAL tokudb_pk_insert_mode = 12;
SET SESSION tokudb_pk_insert_mode = 13;
SELECT @@global.tokudb_pk_insert_mode;
SELECT @@session.tokudb_pk_insert_mode;
SHOW VARIABLES LIKE 'tokudb_pk_insert_mode';
# Clean up
SET SESSION tokudb_pk_insert_mode = @orig_session;
SELECT @@session.tokudb_pk_insert_mode;
SET GLOBAL tokudb_pk_insert_mode = @orig_global;
SELECT @@global.tokudb_pk_insert_mode;
......@@ -27,7 +27,7 @@ namespace tokudb {
uint compute_total_key_parts(TABLE_SHARE *table_share) {
uint total_key_parts = 0;
for (uint i = 0; i < table_share->keys; i++) {
total_key_parts += get_key_parts(&table_share->key_info[i]);
total_key_parts += table_share->key_info[i].user_defined_key_parts;
}
return total_key_parts;
}
......@@ -156,13 +156,14 @@ namespace tokudb {
uint orig_key_parts = 0;
for (uint i = 0; i < table_share->keys; i++) {
orig_key_offset[i] = orig_key_parts;
orig_key_parts += get_key_parts(&table_share->key_info[i]);
orig_key_parts += table_share->key_info[i].user_defined_key_parts;
}
// if orig card data exists, then use it to compute new card data
if (error == 0) {
uint next_key_parts = 0;
for (uint i = 0; error == 0 && i < altered_table_share->keys; i++) {
uint ith_key_parts = get_key_parts(&altered_table_share->key_info[i]);
uint ith_key_parts =
altered_table_share->key_info[i].user_defined_key_parts;
uint orig_key_index;
if (find_index_of_key(
altered_table_share->key_info[i].name,
......
......@@ -50,6 +50,8 @@ static void tokudb_backtrace(void);
#define TOKUDB_DEBUG_UPSERT (1<<12)
#define TOKUDB_DEBUG_CHECK (1<<13)
#define TOKUDB_DEBUG_ANALYZE (1<<14)
#define TOKUDB_DEBUG_XA (1<<15)
#define TOKUDB_DEBUG_SHARE (1<<16)
#define TOKUDB_TRACE(_fmt, ...) { \
fprintf(stderr, "%u %s:%u %s " _fmt "\n", tokudb::thread::my_tid(), \
......@@ -124,7 +126,6 @@ static void tokudb_backtrace(void);
DBUG_RETURN(r); \
}
#define TOKUDB_HANDLER_DBUG_VOID_RETURN { \
if (TOKUDB_UNLIKELY(tokudb::sysvars::debug & TOKUDB_DEBUG_RETURN)) { \
TOKUDB_HANDLER_TRACE("return"); \
......@@ -132,6 +133,61 @@ static void tokudb_backtrace(void);
DBUG_VOID_RETURN; \
}
#define TOKUDB_SHARE_TRACE(_fmt, ...) \
fprintf(stderr, "%u %p %s:%u TOUDB_SHARE::%s " _fmt "\n", \
tokudb::thread::my_tid(), this, __FILE__, __LINE__, \
__FUNCTION__, ##__VA_ARGS__);
#define TOKUDB_SHARE_TRACE_FOR_FLAGS(_flags, _fmt, ...) { \
if (TOKUDB_UNLIKELY(TOKUDB_DEBUG_FLAGS(_flags))) { \
TOKUDB_SHARE_TRACE(_fmt, ##__VA_ARGS__); \
} \
}
#define TOKUDB_SHARE_DBUG_ENTER(_fmt, ...) { \
if (TOKUDB_UNLIKELY((tokudb::sysvars::debug & TOKUDB_DEBUG_ENTER) || \
(tokudb::sysvars::debug & TOKUDB_DEBUG_SHARE))) { \
TOKUDB_SHARE_TRACE(_fmt, ##__VA_ARGS__); \
} \
} \
DBUG_ENTER(__FUNCTION__);
#define TOKUDB_SHARE_DBUG_RETURN(r) { \
int rr = (r); \
if (TOKUDB_UNLIKELY((tokudb::sysvars::debug & TOKUDB_DEBUG_RETURN) || \
(tokudb::sysvars::debug & TOKUDB_DEBUG_SHARE) || \
(rr != 0 && (tokudb::sysvars::debug & TOKUDB_DEBUG_ERROR)))) { \
TOKUDB_SHARE_TRACE("return %d", rr); \
} \
DBUG_RETURN(rr); \
}
#define TOKUDB_SHARE_DBUG_RETURN_DOUBLE(r) { \
double rr = (r); \
if (TOKUDB_UNLIKELY((tokudb::sysvars::debug & TOKUDB_DEBUG_RETURN) || \
(tokudb::sysvars::debug & TOKUDB_DEBUG_SHARE))) { \
TOKUDB_SHARE_TRACE("return %f", rr); \
} \
DBUG_RETURN(rr); \
}
#define TOKUDB_SHARE_DBUG_RETURN_PTR(r) { \
if (TOKUDB_UNLIKELY((tokudb::sysvars::debug & TOKUDB_DEBUG_RETURN) || \
(tokudb::sysvars::debug & TOKUDB_DEBUG_SHARE))) { \
TOKUDB_SHARE_TRACE("return 0x%p", r); \
} \
DBUG_RETURN(r); \
}
#define TOKUDB_SHARE_DBUG_VOID_RETURN() { \
if (TOKUDB_UNLIKELY((tokudb::sysvars::debug & TOKUDB_DEBUG_RETURN) || \
(tokudb::sysvars::debug & TOKUDB_DEBUG_SHARE))) { \
TOKUDB_SHARE_TRACE("return"); \
} \
DBUG_VOID_RETURN; \
}
#define TOKUDB_DBUG_DUMP(s, p, len) \
{ \
TOKUDB_TRACE("%s", s); \
......
......@@ -1121,9 +1121,9 @@ void background_job_status_callback(
table->field[3]->store(type, strlen(type), system_charset_info);
table->field[4]->store(params, strlen(params), system_charset_info);
if (user_scheduled)
table->field[5]->store("USER", sizeof("USER"), system_charset_info);
table->field[5]->store("USER", strlen("USER"), system_charset_info);
else
table->field[5]->store("AUTO", sizeof("AUTO"), system_charset_info);
table->field[5]->store("AUTO", strlen("AUTO"), system_charset_info);
field_store_time_t(table->field[6], scheduled_time);
field_store_time_t(table->field[7], started_time);
......
......@@ -734,12 +734,45 @@ static MYSQL_THDVAR_ULONGLONG(
~0ULL,
1);
static const char* deprecated_tokudb_pk_insert_mode =
"Using tokudb_pk_insert_mode is deprecated and the "
"parameter may be removed in future releases.";
static const char* deprecated_tokudb_pk_insert_mode_zero =
"Using tokudb_pk_insert_mode=0 is deprecated and the "
"parameter may be removed in future releases. "
"Only tokudb_pk_insert_mode=1|2 is allowed."
"Resettig the value to 1.";
static void pk_insert_mode_update(
THD* thd,
st_mysql_sys_var* var,
void* var_ptr,
const void* save) {
const uint* new_pk_insert_mode = static_cast<const uint*>(save);
uint* pk_insert_mode = static_cast<uint*>(var_ptr);
if (*new_pk_insert_mode == 0) {
push_warning(
thd,
Sql_condition::WARN_LEVEL_WARN,
HA_ERR_WRONG_COMMAND,
deprecated_tokudb_pk_insert_mode_zero);
*pk_insert_mode = 1;
} else {
push_warning(
thd,
Sql_condition::WARN_LEVEL_WARN,
HA_ERR_WRONG_COMMAND,
deprecated_tokudb_pk_insert_mode);
*pk_insert_mode = *new_pk_insert_mode;
}
}
static MYSQL_THDVAR_UINT(
pk_insert_mode,
0,
"set the primary key insert mode",
NULL,
NULL,
pk_insert_mode_update,
1,
0,
2,
......@@ -1066,6 +1099,9 @@ ulonglong optimize_throttle(THD* thd) {
uint pk_insert_mode(THD* thd) {
return THDVAR(thd, pk_insert_mode);
}
void set_pk_insert_mode(THD* thd, uint mode) {
THDVAR(thd, pk_insert_mode) = mode;
}
my_bool prelock_empty(THD* thd) {
return (THDVAR(thd, prelock_empty) != 0);
}
......
......@@ -148,6 +148,7 @@ double optimize_index_fraction(THD* thd);
const char* optimize_index_name(THD* thd);
ulonglong optimize_throttle(THD* thd);
uint pk_insert_mode(THD* thd);
void set_pk_insert_mode(THD* thd, uint mode);
my_bool prelock_empty(THD* thd);
uint read_block_size(THD* thd);
uint read_buf_size(THD* thd);
......
......@@ -34,6 +34,55 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
namespace tokudb {
namespace thread {
#if (defined(__MACH__) || defined(__APPLE__)) && _POSIX_TIMERS <= 0
#define _x_min(a, b) ((a) < (b) ? (a) : (b))
#define timed_lock_define(timed_func_name, lock_type_name, lock_func_name) \
inline int timed_func_name(lock_type_name *mutex, \
const struct timespec *abs_timeout) { \
int pthread_rc; \
struct timespec remaining, slept, ts; \
static const int sleep_step = 1000000; \
\
remaining = *abs_timeout; \
while ((pthread_rc = lock_func_name(mutex)) == EBUSY) { \
ts.tv_sec = 0; \
ts.tv_nsec = (remaining.tv_sec > 0 ? \
sleep_step : \
_x_min(remaining.tv_nsec,sleep_step)); \
nanosleep(&ts, &slept); \
ts.tv_nsec -= slept.tv_nsec; \
if (ts.tv_nsec <= remaining.tv_nsec) { \
remaining.tv_nsec -= ts.tv_nsec; \
} else { \
remaining.tv_sec--; \
remaining.tv_nsec = \
(sleep_step - (ts.tv_nsec - remaining.tv_nsec)); \
} \
if (remaining.tv_sec < 0 || \
(!remaining.tv_sec && remaining.tv_nsec <= 0)) { \
return ETIMEDOUT; \
} \
} \
\
return pthread_rc; \
}
timed_lock_define(pthread_mutex_timedlock,
pthread_mutex_t,
pthread_mutex_trylock);
timed_lock_define(pthread_rwlock_timedrdlock,
pthread_rwlock_t,
pthread_rwlock_tryrdlock);
timed_lock_define(pthread_rwlock_timedwrlock,
pthread_rwlock_t,
pthread_rwlock_trywrlock);
#endif //(defined(__MACH__) || defined(__APPLE__)) && _POSIX_TIMERS <= 0
uint my_tid(void);
// Your basic mutex
......
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