Commit f853a99a authored by Sergei Golubchik's avatar Sergei Golubchik

5.6.30-76.3

parent 30d9d4e2
SET(TOKUDB_VERSION 5.6.29-76.2) SET(TOKUDB_VERSION 5.6.30-76.3)
# PerconaFT only supports x86-64 and cmake-2.8.9+ # PerconaFT only supports x86-64 and cmake-2.8.9+
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND
NOT CMAKE_VERSION VERSION_LESS "2.8.9") NOT CMAKE_VERSION VERSION_LESS "2.8.9")
...@@ -21,7 +21,7 @@ include(CheckCXXCompilerFlag) ...@@ -21,7 +21,7 @@ include(CheckCXXCompilerFlag)
# pick language dialect # pick language dialect
check_cxx_compiler_flag(-std=c++11 HAVE_STDCXX11) check_cxx_compiler_flag(-std=c++11 HAVE_STDCXX11)
if (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 () else ()
message(FATAL_ERROR "${CMAKE_CXX_COMPILER} doesn't support -std=c++11, you need one that does.") message(FATAL_ERROR "${CMAKE_CXX_COMPILER} doesn't support -std=c++11, you need one that does.")
endif () endif ()
......
...@@ -95,8 +95,10 @@ set_cflags_if_supported( ...@@ -95,8 +95,10 @@ set_cflags_if_supported(
-Wno-error=missing-format-attribute -Wno-error=missing-format-attribute
-Wno-error=address-of-array-temporary -Wno-error=address-of-array-temporary
-Wno-error=tautological-constant-out-of-range-compare -Wno-error=tautological-constant-out-of-range-compare
-Wno-error=maybe-uninitialized
-Wno-ignored-attributes -Wno-ignored-attributes
-Wno-error=extern-c-compat -Wno-error=extern-c-compat
-Wno-pointer-bool-conversion
-fno-rtti -fno-rtti
-fno-exceptions -fno-exceptions
) )
...@@ -152,13 +154,18 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL Clang) ...@@ -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_C_FLAGS_RELEASE "-g -O3 ${CMAKE_C_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG")
else () 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 # 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_C_FLAGS_RELWITHDEBINFO "-flto ${FLTO_OPTS} ${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_CXX_FLAGS_RELWITHDEBINFO "-flto ${FLTO_OPTS} ${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_C_FLAGS_RELEASE "-g -O3 -flto ${FLTO_OPTS} ${CMAKE_C_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -flto -fuse-linker-plugin ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -flto ${FLTO_OPTS} ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "-g -fuse-linker-plugin ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "-g ${FLTO_OPTS} ${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "-g -fuse-linker-plugin ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-g ${FLTO_OPTS} ${CMAKE_SHARED_LINKER_FLAGS}")
endif () endif ()
## set warnings ## set warnings
...@@ -192,15 +199,6 @@ endif () ...@@ -192,15 +199,6 @@ endif ()
set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Werror ${CMAKE_CXX_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 # pick language dialect
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
check_cxx_compiler_flag(-std=c++11 HAVE_STDCXX11) 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 ...@@ -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; TXNID last_xid = TXNID_NONE;
r = verify_clean_shutdown_of_log_version(log_dir, version_of_logs_on_disk, &last_lsn, &last_xid); r = verify_clean_shutdown_of_log_version(log_dir, version_of_logs_on_disk, &last_lsn, &last_xid);
if (r != 0) { if (r != 0) {
if (TOKU_LOG_VERSION_25 <= version_of_logs_on_disk && if (version_of_logs_on_disk >= TOKU_LOG_VERSION_25 &&
version_of_logs_on_disk <= TOKU_LOG_VERSION_27 && version_of_logs_on_disk <= TOKU_LOG_VERSION_29 &&
TOKU_LOG_VERSION_29 == TOKU_LOG_VERSION) { TOKU_LOG_VERSION_29 == TOKU_LOG_VERSION) {
r = 0; // can do recovery on dirty shutdown r = 0; // can do recovery on dirty shutdown
} else { } else {
......
...@@ -67,7 +67,7 @@ int tokuft_recover(DB_ENV *env, ...@@ -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. // 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 // 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. // Returns: true if we need recovery, otherwise false.
int tokuft_needs_recovery(const char *logdir, bool ignore_empty_log); int tokuft_needs_recovery(const char *logdir, bool ignore_empty_log);
......
...@@ -112,11 +112,13 @@ if(BUILD_TESTING OR BUILD_FT_TESTS) ...@@ -112,11 +112,13 @@ if(BUILD_TESTING OR BUILD_FT_TESTS)
declare_custom_tests(test-upgrade-recovery-logs) declare_custom_tests(test-upgrade-recovery-logs)
file(GLOB upgrade_tests "${TOKUDB_DATA}/upgrade-recovery-logs-??-clean") 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}) foreach(test ${upgrade_tests})
get_filename_component(test_basename "${test}" NAME) get_filename_component(test_basename "${test}" NAME)
add_ft_test_aux(test-${test_basename} test-upgrade-recovery-logs ${test}) add_ft_test_aux(test-${test_basename} test-upgrade-recovery-logs ${test})
endforeach(test) endforeach(test)
file(GLOB upgrade_tests "${TOKUDB_DATA}/upgrade-recovery-logs-??-dirty") 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}) foreach(test ${upgrade_tests})
get_filename_component(test_basename "${test}" NAME) get_filename_component(test_basename "${test}" NAME)
add_ft_test_aux(test-${test_basename} test-upgrade-recovery-logs ${test}) 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) ...@@ -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; 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; leafnode->dirty = 1;
} }
......
...@@ -160,7 +160,7 @@ append_leaf(FT_HANDLE ft, FTNODE leafnode, void *key, uint32_t keylen, void *val ...@@ -160,7 +160,7 @@ append_leaf(FT_HANDLE ft, FTNODE leafnode, void *key, uint32_t keylen, void *val
assert(pair2.call_count==2); assert(pair2.call_count==2);
} }
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -81,7 +81,7 @@ static void run_recovery(const char *testdir) { ...@@ -81,7 +81,7 @@ static void run_recovery(const char *testdir) {
bool upgrade_in_progress; bool upgrade_in_progress;
r = toku_maybe_upgrade_log(testdir, testdir, &lsn_of_clean_shutdown, &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) { 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; return;
} else { } else {
CKERR(r); CKERR(r);
......
...@@ -92,7 +92,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -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): // Create bad tree (don't do following):
// leafnode->max_msn_applied_to_node = msn; // leafnode->max_msn_applied_to_node = msn;
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL, NULL,
NULL); NULL);
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL, NULL,
NULL); NULL);
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL, NULL,
NULL); NULL);
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -77,7 +77,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL, NULL,
NULL); NULL);
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -79,7 +79,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -79,7 +79,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL, NULL,
NULL); NULL);
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -76,7 +76,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL, NULL,
NULL); NULL);
// dont forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->dirty = 1;
} }
......
...@@ -47,10 +47,10 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. ...@@ -47,10 +47,10 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "util/omt.h" #include "util/omt.h"
//this is only for testing //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; 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 = cb;
test_txn_sync_callback_extra = extra; test_txn_sync_callback_extra = extra;
} }
......
...@@ -43,7 +43,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. ...@@ -43,7 +43,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/txn/txn.h" #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) #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 TOKU_DEBUG_TXN_SYNC
......
...@@ -2,6 +2,8 @@ include_directories(..) ...@@ -2,6 +2,8 @@ include_directories(..)
include_directories(../../src) include_directories(../../src)
include_directories(../../src/tests) include_directories(../../src/tests)
find_library(JEMALLOC_STATIC_LIBRARY libjemalloc.a)
if (BUILD_TESTING) if (BUILD_TESTING)
## reference implementation with simple size-doubling buffer without ## reference implementation with simple size-doubling buffer without
## jemalloc size tricks ## jemalloc size tricks
...@@ -24,15 +26,15 @@ if (BUILD_TESTING) ...@@ -24,15 +26,15 @@ if (BUILD_TESTING)
cursor_test cursor_test
) )
set(_testname ${impl}_${test}) set(_testname ${impl}_${test})
if (with_jemalloc) if (with_jemalloc AND JEMALLOC_STATIC_LIBRARY)
set(_testname ${_testname}_j) set(_testname ${_testname}_j)
endif () endif ()
add_executable(${_testname} ${test}) add_executable(${_testname} ${test})
if (with_jemalloc) if (with_jemalloc AND JEMALLOC_STATIC_LIBRARY)
if (APPLE) if (APPLE)
target_link_libraries(${_testname} -Wl,-force_load jemalloc) target_link_libraries(${_testname} -Wl,-force_load ${JEMALLOC_STATIC_LIBRARY})
else () 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 ()
endif () endif ()
target_link_libraries(${_testname} ${impl}) target_link_libraries(${_testname} ${impl})
......
...@@ -521,14 +521,16 @@ Test output: ...@@ -521,14 +521,16 @@ Test output:
})) }))
def send_mail(toaddrs, subject, body): def send_mail(toaddrs, subject, body):
m = MIMEText(body) # m = MIMEText(body)
fromaddr = 'tim@tokutek.com' # fromaddr = 'dev-private@percona.com'
m['From'] = fromaddr # m['From'] = fromaddr
m['To'] = ', '.join(toaddrs) # m['To'] = ', '.join(toaddrs)
m['Subject'] = subject # m['Subject'] = subject
s = SMTP('192.168.1.114') # s = SMTP('192.168.1.114')
s.sendmail(fromaddr, toaddrs, str(m)) # s.sendmail(fromaddr, toaddrs, str(m))
s.quit() # s.quit()
info(subject);
info(body);
def update(tokudb): def update(tokudb):
info('Updating from git.') info('Updating from git.')
...@@ -554,12 +556,12 @@ def rebuild(tokudb, builddir, tokudb_data, cc, cxx, tests): ...@@ -554,12 +556,12 @@ def rebuild(tokudb, builddir, tokudb_data, cc, cxx, tests):
env=newenv, env=newenv,
cwd=builddir) cwd=builddir)
if r != 0: 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.') error('Building the tests failed.')
sys.exit(r) sys.exit(r)
r = call(['make', '-j8'], cwd=builddir) r = call(['make', '-j8'], cwd=builddir)
if r != 0: 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.') error('Building the tests failed.')
sys.exit(r) sys.exit(r)
...@@ -671,7 +673,7 @@ def main(opts): ...@@ -671,7 +673,7 @@ def main(opts):
sys.exit(0) sys.exit(0)
except Exception, e: except Exception, e:
exception('Unhandled exception caught in main.') 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 raise e
if __name__ == '__main__': if __name__ == '__main__':
...@@ -786,7 +788,7 @@ if __name__ == '__main__': ...@@ -786,7 +788,7 @@ if __name__ == '__main__':
if not opts.send_emails: if not opts.send_emails:
opts.email = None opts.email = None
elif len(opts.email) == 0: elif len(opts.email) == 0:
opts.email.append('tokueng@tokutek.com') opts.email.append('dev-private@percona.com')
if opts.debug: if opts.debug:
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
......
...@@ -313,7 +313,7 @@ indexer_undo_do_provisional(DB_INDEXER *indexer, DB *hotdb, struct ule_prov_info ...@@ -313,7 +313,7 @@ indexer_undo_do_provisional(DB_INDEXER *indexer, DB *hotdb, struct ule_prov_info
break; break;
if (outermost_xid_state != TOKUTXN_LIVE && xrindex > num_committed) { 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); assert(this_xid_state == TOKUTXN_RETIRED);
} }
......
...@@ -54,9 +54,9 @@ populate_table(int start, int end, DB_TXN * parent, DB_ENV * env, DB * db) { ...@@ -54,9 +54,9 @@ populate_table(int start, int end, DB_TXN * parent, DB_ENV * env, DB * db) {
char str[220]; char str[220];
memset(kk, 0, sizeof kk); memset(kk, 0, sizeof kk);
memcpy(kk, &k, sizeof k); memcpy(kk, &k, sizeof k);
memset(str,'a', sizeof str-1); memset(str,'a', sizeof str);
DBT key = { .data = kk, .size = sizeof kk }; 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); r = db->put(db, txn, &key, &val, 0);
assert_zero(r); assert_zero(r);
} }
......
...@@ -83,7 +83,7 @@ static void add_records(DB* db, DB_TXN* txn, uint64_t start_id, uint64_t num) { ...@@ -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++) { for (uint64_t i = 0, j=start_id; i < num; i++,j++) {
char key[100], val[256]; char key[100], val[256];
DBT k,v; DBT k,v;
snprintf(key, 100, "%08lu", j); snprintf(key, 100, "%08" PRIu64, j);
snprintf(val, 256, "%*s", 200, key); snprintf(val, 256, "%*s", 200, key);
r = r =
db->put( db->put(
...@@ -105,7 +105,7 @@ static void delete_records( ...@@ -105,7 +105,7 @@ static void delete_records(
for (uint64_t i = 0, j=start_id; i < num; i++,j++) { for (uint64_t i = 0, j=start_id; i < num; i++,j++) {
char key[100]; char key[100];
DBT k; DBT k;
snprintf(key, 100, "%08lu", j); snprintf(key, 100, "%08" PRIu64, j);
r = r =
db->del( db->del(
db, db,
...@@ -143,7 +143,7 @@ static void test_insert_commit(DB_ENV* env) { ...@@ -143,7 +143,7 @@ static void test_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) 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); r = txn->commit(txn, 0);
assert(r == 0); assert(r == 0);
...@@ -153,7 +153,7 @@ static void test_insert_commit(DB_ENV* env) { ...@@ -153,7 +153,7 @@ static void test_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) 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); db->close(db, 0);
} }
...@@ -175,7 +175,7 @@ static void test_insert_delete_commit(DB_ENV* env) { ...@@ -175,7 +175,7 @@ static void test_insert_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) 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); delete_records(db, txn, 0, num_records);
...@@ -184,7 +184,7 @@ static void test_insert_delete_commit(DB_ENV* env) { ...@@ -184,7 +184,7 @@ static void test_insert_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) 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); r = txn->commit(txn, 0);
assert(r == 0); assert(r == 0);
...@@ -194,7 +194,7 @@ static void test_insert_delete_commit(DB_ENV* env) { ...@@ -194,7 +194,7 @@ static void test_insert_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) 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); db->close(db, 0);
} }
...@@ -217,7 +217,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) { ...@@ -217,7 +217,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) if (verbose)
printf( printf(
"%s : before insert commit %lu rows\n", "%s : before insert commit %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -230,7 +230,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) { ...@@ -230,7 +230,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) if (verbose)
printf( printf(
"%s : after insert commit %lu rows\n", "%s : after insert commit %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -244,7 +244,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) { ...@@ -244,7 +244,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) 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); r = txn->commit(txn, 0);
assert(r == 0); assert(r == 0);
...@@ -255,7 +255,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) { ...@@ -255,7 +255,7 @@ static void test_insert_commit_delete_commit(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) if (verbose)
printf( printf(
"%s : after delete commit %lu rows\n", "%s : after delete commit %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -279,7 +279,7 @@ static void test_insert_rollback(DB_ENV* env) { ...@@ -279,7 +279,7 @@ static void test_insert_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) 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); r = txn->abort(txn);
assert(r == 0); assert(r == 0);
...@@ -292,7 +292,7 @@ static void test_insert_rollback(DB_ENV* env) { ...@@ -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 // MESSAGES ARE "IN-FLIGHT" IN THE TREE AND MUST BE APPLIED IN ORDER TO
// CORRECT THE RUNNING LOGICAL COUNT // CORRECT THE RUNNING LOGICAL COUNT
if (verbose) 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); full_optimize(db);
...@@ -302,7 +302,7 @@ static void test_insert_rollback(DB_ENV* env) { ...@@ -302,7 +302,7 @@ static void test_insert_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) if (verbose)
printf( printf(
"%s : after rollback optimize %lu rows\n", "%s : after rollback optimize %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -326,7 +326,7 @@ static void test_insert_delete_rollback(DB_ENV* env) { ...@@ -326,7 +326,7 @@ static void test_insert_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) 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); delete_records(db, txn, 0, num_records);
...@@ -335,7 +335,7 @@ static void test_insert_delete_rollback(DB_ENV* env) { ...@@ -335,7 +335,7 @@ static void test_insert_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) 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); r = txn->abort(txn);
assert(r == 0); assert(r == 0);
...@@ -345,7 +345,7 @@ static void test_insert_delete_rollback(DB_ENV* env) { ...@@ -345,7 +345,7 @@ static void test_insert_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) 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); db->close(db, 0);
} }
...@@ -368,7 +368,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) { ...@@ -368,7 +368,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) if (verbose)
printf( printf(
"%s : before insert commit %lu rows\n", "%s : before insert commit %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -381,7 +381,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) { ...@@ -381,7 +381,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) if (verbose)
printf( printf(
"%s : after insert commit %lu rows\n", "%s : after insert commit %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -395,7 +395,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) { ...@@ -395,7 +395,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(0, stats); CHECK_NUM_ROWS(0, stats);
if (verbose) 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); r = txn->abort(txn);
assert(r == 0); assert(r == 0);
...@@ -409,7 +409,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) { ...@@ -409,7 +409,7 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
// CORRECT THE RUNNING LOGICAL COUNT // CORRECT THE RUNNING LOGICAL COUNT
if (verbose) if (verbose)
printf( printf(
"%s : after delete rollback %lu rows\n", "%s : after delete rollback %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -421,17 +421,12 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) { ...@@ -421,17 +421,12 @@ static void test_insert_commit_delete_rollback(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) if (verbose)
printf( printf(
"%s : after delete rollback optimize %lu rows\n", "%s : after delete rollback optimize %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
db->close(db, 0); 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( static int test_recount_insert_commit_progress(
uint64_t count, uint64_t count,
...@@ -440,7 +435,7 @@ static int test_recount_insert_commit_progress( ...@@ -440,7 +435,7 @@ static int test_recount_insert_commit_progress(
if (verbose) if (verbose)
printf( printf(
"%s : count[%lu] deleted[%lu]\n", "%s : count[%" PRIu64 "] deleted[%" PRIu64 "]\n",
__FUNCTION__, __FUNCTION__,
count, count,
deleted); deleted);
...@@ -469,7 +464,7 @@ static void test_recount_insert_commit(DB_ENV* env) { ...@@ -469,7 +464,7 @@ static void test_recount_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) if (verbose)
printf( printf(
"%s : before commit %lu rows\n", "%s : before commit %" PRIu64 " rows\n",
__FUNCTION__, __FUNCTION__,
stats.bt_ndata); stats.bt_ndata);
...@@ -481,7 +476,7 @@ static void test_recount_insert_commit(DB_ENV* env) { ...@@ -481,7 +476,7 @@ static void test_recount_insert_commit(DB_ENV* env) {
CHECK_NUM_ROWS(num_records, stats); CHECK_NUM_ROWS(num_records, stats);
if (verbose) 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 // test that recount counted correct # of rows
r = db->recount_rows(db, test_recount_insert_commit_progress, NULL); r = db->recount_rows(db, test_recount_insert_commit_progress, NULL);
......
...@@ -92,19 +92,19 @@ struct start_txn_arg { ...@@ -92,19 +92,19 @@ struct start_txn_arg {
static struct test_sync sync_s; 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 **p = (pthread_t **) extra;
pthread_t tid_1 = *p[0]; pthread_t tid_1 = *p[0];
pthread_t tid_2 = *p[1]; pthread_t tid_2 = *p[1];
assert(self_tid == tid_2); assert(pthread_equal(self_tid, tid_2));
printf("%s: the thread[%" PRIu64 "] is going to wait...\n", __func__, tid_1); printf("%s: the thread[%" PRIu64 "] is going to wait...\n", __func__, reinterpret_cast<uint64_t>(tid_1));
test_sync_next_state(&sync_s); test_sync_next_state(&sync_s);
sleep(3); sleep(3);
//test_sync_sleep(&sync_s,3); //test_sync_sleep(&sync_s,3);
//using test_sync_sleep/test_sync_next_state pair can sync threads better, however //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- //after the fix, this might cause a deadlock. just simply use sleep to do a proof-
//of-concept test. //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; return;
} }
...@@ -114,7 +114,7 @@ static void * start_txn2(void * extra) { ...@@ -114,7 +114,7 @@ static void * start_txn2(void * extra) {
DB * db = args->db; DB * db = args->db;
DB_TXN * parent = args->parent; DB_TXN * parent = args->parent;
test_sync_sleep(&sync_s, 1); 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; DB_TXN *txn;
int r = env->txn_begin(env, parent, &txn, DB_READ_COMMITTED); int r = env->txn_begin(env, parent, &txn, DB_READ_COMMITTED);
assert(r == 0); assert(r == 0);
...@@ -127,7 +127,7 @@ static void * start_txn2(void * extra) { ...@@ -127,7 +127,7 @@ static void * start_txn2(void * extra) {
r = txn->commit(txn, 0); r = txn->commit(txn, 0);
assert(r == 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; return extra;
} }
...@@ -135,14 +135,14 @@ static void * start_txn1(void * extra) { ...@@ -135,14 +135,14 @@ static void * start_txn1(void * extra) {
struct start_txn_arg * args = (struct start_txn_arg *) extra; struct start_txn_arg * args = (struct start_txn_arg *) extra;
DB_ENV * env = args -> env; DB_ENV * env = args -> env;
DB * db = args->db; 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; DB_TXN *txn;
int r = env->txn_begin(env, NULL, &txn, DB_READ_COMMITTED); int r = env->txn_begin(env, NULL, &txn, DB_READ_COMMITTED);
assert(r == 0); 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_next_state(&sync_s);
test_sync_sleep(&sync_s,2); 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... //do some random things...
DBT key, data; DBT key, data;
dbt_init(&key, "hello", 6); dbt_init(&key, "hello", 6);
...@@ -151,7 +151,7 @@ static void * start_txn1(void * extra) { ...@@ -151,7 +151,7 @@ static void * start_txn1(void * extra) {
db->get(db, txn, &key, &data, 0); db->get(db, txn, &key, &data, 0);
r = txn->commit(txn, 0); r = txn->commit(txn, 0);
assert(r == 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); //test_sync_next_state(&sync_s);
return extra; return extra;
} }
......
...@@ -3148,7 +3148,7 @@ toku_test_get_latest_lsn(DB_ENV *env) { ...@@ -3148,7 +3148,7 @@ toku_test_get_latest_lsn(DB_ENV *env) {
return rval.lsn; 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); 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 ...@@ -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"))); extern "C" int toku_test_get_checkpointing_user_data_status(void) __attribute__((__visibility__("default")));
// test-only function // 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.
...@@ -903,9 +903,8 @@ class ha_tokudb : public handler { ...@@ -903,9 +903,8 @@ class ha_tokudb : public handler {
#endif #endif
// ICP introduced in MariaDB 5.5
Item* idx_cond_push(uint keyno, class Item* idx_cond); Item* idx_cond_push(uint keyno, class Item* idx_cond);
void cancel_pushed_idx_cond();
#if TOKU_INCLUDE_ALTER_56 #if TOKU_INCLUDE_ALTER_56
public: public:
...@@ -991,13 +990,13 @@ class ha_tokudb : public handler { ...@@ -991,13 +990,13 @@ class ha_tokudb : public handler {
int fill_range_query_buf( int fill_range_query_buf(
bool need_val, bool need_val,
DBT const *key, DBT const* key,
DBT const *row, DBT const* row,
int direction, int direction,
THD* thd, THD* thd,
uchar* buf, uchar* buf,
DBT* key_to_compare DBT* key_to_compare);
);
#if TOKU_INCLUDE_ROW_TYPE_COMPRESSION #if TOKU_INCLUDE_ROW_TYPE_COMPRESSION
enum row_type get_row_type() const; enum row_type get_row_type() const;
#endif #endif
...@@ -1007,9 +1006,7 @@ class ha_tokudb : public handler { ...@@ -1007,9 +1006,7 @@ class ha_tokudb : public handler {
int get_next(uchar* buf, int direction, DBT* key_to_compare, bool do_key_read); 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); 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 // 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); enum icp_result toku_handler_index_cond_check(Item* pushed_idx_cond);
#endif
void invalidate_bulk_fetch(); void invalidate_bulk_fetch();
void invalidate_icp(); void invalidate_icp();
int delete_all_rows_internal(); int delete_all_rows_internal();
......
...@@ -612,8 +612,8 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) { ...@@ -612,8 +612,8 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) {
analyze_standard_cursor_callback, analyze_standard_cursor_callback,
this); this);
memset(&key, 0, sizeof(DBT)); key.flags = DB_DBT_REALLOC; memset(&key, 0, sizeof(DBT));
memset(&prev_key, 0, sizeof(DBT)); prev_key.flags = DB_DBT_REALLOC; memset(&prev_key, 0, sizeof(DBT));
copy_key = true; copy_key = true;
} }
...@@ -681,7 +681,6 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) { ...@@ -681,7 +681,6 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) {
_key_elapsed_time >= _half_time && _key_elapsed_time >= _half_time &&
_rows < _half_rows)) { _rows < _half_rows)) {
tokudb::memory::free(key.data); key.data = NULL;
tokudb::memory::free(prev_key.data); prev_key.data = NULL; tokudb::memory::free(prev_key.data); prev_key.data = NULL;
close_error = cursor->c_close(cursor); close_error = cursor->c_close(cursor);
assert_always(close_error == 0); assert_always(close_error == 0);
...@@ -690,7 +689,6 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) { ...@@ -690,7 +689,6 @@ int standard_t::analyze_key(uint64_t* rec_per_key_part) {
} }
} }
// cleanup // cleanup
if (key.data) tokudb::memory::free(key.data);
if (prev_key.data) tokudb::memory::free(prev_key.data); if (prev_key.data) tokudb::memory::free(prev_key.data);
if (cursor) close_error = cursor->c_close(cursor); if (cursor) close_error = cursor->c_close(cursor);
assert_always(close_error == 0); assert_always(close_error == 0);
...@@ -772,10 +770,11 @@ int TOKUDB_SHARE::analyze_standard(THD* thd, DB_TXN* txn) { ...@@ -772,10 +770,11 @@ int TOKUDB_SHARE::analyze_standard(THD* thd, DB_TXN* txn) {
int result = HA_ADMIN_OK; int result = HA_ADMIN_OK;
// stub out analyze if optimize is remapped to alter recreate + analyze // stub out analyze if optimize is remapped to alter recreate + analyze
// when not auto analyze // when not auto analyze or if this is an alter
if (txn && if ((txn &&
thd_sql_command(thd) != SQLCOM_ANALYZE && thd_sql_command(thd) != SQLCOM_ANALYZE &&
thd_sql_command(thd) != SQLCOM_ALTER_TABLE) { thd_sql_command(thd) != SQLCOM_ALTER_TABLE) ||
thd_sql_command(thd) == SQLCOM_ALTER_TABLE) {
TOKUDB_HANDLER_DBUG_RETURN(result); TOKUDB_HANDLER_DBUG_RETURN(result);
} }
......
...@@ -406,6 +406,16 @@ static int tokudb_init_func(void *p) { ...@@ -406,6 +406,16 @@ static int tokudb_init_func(void *p) {
db_env->set_errcall(db_env, tokudb_print_error); db_env->set_errcall(db_env, tokudb_print_error);
db_env->set_errpfx(db_env, tokudb_hton_name); 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 // set default comparison functions
// //
......
...@@ -10,8 +10,10 @@ select * from information_schema.tokudb_lock_waits; ...@@ -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 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 autocommit=0;
set tokudb_prelock_empty=OFF; set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=600000;
insert into t values (1); insert into t values (1);
set autocommit=0; set autocommit=0;
set tokudb_lock_timeout=600000;
insert into t values (1); insert into t values (1);
select * from information_schema.tokudb_locks; 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 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 ...@@ -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; 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 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 autocommit=0;
set tokudb_lock_timeout=600000;
set tokudb_prelock_empty=OFF; set tokudb_prelock_empty=OFF;
replace into t values (1); replace into t values (1);
set autocommit=0; set autocommit=0;
set tokudb_lock_timeout=600000;
replace into t values (1); replace into t values (1);
select * from information_schema.tokudb_locks; 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 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; ...@@ -12,7 +12,9 @@ set autocommit=0;
set tokudb_prelock_empty=OFF; set tokudb_prelock_empty=OFF;
insert into t values (1); insert into t values (1);
set autocommit=0; 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; 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 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 0001000000 0001000000 test t main
......
...@@ -3,8 +3,8 @@ set tokudb_prelock_empty=false; ...@@ -3,8 +3,8 @@ set tokudb_prelock_empty=false;
drop table if exists t; drop table if exists t;
create table t (id int primary key); create table t (id int primary key);
set autocommit=0; set autocommit=0;
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;
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 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 (1);
insert into t values (3); insert into t values (3);
insert into t values (5); insert into t values (5);
...@@ -12,17 +12,17 @@ set autocommit=0; ...@@ -12,17 +12,17 @@ set autocommit=0;
insert into t values (2); insert into t values (2);
insert into t values (4); insert into t values (4);
insert into t values (6); insert into t values (6);
select * from information_schema.tokudb_locks order by locks_trx_id,locks_key_left; 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_trx_id locks_mysql_thread_id locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name 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 ./test/t-main 0001000000 0001000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0003000000 0003000000 test t main ./test/t-main 0002000000 0002000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0005000000 0005000000 test t main ./test/t-main 0003000000 0003000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0002000000 0002000000 test t main ./test/t-main 0004000000 0004000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0004000000 0004000000 test t main ./test/t-main 0005000000 0005000000 test t main
TRX_ID MYSQL_ID ./test/t-main 0006000000 0006000000 test t main ./test/t-main 0006000000 0006000000 test t main
commit; commit;
commit; commit;
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;
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 locks_dname locks_key_left locks_key_right locks_table_schema locks_table_name locks_table_dictionary_name
commit; commit;
drop table t; drop table t;
...@@ -9,6 +9,8 @@ set autocommit=0; ...@@ -9,6 +9,8 @@ set autocommit=0;
set tokudb_prelock_empty=OFF; set tokudb_prelock_empty=OFF;
insert into t values (1); insert into t values (1);
set autocommit=0; set autocommit=0;
set tokudb_prelock_empty=OFF;
set tokudb_lock_timeout=600000;
insert into t values (1); insert into t values (1);
select * from information_schema.tokudb_locks; 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 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 default_storage_engine='tokudb';
set tokudb_prelock_empty=false; set tokudb_prelock_empty=false;
drop table if exists t; 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 trx_id trx_mysql_thread_id
set autocommit=0; set autocommit=0;
create table t (id int primary key); create table t (id int primary key);
insert into t values (1); insert into t values (1);
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());
trx_id trx_mysql_thread_id count(trx_mysql_thread_id)
TXN_ID_DEFAULT CLIENT_ID_DEFAULT 1
commit; 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 trx_id trx_mysql_thread_id
set autocommit=0; set autocommit=0;
insert into t values (2); insert into t values (2);
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());
trx_id trx_mysql_thread_id count(trx_mysql_thread_id)
TXN_ID_A CLIENT_ID_A 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; 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 trx_id trx_mysql_thread_id
drop table t; drop table t;
...@@ -2,25 +2,27 @@ mvcc-19: tokutek ...@@ -2,25 +2,27 @@ mvcc-19: tokutek
mvcc-20: tokutek mvcc-20: tokutek
mvcc-27: tokutek mvcc-27: tokutek
storage_engine_default: tokudb is not the default storage engine 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_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_blobs_with_varchar : https://tokutek.atlassian.net/browse/DB-871
fast_update_char : 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_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_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_key : https://tokutek.atlassian.net/browse/DB-871
fast_update_sqlmode : 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_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_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_key : https://tokutek.atlassian.net/browse/DB-871
fast_upsert_sqlmode : 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 fast_upsert_values : https://tokutek.atlassian.net/browse/DB-871
...@@ -20,10 +20,12 @@ select * from information_schema.tokudb_lock_waits; ...@@ -20,10 +20,12 @@ select * from information_schema.tokudb_lock_waits;
connect (conn_a,localhost,root,,); connect (conn_a,localhost,root,,);
set autocommit=0; set autocommit=0;
set tokudb_prelock_empty=OFF; # disable the bulk loader 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); insert into t values (1);
connect (conn_b,localhost,root,,); connect (conn_b,localhost,root,,);
set autocommit=0; set autocommit=0;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
send insert into t values (1); send insert into t values (1);
# should find the presence of a lock on 1st transaction # should find the presence of a lock on 1st transaction
...@@ -69,11 +71,13 @@ select * from information_schema.tokudb_lock_waits; ...@@ -69,11 +71,13 @@ select * from information_schema.tokudb_lock_waits;
connect (conn_a,localhost,root,,); connect (conn_a,localhost,root,,);
set autocommit=0; set autocommit=0;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
set tokudb_prelock_empty=OFF; # disable the bulk loader set tokudb_prelock_empty=OFF; # disable the bulk loader
replace into t values (1); replace into t values (1);
connect (conn_b,localhost,root,,); connect (conn_b,localhost,root,,);
set autocommit=0; set autocommit=0;
set tokudb_lock_timeout=600000; # set lock wait timeout to 10 minutes
send replace into t values (1); send replace into t values (1);
# should find the presence of a lock on 1st transaction # should find the presence of a lock on 1st transaction
......
...@@ -21,11 +21,14 @@ insert into t values (1); ...@@ -21,11 +21,14 @@ insert into t values (1);
connect (conn_b,localhost,root,,); connect (conn_b,localhost,root,,);
set autocommit=0; 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 # should find the presence of a lock on 1st transaction
connection default; 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; source include/wait_condition.inc;
real_sleep 1; # delay a little to shorten the update -> write row -> lock wait race 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; ...@@ -41,7 +44,9 @@ replace_column 1 TRX_ID 2 MYSQL_ID;
select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a; 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; commit;
# verify that the lock on the 1st transaction is released and replaced by the lock for the 2nd transaction # 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; ...@@ -12,7 +12,7 @@ set autocommit=0;
let $default_id=`select connection_id()`; let $default_id=`select connection_id()`;
# should be empty # 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 (1);
insert into t values (3); insert into t values (3);
...@@ -28,8 +28,7 @@ insert into t values (6); ...@@ -28,8 +28,7 @@ insert into t values (6);
# should find 3 locks for 2 transactions # should find 3 locks for 2 transactions
connection default; connection default;
replace_column 1 TRX_ID 2 MYSQL_ID; 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;
eval select * from information_schema.tokudb_locks order by locks_trx_id,locks_key_left;
connection conn_a; connection conn_a;
commit; commit;
...@@ -37,9 +36,9 @@ connection default; ...@@ -37,9 +36,9 @@ connection default;
commit; commit;
# should be empty # 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; commit;
disconnect conn_a; disconnect conn_a;
drop table t; drop table t;
\ No newline at end of file
...@@ -22,6 +22,8 @@ insert into t values (1); ...@@ -22,6 +22,8 @@ insert into t values (1);
connect (conn_b,localhost,root,,); connect (conn_b,localhost,root,,);
set autocommit=0; 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); send insert into t values (1);
......
...@@ -8,35 +8,32 @@ drop table if exists t; ...@@ -8,35 +8,32 @@ drop table if exists t;
enable_warnings; enable_warnings;
# should be empty # 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 # should have my txn
let $default_id=`select connection_id()`;
set autocommit=0; set autocommit=0;
create table t (id int primary key); create table t (id int primary key);
insert into t values (1); insert into t values (1);
replace_column 1 TXN_ID_DEFAULT 2 CLIENT_ID_DEFAULT; select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
# should be empty # should be empty
commit; 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,,); connect(conn_a,localhost,root,,);
let a_id=`select connection_id()`;
set autocommit=0; set autocommit=0;
insert into t values (2); 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; connection default;
replace_column 1 TXN_ID_A 2 CLIENT_ID_A; select count(trx_mysql_thread_id) from information_schema.tokudb_trx where trx_mysql_thread_id in(connection_id());
eval select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx;
connection conn_a; connection conn_a;
commit; commit;
connection default; connection default;
# should be empty # 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; disconnect conn_a;
drop table t; drop table t;
\ No newline at end of file
...@@ -10,12 +10,6 @@ insert into t1 select t1.file_id+40, t1.file_number+40 from t1; ...@@ -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+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+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+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 ( create table t2 (
file_id bigint unsigned not null, file_id bigint unsigned not null,
country char(2) 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; ...@@ -25,11 +25,11 @@ select col1,action from t1_audit;
col1 action col1 action
0 DUMMY 0 DUMMY
1 BEFORE DEL 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 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 0001000000 0001000000
./test/t1-main ff01000000 0101000000
./test/t1_audit-main 0200000000000000 0200000000000000
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
create trigger t1_trigger after delete on t1 create trigger t1_trigger after delete on t1
...@@ -46,11 +46,11 @@ col1 action ...@@ -46,11 +46,11 @@ col1 action
0 DUMMY 0 DUMMY
1 BEFORE DEL 1 BEFORE DEL
2 AFTER DELE 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 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 0002000000 0002000000
./test/t1-main ff02000000 0102000000
./test/t1_audit-main 0300000000000000 0300000000000000
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
drop table t1; drop table t1;
......
...@@ -25,10 +25,10 @@ select col1,action from t1_audit; ...@@ -25,10 +25,10 @@ select col1,action from t1_audit;
col1 action col1 action
0 DUMMY 0 DUMMY
1 BEFORE INSERT 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 locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0200000000000000 0200000000000000
./test/t1-main 0001000000 0001000000 ./test/t1-main 0001000000 0001000000
./test/t1_audit-main 0200000000000000 0200000000000000
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
create trigger t1_trigger after insert on t1 create trigger t1_trigger after insert on t1
...@@ -46,10 +46,10 @@ col1 action ...@@ -46,10 +46,10 @@ col1 action
0 DUMMY 0 DUMMY
1 BEFORE INSERT 1 BEFORE INSERT
2 AFTER 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 locks_dname locks_key_left locks_key_right
./test/t1_audit-main 0300000000000000 0300000000000000
./test/t1-main 0002000000 0002000000 ./test/t1-main 0002000000 0002000000
./test/t1_audit-main 0300000000000000 0300000000000000
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
drop table t1; drop table t1;
......
...@@ -25,11 +25,11 @@ select col1,action from t1_audit; ...@@ -25,11 +25,11 @@ select col1,action from t1_audit;
col1 action col1 action
0 DUMMY 0 DUMMY
1 BEFORE UPDATE 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 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 0001000000 0001000000
./test/t1-main ff01000000 0101000000
./test/t1_audit-main 0200000000000000 0200000000000000
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
create trigger t1_trigger after update on t1 create trigger t1_trigger after update on t1
...@@ -48,11 +48,11 @@ col1 action ...@@ -48,11 +48,11 @@ col1 action
0 DUMMY 0 DUMMY
1 BEFORE UPDATE 1 BEFORE UPDATE
2 AFTER 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 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 0002000000 0002000000
./test/t1-main ff02000000 0102000000
./test/t1_audit-main 0300000000000000 0300000000000000
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
drop table t1, t1_audit; drop table t1, t1_audit;
...@@ -100010,5 +100010,7 @@ insert into t (id,a) values (999,98); ...@@ -100010,5 +100010,7 @@ insert into t (id,a) values (999,98);
insert into t (id,a) values (999,99); insert into t (id,a) values (999,99);
delete from t where id=404; delete from t where id=404;
set tokudb_pk_insert_mode=2; 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); replace into t values (404,0,0,0);
drop table t; drop table t;
...@@ -15,7 +15,7 @@ test.t analyze status OK ...@@ -15,7 +15,7 @@ test.t analyze status OK
show indexes from t; 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 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 5 NULL NULL BTREE t 0 PRIMARY 1 id A 5 NULL NULL BTREE
t 1 x 1 x A 2 NULL NULL YES BTREE t 1 x 1 x A 5 NULL NULL YES BTREE
t 1 y 1 y A 5 NULL NULL YES BTREE t 1 y 1 y A 5 NULL NULL YES BTREE
alter table t analyze partition p1; alter table t analyze partition p1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
...@@ -23,13 +23,13 @@ test.t analyze status OK ...@@ -23,13 +23,13 @@ test.t analyze status OK
show indexes from t; 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 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 5 NULL NULL BTREE t 0 PRIMARY 1 id A 5 NULL NULL BTREE
t 1 x 1 x A 2 NULL NULL YES BTREE t 1 x 1 x A 5 NULL NULL YES BTREE
t 1 y 1 y A 5 NULL NULL YES BTREE t 1 y 1 y A 5 NULL NULL YES BTREE
insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1); insert into t values (100,1,1),(200,2,1),(300,3,1),(400,4,1),(500,5,1);
show indexes from t; 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 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 0 PRIMARY 1 id A 9 NULL NULL BTREE
t 1 x 1 x A 4 NULL NULL YES BTREE t 1 x 1 x A 9 NULL NULL YES BTREE
t 1 y 1 y A 9 NULL NULL YES BTREE t 1 y 1 y A 9 NULL NULL YES BTREE
alter table t analyze partition p0; alter table t analyze partition p0;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
...@@ -46,5 +46,5 @@ show indexes from 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 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 0 PRIMARY 1 id A 9 NULL NULL BTREE
t 1 x 1 x A 9 NULL NULL YES 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 t;
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 ...@@ -110,7 +110,7 @@ a b c d e
5 1 10 NULL NULL 5 1 10 NULL NULL
show status like '%Handler_read_prev%'; show status like '%Handler_read_prev%';
Variable_name Value Variable_name Value
Handler_read_prev 41 Handler_read_prev 799
flush status; flush status;
show status like '%Handler_read_prev%'; show status like '%Handler_read_prev%';
Variable_name Value Variable_name Value
...@@ -142,7 +142,7 @@ a b c d e ...@@ -142,7 +142,7 @@ a b c d e
20 1 10 NULL NULL 20 1 10 NULL NULL
show status like '%Handler_read_prev%'; show status like '%Handler_read_prev%';
Variable_name Value Variable_name Value
Handler_read_prev 21 Handler_read_prev 399
flush status; flush status;
show status like '%Handler_read_next%'; show status like '%Handler_read_next%';
Variable_name Value Variable_name Value
......
...@@ -19,12 +19,6 @@ insert into t1 select t1.file_id+40, t1.file_number+40 from t1; ...@@ -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+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+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+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 ( create table t2 (
file_id bigint unsigned not null, 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; ...@@ -28,7 +28,7 @@ start transaction;
delete from t1 where col1 = 1; delete from t1 where col1 = 1;
select col1,col2 from t1; select col1,col2 from t1;
select col1,action from t1_audit; 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 # note the locks on t1 and t1_audit
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
...@@ -41,10 +41,10 @@ start transaction; ...@@ -41,10 +41,10 @@ start transaction;
delete from t1 where col1 = 2; delete from t1 where col1 = 2;
select col1,col2 from t1; select col1,col2 from t1;
select col1,action from t1_audit; 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 # note the locks on t1 and t1_audit
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
drop table t1; drop table t1;
drop table t1_audit; drop table t1_audit;
\ No newline at end of file
...@@ -27,7 +27,7 @@ start transaction; ...@@ -27,7 +27,7 @@ start transaction;
insert into t1 (col1, col2) values (1,1); insert into t1 (col1, col2) values (1,1);
select col1,col2 from t1; select col1,col2 from t1;
select col1,action from t1_audit; 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 # note the locks on t1 and t1_audit
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
...@@ -39,10 +39,10 @@ start transaction; ...@@ -39,10 +39,10 @@ start transaction;
insert into t1 (col1, col2) values (2,2); insert into t1 (col1, col2) values (2,2);
select col1,col2 from t1; select col1,col2 from t1;
select col1,action from t1_audit; 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 # note the locks on t1 and t1_audit
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
drop table t1; drop table t1;
drop table t1_audit; drop table t1_audit;
\ No newline at end of file
...@@ -29,7 +29,7 @@ start transaction; ...@@ -29,7 +29,7 @@ start transaction;
update t1 set col2=1000 where col1 = 1; update t1 set col2=1000 where col1 = 1;
select col1,col2 from t1; select col1,col2 from t1;
select col1,action from t1_audit; 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 # check locks on t1 and t1_audit
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
...@@ -43,7 +43,7 @@ start transaction; ...@@ -43,7 +43,7 @@ start transaction;
update t1 set col2=1001 where col1 = 2; update t1 set col2=1001 where col1 = 2;
select col1,col2 from t1; select col1,col2 from t1;
select col1,action from t1_audit; 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 # check locks on t1 and t1_audit
commit; commit;
drop trigger t1_trigger; drop trigger t1_trigger;
......
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;
partition_basic_symlink_tokudb : tokudb_file_per_table is not supported partition_basic_symlink_tokudb : tokudb_file_per_table is not supported
partition_reorganize_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
SET SESSION tokudb_pk_insert_mode = 2; 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 include/master-slave.inc
Warnings: Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
......
--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;
...@@ -734,12 +734,45 @@ static MYSQL_THDVAR_ULONGLONG( ...@@ -734,12 +734,45 @@ static MYSQL_THDVAR_ULONGLONG(
~0ULL, ~0ULL,
1); 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( static MYSQL_THDVAR_UINT(
pk_insert_mode, pk_insert_mode,
0, 0,
"set the primary key insert mode", "set the primary key insert mode",
NULL, NULL,
NULL, pk_insert_mode_update,
1, 1,
0, 0,
2, 2,
...@@ -1064,6 +1097,9 @@ ulonglong optimize_throttle(THD* thd) { ...@@ -1064,6 +1097,9 @@ ulonglong optimize_throttle(THD* thd) {
uint pk_insert_mode(THD* thd) { uint pk_insert_mode(THD* thd) {
return THDVAR(thd, pk_insert_mode); 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) { my_bool prelock_empty(THD* thd) {
return (THDVAR(thd, prelock_empty) != 0); return (THDVAR(thd, prelock_empty) != 0);
} }
......
...@@ -128,6 +128,7 @@ double optimize_index_fraction(THD* thd); ...@@ -128,6 +128,7 @@ double optimize_index_fraction(THD* thd);
const char* optimize_index_name(THD* thd); const char* optimize_index_name(THD* thd);
ulonglong optimize_throttle(THD* thd); ulonglong optimize_throttle(THD* thd);
uint pk_insert_mode(THD* thd); uint pk_insert_mode(THD* thd);
void set_pk_insert_mode(THD* thd, uint mode);
my_bool prelock_empty(THD* thd); my_bool prelock_empty(THD* thd);
uint read_block_size(THD* thd); uint read_block_size(THD* thd);
uint read_buf_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. ...@@ -34,6 +34,55 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
namespace tokudb { namespace tokudb {
namespace thread { 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); uint my_tid(void);
// Your basic mutex // 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