Commit 4668e079 authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch '10.2' into 10.3

parents 223aee2e fbcae42c
...@@ -2,8 +2,10 @@ include/rpl_init.inc [topology=1->2] ...@@ -2,8 +2,10 @@ include/rpl_init.inc [topology=1->2]
*** MDEV-5509: Incorrect value for Seconds_Behind_Master if parallel replication *** *** MDEV-5509: Incorrect value for Seconds_Behind_Master if parallel replication ***
connection server_2; connection server_2;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
set @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5; SET GLOBAL slave_parallel_threads=5;
set global slave_parallel_mode= optimistic;
include/start_slave.inc include/start_slave.inc
connection server_1; connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT); CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
...@@ -157,6 +159,7 @@ UNLOCK TABLES; ...@@ -157,6 +159,7 @@ UNLOCK TABLES;
connection server_2; connection server_2;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads; SET GLOBAL slave_parallel_threads=@old_parallel_threads;
set global slave_parallel_mode= @old_parallel_mode;
include/start_slave.inc include/start_slave.inc
connection server_1; connection server_1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
......
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
--connection server_2 --connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
set @old_parallel_mode= @@GLOBAL.slave_parallel_mode;
--source include/stop_slave.inc --source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5; SET GLOBAL slave_parallel_threads=5;
set global slave_parallel_mode= optimistic;
--source include/start_slave.inc --source include/start_slave.inc
--connection server_1 --connection server_1
...@@ -219,6 +221,7 @@ UNLOCK TABLES; ...@@ -219,6 +221,7 @@ UNLOCK TABLES;
--connection server_2 --connection server_2
--source include/stop_slave.inc --source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads; SET GLOBAL slave_parallel_threads=@old_parallel_threads;
set global slave_parallel_mode= @old_parallel_mode;
--source include/start_slave.inc --source include/start_slave.inc
--connection server_1 --connection server_1
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#ifdef __linux__ #ifdef __linux__
#define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end)
static char *heap_start; static char *heap_start;
extern char *__bss_start; char *__bss_start;
#else #else
#define PTR_SANE(p) (p) #define PTR_SANE(p) (p)
#endif /* __linux */ #endif /* __linux */
......
...@@ -378,13 +378,14 @@ do_gco_wait(rpl_group_info *rgi, group_commit_orderer *gco, ...@@ -378,13 +378,14 @@ do_gco_wait(rpl_group_info *rgi, group_commit_orderer *gco,
} }
static void static bool
do_ftwrl_wait(rpl_group_info *rgi, do_ftwrl_wait(rpl_group_info *rgi,
bool *did_enter_cond, PSI_stage_info *old_stage) bool *did_enter_cond, PSI_stage_info *old_stage)
{ {
THD *thd= rgi->thd; THD *thd= rgi->thd;
rpl_parallel_entry *entry= rgi->parallel_entry; rpl_parallel_entry *entry= rgi->parallel_entry;
uint64 sub_id= rgi->gtid_sub_id; uint64 sub_id= rgi->gtid_sub_id;
bool aborted= false;
DBUG_ENTER("do_ftwrl_wait"); DBUG_ENTER("do_ftwrl_wait");
mysql_mutex_assert_owner(&entry->LOCK_parallel_entry); mysql_mutex_assert_owner(&entry->LOCK_parallel_entry);
...@@ -407,7 +408,10 @@ do_ftwrl_wait(rpl_group_info *rgi, ...@@ -407,7 +408,10 @@ do_ftwrl_wait(rpl_group_info *rgi,
do do
{ {
if (entry->force_abort || rgi->worker_error) if (entry->force_abort || rgi->worker_error)
{
aborted= true;
break; break;
}
if (unlikely(thd->check_killed())) if (unlikely(thd->check_killed()))
{ {
slave_output_error_info(rgi, thd); slave_output_error_info(rgi, thd);
...@@ -426,7 +430,7 @@ do_ftwrl_wait(rpl_group_info *rgi, ...@@ -426,7 +430,7 @@ do_ftwrl_wait(rpl_group_info *rgi,
if (sub_id > entry->largest_started_sub_id) if (sub_id > entry->largest_started_sub_id)
entry->largest_started_sub_id= sub_id; entry->largest_started_sub_id= sub_id;
DBUG_VOID_RETURN; DBUG_RETURN(aborted);
} }
...@@ -511,6 +515,21 @@ rpl_unpause_after_ftwrl(THD *thd) ...@@ -511,6 +515,21 @@ rpl_unpause_after_ftwrl(THD *thd)
mysql_mutex_lock(&e->LOCK_parallel_entry); mysql_mutex_lock(&e->LOCK_parallel_entry);
rpt->pause_for_ftwrl = false; rpt->pause_for_ftwrl = false;
mysql_mutex_unlock(&rpt->LOCK_rpl_thread); mysql_mutex_unlock(&rpt->LOCK_rpl_thread);
/*
Do not change pause_sub_id if force_abort is set.
force_abort is set in case of STOP SLAVE.
Reason: If pause_sub_id is not changed and force_abort_is set,
any parallel slave thread waiting in do_ftwrl_wait() will
on wakeup return from do_ftwrl_wait() with 1. This will set
skip_event_group to 1 in handle_rpl_parallel_thread() and the
parallel thread will abort at once.
If pause_sub_id is changed, the code in handle_rpl_parallel_thread()
would continue to execute the transaction in the queue, which would
cause some transactions to be lost.
*/
if (!e->force_abort)
e->pause_sub_id= (uint64)ULONGLONG_MAX; e->pause_sub_id= (uint64)ULONGLONG_MAX;
mysql_cond_broadcast(&e->COND_parallel_entry); mysql_cond_broadcast(&e->COND_parallel_entry);
mysql_mutex_unlock(&e->LOCK_parallel_entry); mysql_mutex_unlock(&e->LOCK_parallel_entry);
...@@ -1195,7 +1214,7 @@ handle_rpl_parallel_thread(void *arg) ...@@ -1195,7 +1214,7 @@ handle_rpl_parallel_thread(void *arg)
rgi->worker_error= 1; rgi->worker_error= 1;
} }
if (likely(!skip_event_group)) if (likely(!skip_event_group))
do_ftwrl_wait(rgi, &did_enter_cond, &old_stage); skip_event_group= do_ftwrl_wait(rgi, &did_enter_cond, &old_stage);
/* /*
Register ourself to wait for the previous commit, if we need to do Register ourself to wait for the previous commit, if we need to do
......
SET(TOKUDB_VERSION 5.6.41-84.1) SET(TOKUDB_VERSION 5.6.49-89.0)
# PerconaFT only supports x86-64 and cmake-2.8.9+ # PerconaFT only supports x86-64 and cmake-2.8.9+
IF(WIN32) IF(WIN32)
# tokudb never worked there # tokudb never worked there
...@@ -136,6 +136,7 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG) ...@@ -136,6 +136,7 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG)
ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}") ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}")
ENDIF() ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-format-attribute)
MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers) MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers)
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/PerconaFT/") IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/PerconaFT/")
......
...@@ -47,20 +47,18 @@ include(CheckCCompilerFlag) ...@@ -47,20 +47,18 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
## adds a compiler flag if the compiler supports it ## adds a compiler flag if the compiler supports it
macro(set_cflags_if_supported) macro(prepend_cflags_if_supported)
foreach(flag ${ARGN}) foreach(flag ${ARGN})
MY_CHECK_AND_SET_COMPILER_FLAG(${flag}) MY_CHECK_AND_SET_COMPILER_FLAG(${flag})
endforeach(flag) endforeach(flag)
endmacro(set_cflags_if_supported) endmacro(prepend_cflags_if_supported)
if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING) if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
set (OPTIONAL_CFLAGS "${OPTIONAL_CFLAGS} -Wmissing-format-attribute") set (OPTIONAL_CFLAGS "${OPTIONAL_CFLAGS} -Wmissing-format-attribute")
endif() endif()
## disable some warnings ## disable some warnings
## missing-format-attribute causes warnings in some MySQL include files prepend_cflags_if_supported(
## if the library is built as a part of TokuDB MySQL storage engine
set_cflags_if_supported(
-Wno-missing-field-initializers -Wno-missing-field-initializers
-Wstrict-null-sentinel -Wstrict-null-sentinel
-Winit-self -Winit-self
...@@ -77,28 +75,21 @@ set_cflags_if_supported( ...@@ -77,28 +75,21 @@ set_cflags_if_supported(
-fno-exceptions -fno-exceptions
-Wno-error=nonnull-compare -Wno-error=nonnull-compare
) )
## set_cflags_if_supported_named("-Weffc++" -Weffcpp)
## Clang has stricter POD checks. So, only enable this warning on our other builds (Linux + GCC) ## Clang has stricter POD checks. So, only enable this warning on our other builds (Linux + GCC)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang) if (NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_cflags_if_supported( prepend_cflags_if_supported(
-Wpacked -Wpacked
) )
endif () endif ()
option (PROFILING "Allow profiling and debug" ON) option (PROFILING "Allow profiling and debug" ON)
if (PROFILING) if (PROFILING)
set_cflags_if_supported( prepend_cflags_if_supported(
-fno-omit-frame-pointer -fno-omit-frame-pointer
) )
endif () endif ()
## this hits with optimized builds somewhere in ftleaf_split, we don't
## know why but we don't think it's a big deal
set_cflags_if_supported(
-Wno-error=strict-overflow
)
# new flag sets in MySQL 8.0 seem to explicitly disable this # new flag sets in MySQL 8.0 seem to explicitly disable this
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
...@@ -136,7 +127,7 @@ else () ...@@ -136,7 +127,7 @@ else ()
endif () endif ()
## set warnings ## set warnings
set_cflags_if_supported( prepend_cflags_if_supported(
-Wextra -Wextra
-Wbad-function-cast -Wbad-function-cast
-Wno-missing-noreturn -Wno-missing-noreturn
...@@ -159,7 +150,7 @@ set_cflags_if_supported( ...@@ -159,7 +150,7 @@ set_cflags_if_supported(
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
# Disabling -Wcast-align with clang. TODO: fix casting and re-enable it, someday. # Disabling -Wcast-align with clang. TODO: fix casting and re-enable it, someday.
set_cflags_if_supported(-Wcast-align) prepend_cflags_if_supported(-Wcast-align)
endif () endif ()
## never want these ## never want these
......
...@@ -51,6 +51,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. ...@@ -51,6 +51,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "util/status.h" #include "util/status.h"
int writing_rollback = 0; int writing_rollback = 0;
extern "C" {
uint force_recovery = 0;
}
static const int log_format_version = TOKU_LOG_VERSION; static const int log_format_version = TOKU_LOG_VERSION;
......
...@@ -193,6 +193,7 @@ namespace MhsRbTree { ...@@ -193,6 +193,7 @@ namespace MhsRbTree {
BlockPair(OUUInt64 o, OUUInt64 s) : _offset(o), _size(s) {} BlockPair(OUUInt64 o, OUUInt64 s) : _offset(o), _size(s) {}
BlockPair(const BlockPair &o) BlockPair(const BlockPair &o)
: _offset(o._offset), _size(o._size) {} : _offset(o._offset), _size(o._size) {}
BlockPair& operator=(const BlockPair&) = default;
int operator<(const BlockPair &rhs) const { int operator<(const BlockPair &rhs) const {
return _offset < rhs._offset; return _offset < rhs._offset;
......
...@@ -195,13 +195,13 @@ static void test_multiple_cachefiles(bool use_same_hash) { ...@@ -195,13 +195,13 @@ static void test_multiple_cachefiles(bool use_same_hash) {
char fname1[strlen(TOKU_TEST_FILENAME) + sizeof("_1")]; char fname1[strlen(TOKU_TEST_FILENAME) + sizeof("_1")];
strcpy(fname1, TOKU_TEST_FILENAME); strcpy(fname1, TOKU_TEST_FILENAME);
strncat(fname1, "_1", sizeof("_1")); strcat(fname1, "_1");
char fname2[strlen(TOKU_TEST_FILENAME) + sizeof("_2")]; char fname2[strlen(TOKU_TEST_FILENAME) + sizeof("_2")];
strcpy(fname2, TOKU_TEST_FILENAME); strcpy(fname2, TOKU_TEST_FILENAME);
strncat(fname2, "_2", sizeof("_2")); strcat(fname2, "_2");
char fname3[strlen(TOKU_TEST_FILENAME) + sizeof("_3")]; char fname3[strlen(TOKU_TEST_FILENAME) + sizeof("_3")];
strcpy(fname3, TOKU_TEST_FILENAME); strcpy(fname3, TOKU_TEST_FILENAME);
strncat(fname3, "_3", sizeof("_3")); strcat(fname3, "_3");
unlink(fname1); unlink(fname1);
unlink(fname2); unlink(fname2);
...@@ -280,10 +280,10 @@ static void test_evictor(void) { ...@@ -280,10 +280,10 @@ static void test_evictor(void) {
char fname1[strlen(TOKU_TEST_FILENAME) + sizeof("_1")]; char fname1[strlen(TOKU_TEST_FILENAME) + sizeof("_1")];
strcpy(fname1, TOKU_TEST_FILENAME); strcpy(fname1, TOKU_TEST_FILENAME);
strncat(fname1, "_1", sizeof("_1")); strcat(fname1, "_1");
char fname2[strlen(TOKU_TEST_FILENAME) + sizeof("_2")]; char fname2[strlen(TOKU_TEST_FILENAME) + sizeof("_2")];
strcpy(fname2, TOKU_TEST_FILENAME); strcpy(fname2, TOKU_TEST_FILENAME);
strncat(fname2, "_2", sizeof("_2")); strcat(fname2, "_2");
unlink(fname1); unlink(fname1);
unlink(fname2); unlink(fname2);
......
...@@ -337,7 +337,7 @@ static void test_prefetching(void) { ...@@ -337,7 +337,7 @@ static void test_prefetching(void) {
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1; sn.height = 1;
sn.n_children = 3; sn.n_children = 3;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
uint64_t key1 = 100; uint64_t key1 = 100;
......
...@@ -133,7 +133,7 @@ static void test1(int fd, FT ft_h, FTNODE *dn) { ...@@ -133,7 +133,7 @@ static void test1(int fd, FT ft_h, FTNODE *dn) {
for (int i = 0; i < (*dn)->n_children; i++) { for (int i = 0; i < (*dn)->n_children; i++) {
invariant(BP_STATE(*dn, i) == PT_AVAIL); invariant(BP_STATE(*dn, i) == PT_AVAIL);
} }
(*dn)->dirty = 1; (*dn)->set_dirty();
toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr); toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr);
toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr); toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr);
toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr); toku_ftnode_pe_callback(*dn, attr, ft_h, def_pe_finalize_impl, nullptr);
...@@ -246,7 +246,7 @@ static void test_serialize_nonleaf(void) { ...@@ -246,7 +246,7 @@ static void test_serialize_nonleaf(void) {
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1; sn.height = 1;
sn.n_children = 2; sn.n_children = 2;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(2, sn.bp); MALLOC_N(2, sn.bp);
DBT pivotkey; DBT pivotkey;
...@@ -384,7 +384,7 @@ static void test_serialize_leaf(void) { ...@@ -384,7 +384,7 @@ static void test_serialize_leaf(void) {
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 2; sn.n_children = 2;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
DBT pivotkey; DBT pivotkey;
......
...@@ -95,7 +95,7 @@ static void test_serialize_leaf(int valsize, ...@@ -95,7 +95,7 @@ static void test_serialize_leaf(int valsize,
sn->layout_version_original = FT_LAYOUT_VERSION; sn->layout_version_original = FT_LAYOUT_VERSION;
sn->height = 0; sn->height = 0;
sn->n_children = 8; sn->n_children = 8;
sn->dirty = 1; sn->set_dirty();
sn->oldest_referenced_xid_known = TXNID_NONE; sn->oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn->n_children, sn->bp); MALLOC_N(sn->n_children, sn->bp);
sn->pivotkeys.create_empty(); sn->pivotkeys.create_empty();
...@@ -173,7 +173,7 @@ static void test_serialize_leaf(int valsize, ...@@ -173,7 +173,7 @@ static void test_serialize_leaf(int valsize,
for (int i = 0; i < ser_runs; i++) { for (int i = 0; i < ser_runs; i++) {
gettimeofday(&t[0], NULL); gettimeofday(&t[0], NULL);
ndd = NULL; ndd = NULL;
sn->dirty = 1; sn->set_dirty();
r = toku_serialize_ftnode_to( r = toku_serialize_ftnode_to(
fd, make_blocknum(20), sn, &ndd, true, ft->ft, false); fd, make_blocknum(20), sn, &ndd, true, ft->ft, false);
invariant(r == 0); invariant(r == 0);
...@@ -265,7 +265,7 @@ static void test_serialize_nonleaf(int valsize, ...@@ -265,7 +265,7 @@ static void test_serialize_nonleaf(int valsize,
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1; sn.height = 1;
sn.n_children = 8; sn.n_children = 8;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
sn.pivotkeys.create_empty(); sn.pivotkeys.create_empty();
......
...@@ -238,7 +238,7 @@ static void test_serialize_leaf_check_msn(enum ftnode_verify_type bft, ...@@ -238,7 +238,7 @@ static void test_serialize_leaf_check_msn(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 2; sn.n_children = 2;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
DBT pivotkey; DBT pivotkey;
...@@ -381,7 +381,7 @@ static void test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft, ...@@ -381,7 +381,7 @@ static void test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = nrows; sn.n_children = nrows;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
...@@ -538,7 +538,7 @@ static void test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft, ...@@ -538,7 +538,7 @@ static void test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 1; sn.n_children = 1;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
XMALLOC_N(sn.n_children, sn.bp); XMALLOC_N(sn.n_children, sn.bp);
...@@ -693,7 +693,7 @@ static void test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft, ...@@ -693,7 +693,7 @@ static void test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft,
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 1; sn.n_children = 1;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
...@@ -845,7 +845,7 @@ static void test_serialize_leaf_with_empty_basement_nodes( ...@@ -845,7 +845,7 @@ static void test_serialize_leaf_with_empty_basement_nodes(
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 7; sn.n_children = 7;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
DBT pivotkeys[6]; DBT pivotkeys[6];
...@@ -989,7 +989,7 @@ static void test_serialize_leaf_with_multiple_empty_basement_nodes( ...@@ -989,7 +989,7 @@ static void test_serialize_leaf_with_multiple_empty_basement_nodes(
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 4; sn.n_children = 4;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
DBT pivotkeys[3]; DBT pivotkeys[3];
...@@ -1100,7 +1100,7 @@ static void test_serialize_nonleaf(enum ftnode_verify_type bft, bool do_clone) { ...@@ -1100,7 +1100,7 @@ static void test_serialize_nonleaf(enum ftnode_verify_type bft, bool do_clone) {
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 1; sn.height = 1;
sn.n_children = 2; sn.n_children = 2;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(2, sn.bp); MALLOC_N(2, sn.bp);
DBT pivotkey; DBT pivotkey;
......
...@@ -57,7 +57,7 @@ static void test_header (void) { ...@@ -57,7 +57,7 @@ static void test_header (void) {
assert(r==0); assert(r==0);
// now insert some info into the header // now insert some info into the header
FT ft = t->ft; FT ft = t->ft;
ft->h->dirty = 1; ft->h->set_dirty();
// cast away const because we actually want to fiddle with the header // cast away const because we actually want to fiddle with the header
// in this test // in this test
*((int *) &ft->h->layout_version_original) = 13; *((int *) &ft->h->layout_version_original) = 13;
......
...@@ -88,7 +88,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -88,7 +88,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;
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -102,7 +102,7 @@ class bndata_bugfix_test { ...@@ -102,7 +102,7 @@ class bndata_bugfix_test {
sn.layout_version_original = FT_LAYOUT_VERSION; sn.layout_version_original = FT_LAYOUT_VERSION;
sn.height = 0; sn.height = 0;
sn.n_children = 2; sn.n_children = 2;
sn.dirty = 1; sn.set_dirty();
sn.oldest_referenced_xid_known = TXNID_NONE; sn.oldest_referenced_xid_known = TXNID_NONE;
MALLOC_N(sn.n_children, sn.bp); MALLOC_N(sn.n_children, sn.bp);
DBT pivotkey; DBT pivotkey;
......
...@@ -161,7 +161,7 @@ append_leaf(FT_HANDLE ft, FTNODE leafnode, void *key, uint32_t keylen, void *val ...@@ -161,7 +161,7 @@ append_leaf(FT_HANDLE ft, FTNODE leafnode, void *key, uint32_t keylen, void *val
} }
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -49,9 +49,9 @@ static void test_5123(void) { ...@@ -49,9 +49,9 @@ static void test_5123(void) {
test_setup(TOKU_TEST_FILENAME, &logger, &ct); test_setup(TOKU_TEST_FILENAME, &logger, &ct);
int r; int r;
TXNID_PAIR one = {.parent_id64 = (TXNID)1, TXNID_NONE}; TXNID_PAIR one = { (TXNID)1, TXNID_NONE};
TXNID_PAIR two = {.parent_id64 = (TXNID)2, TXNID_NONE}; TXNID_PAIR two = { (TXNID)2, TXNID_NONE};
TXNID_PAIR three = {.parent_id64 = (TXNID)3, TXNID_NONE}; TXNID_PAIR three = { (TXNID)3, TXNID_NONE};
toku_log_xbegin(logger, NULL, false, one, TXNID_PAIR_NONE); toku_log_xbegin(logger, NULL, false, one, TXNID_PAIR_NONE);
toku_log_xbegin(logger, NULL, false, three, TXNID_PAIR_NONE); toku_log_xbegin(logger, NULL, false, three, TXNID_PAIR_NONE);
......
...@@ -245,7 +245,7 @@ doit (bool after_child_pin) { ...@@ -245,7 +245,7 @@ doit (bool after_child_pin) {
true true
); );
assert(node->height == 1); assert(node->height == 1);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
if (after_child_pin) { if (after_child_pin) {
assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0); assert(toku_bnc_nbytesinbuf(BNC(node, 0)) == 0);
...@@ -265,7 +265,7 @@ doit (bool after_child_pin) { ...@@ -265,7 +265,7 @@ doit (bool after_child_pin) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
if (after_child_pin) { if (after_child_pin) {
assert(BLB_NBYTESINDATA(node,0) > 0); assert(BLB_NBYTESINDATA(node,0) > 0);
......
...@@ -270,7 +270,7 @@ doit (int state) { ...@@ -270,7 +270,7 @@ doit (int state) {
true true
); );
assert(node->height == 1); assert(node->height == 1);
assert(!node->dirty); assert(!node->dirty());
BLOCKNUM left_child, right_child; BLOCKNUM left_child, right_child;
// cases where we expect the checkpoint to contain the merge // cases where we expect the checkpoint to contain the merge
if (state == ft_flush_aflter_merge || state == flt_flush_before_unpin_remove) { if (state == ft_flush_aflter_merge || state == flt_flush_before_unpin_remove) {
...@@ -301,7 +301,7 @@ doit (int state) { ...@@ -301,7 +301,7 @@ doit (int state) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1); assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
...@@ -318,7 +318,7 @@ doit (int state) { ...@@ -318,7 +318,7 @@ doit (int state) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1); assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
...@@ -336,7 +336,7 @@ doit (int state) { ...@@ -336,7 +336,7 @@ doit (int state) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2); assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
......
...@@ -284,7 +284,7 @@ doit (int state) { ...@@ -284,7 +284,7 @@ doit (int state) {
true true
); );
assert(node->height == 1); assert(node->height == 1);
assert(!node->dirty); assert(!node->dirty());
BLOCKNUM left_child, right_child; BLOCKNUM left_child, right_child;
assert(node->n_children == 2); assert(node->n_children == 2);
...@@ -304,7 +304,7 @@ doit (int state) { ...@@ -304,7 +304,7 @@ doit (int state) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2); assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
...@@ -319,7 +319,7 @@ doit (int state) { ...@@ -319,7 +319,7 @@ doit (int state) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2); assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
......
...@@ -260,7 +260,7 @@ doit (bool after_split) { ...@@ -260,7 +260,7 @@ doit (bool after_split) {
true true
); );
assert(node->height == 1); assert(node->height == 1);
assert(!node->dirty); assert(!node->dirty());
BLOCKNUM left_child, right_child; BLOCKNUM left_child, right_child;
if (after_split) { if (after_split) {
assert(node->n_children == 2); assert(node->n_children == 2);
...@@ -287,7 +287,7 @@ doit (bool after_split) { ...@@ -287,7 +287,7 @@ doit (bool after_split) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1); assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
...@@ -302,7 +302,7 @@ doit (bool after_split) { ...@@ -302,7 +302,7 @@ doit (bool after_split) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 1); assert(BLB_DATA(node, 0)->num_klpairs() == 1);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
...@@ -318,7 +318,7 @@ doit (bool after_split) { ...@@ -318,7 +318,7 @@ doit (bool after_split) {
true true
); );
assert(node->height == 0); assert(node->height == 0);
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 1); assert(node->n_children == 1);
assert(BLB_DATA(node, 0)->num_klpairs() == 2); assert(BLB_DATA(node, 0)->num_klpairs() == 2);
toku_unpin_ftnode(c_ft->ft, node); toku_unpin_ftnode(c_ft->ft, node);
......
...@@ -199,7 +199,7 @@ doit (void) { ...@@ -199,7 +199,7 @@ doit (void) {
&node, &node,
true true
); );
assert(node->dirty); assert(node->dirty());
assert(node->n_children == 2); assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL); assert(BP_STATE(node,0) == PT_AVAIL);
assert(BP_STATE(node,1) == PT_AVAIL); assert(BP_STATE(node,1) == PT_AVAIL);
...@@ -229,7 +229,7 @@ doit (void) { ...@@ -229,7 +229,7 @@ doit (void) {
&node, &node,
true true
); );
assert(node->dirty); assert(node->dirty());
assert(node->n_children == 2); assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL); assert(BP_STATE(node,0) == PT_AVAIL);
assert(BP_STATE(node,1) == PT_AVAIL); assert(BP_STATE(node,1) == PT_AVAIL);
...@@ -250,7 +250,7 @@ doit (void) { ...@@ -250,7 +250,7 @@ doit (void) {
&node, &node,
true true
); );
assert(node->dirty); assert(node->dirty());
// we expect that this flushes its buffer, that // we expect that this flushes its buffer, that
// a merge is not done, and that the lookup // a merge is not done, and that the lookup
......
...@@ -203,7 +203,7 @@ doit (bool keep_other_bn_in_memory) { ...@@ -203,7 +203,7 @@ doit (bool keep_other_bn_in_memory) {
&node, &node,
true true
); );
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 2); assert(node->n_children == 2);
// a hack to get the basement nodes evicted // a hack to get the basement nodes evicted
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
...@@ -249,7 +249,7 @@ doit (bool keep_other_bn_in_memory) { ...@@ -249,7 +249,7 @@ doit (bool keep_other_bn_in_memory) {
&node, &node,
true true
); );
assert(!node->dirty); assert(!node->dirty());
assert(node->n_children == 2); assert(node->n_children == 2);
assert(BP_STATE(node,0) == PT_AVAIL); assert(BP_STATE(node,0) == PT_AVAIL);
if (keep_other_bn_in_memory) { if (keep_other_bn_in_memory) {
...@@ -273,7 +273,7 @@ doit (bool keep_other_bn_in_memory) { ...@@ -273,7 +273,7 @@ doit (bool keep_other_bn_in_memory) {
&node, &node,
true true
); );
assert(!node->dirty); assert(!node->dirty());
// we expect that this flushes its buffer, that // we expect that this flushes its buffer, that
// a merge is not done, and that the lookup // a merge is not done, and that the lookup
......
...@@ -194,7 +194,7 @@ doit (void) { ...@@ -194,7 +194,7 @@ doit (void) {
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
toku_ftnode_assert_fully_in_memory(node); toku_ftnode_assert_fully_in_memory(node);
assert(node->n_children == 2); assert(node->n_children == 2);
assert(!node->dirty); assert(!node->dirty());
assert(toku_bnc_n_entries(node->bp[0].ptr.u.nonleaf) > 0); assert(toku_bnc_n_entries(node->bp[0].ptr.u.nonleaf) > 0);
assert(toku_bnc_n_entries(node->bp[1].ptr.u.nonleaf) > 0); assert(toku_bnc_n_entries(node->bp[1].ptr.u.nonleaf) > 0);
...@@ -216,7 +216,7 @@ doit (void) { ...@@ -216,7 +216,7 @@ doit (void) {
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
toku_ftnode_assert_fully_in_memory(node); toku_ftnode_assert_fully_in_memory(node);
assert(node->dirty); assert(node->dirty());
assert(node->n_children == 2); assert(node->n_children == 2);
// child 0 should have empty buffer because it flushed // child 0 should have empty buffer because it flushed
// child 1 should still have message in buffer // child 1 should still have message in buffer
...@@ -226,14 +226,14 @@ doit (void) { ...@@ -226,14 +226,14 @@ doit (void) {
r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
assert_zero(r); assert_zero(r);
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
assert(!node->dirty); assert(!node->dirty());
curr_child_to_flush = 1; curr_child_to_flush = 1;
num_flushes_called = 0; num_flushes_called = 0;
toku_ft_flush_some_child(t->ft, node, &fa); toku_ft_flush_some_child(t->ft, node, &fa);
assert(num_flushes_called == 1); assert(num_flushes_called == 1);
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
assert(node->dirty); assert(node->dirty());
toku_ftnode_assert_fully_in_memory(node); toku_ftnode_assert_fully_in_memory(node);
assert(node->n_children == 2); assert(node->n_children == 2);
// both buffers should be empty now // both buffers should be empty now
...@@ -244,14 +244,14 @@ doit (void) { ...@@ -244,14 +244,14 @@ doit (void) {
r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); r = toku_checkpoint(cp, NULL, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
assert_zero(r); assert_zero(r);
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
assert(!node->dirty); assert(!node->dirty());
curr_child_to_flush = 0; curr_child_to_flush = 0;
num_flushes_called = 0; num_flushes_called = 0;
toku_ft_flush_some_child(t->ft, node, &fa); toku_ft_flush_some_child(t->ft, node, &fa);
assert(num_flushes_called == 1); assert(num_flushes_called == 1);
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
assert(node->dirty); // nothing was flushed, but since we were trying to flush to a leaf, both become dirty assert(node->dirty()); // nothing was flushed, but since we were trying to flush to a leaf, both become dirty
toku_ftnode_assert_fully_in_memory(node); toku_ftnode_assert_fully_in_memory(node);
assert(node->n_children == 2); assert(node->n_children == 2);
// both buffers should be empty now // both buffers should be empty now
...@@ -280,17 +280,17 @@ doit (void) { ...@@ -280,17 +280,17 @@ doit (void) {
assert(num_flushes_called == 2); assert(num_flushes_called == 2);
toku_pin_node_with_min_bfe(&node, node_internal, t); toku_pin_node_with_min_bfe(&node, node_internal, t);
assert(node->dirty); assert(node->dirty());
toku_unpin_ftnode(t->ft, node); toku_unpin_ftnode(t->ft, node);
toku_pin_node_with_min_bfe(&node, node_leaf[0], t); toku_pin_node_with_min_bfe(&node, node_leaf[0], t);
assert(node->dirty); assert(node->dirty());
toku_unpin_ftnode(t->ft, node); toku_unpin_ftnode(t->ft, node);
toku_pin_node_with_min_bfe(&node, node_leaf[1], t); toku_pin_node_with_min_bfe(&node, node_leaf[1], t);
if (i == 0) { if (i == 0) {
assert(!node->dirty); assert(!node->dirty());
} }
else { else {
assert(node->dirty); assert(node->dirty());
} }
toku_unpin_ftnode(t->ft, node); toku_unpin_ftnode(t->ft, node);
} }
......
...@@ -105,7 +105,7 @@ setup_ftnode_header(struct ftnode *node) ...@@ -105,7 +105,7 @@ setup_ftnode_header(struct ftnode *node)
node->layout_version = FT_LAYOUT_VERSION; node->layout_version = FT_LAYOUT_VERSION;
node->layout_version_original = FT_LAYOUT_VERSION; node->layout_version_original = FT_LAYOUT_VERSION;
node->height = 0; node->height = 0;
node->dirty = 1; node->set_dirty();
node->oldest_referenced_xid_known = TXNID_NONE; node->oldest_referenced_xid_known = TXNID_NONE;
} }
......
...@@ -93,7 +93,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -93,7 +93,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
// leafnode->max_msn_applied_to_node = msn; // leafnode->max_msn_applied_to_node = msn;
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -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);
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -78,7 +78,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -78,7 +78,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL); NULL);
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -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);
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -78,7 +78,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -78,7 +78,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL); NULL);
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -80,7 +80,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen) ...@@ -80,7 +80,7 @@ append_leaf(FTNODE leafnode, void *key, size_t keylen, void *val, size_t vallen)
NULL); NULL);
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -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);
// don't forget to dirty the node // don't forget to dirty the node
leafnode->dirty = 1; leafnode->set_dirty();
} }
static void static void
......
...@@ -398,8 +398,8 @@ namespace ftcxx { ...@@ -398,8 +398,8 @@ namespace ftcxx {
{} {}
bool operator()(const DBT *key, const DBT *val) { bool operator()(const DBT *key, const DBT *val) {
_key = std::move(Slice(*key).owned()); _key = Slice(*key).owned();
_val = std::move(Slice(*val).owned()); _val = Slice(*val).owned();
// Don't bulk fetch. // Don't bulk fetch.
return false; return false;
......
...@@ -93,6 +93,10 @@ void lock_request::destroy(void) { ...@@ -93,6 +93,10 @@ void lock_request::destroy(void) {
toku_cond_destroy(&m_wait_cond); toku_cond_destroy(&m_wait_cond);
} }
void lock_request::clearmem(char c) {
memset(this, c, sizeof(* this));
}
// set the lock request parameters. this API allows a lock request to be reused. // set the lock request parameters. this API allows a lock request to be reused.
void lock_request::set(locktree *lt, TXNID txnid, const DBT *left_key, const DBT *right_key, lock_request::type lock_type, bool big_txn, void *extra) { void lock_request::set(locktree *lt, TXNID txnid, const DBT *left_key, const DBT *right_key, lock_request::type lock_type, bool big_txn, void *extra) {
invariant(m_state != state::PENDING); invariant(m_state != state::PENDING);
......
...@@ -89,6 +89,7 @@ class lock_request { ...@@ -89,6 +89,7 @@ class lock_request {
// effect: Destroys a lock request. // effect: Destroys a lock request.
void destroy(void); void destroy(void);
void clearmem(char c);
// effect: Resets the lock request parameters, allowing it to be reused. // effect: Resets the lock request parameters, allowing it to be reused.
// requires: Lock request was already created at some point // requires: Lock request was already created at some point
......
...@@ -83,7 +83,7 @@ namespace toku { ...@@ -83,7 +83,7 @@ namespace toku {
} }
request.destroy(); request.destroy();
memset(&request, 0xab, sizeof request); request.clearmem(0xab);
toku_pthread_yield(); toku_pthread_yield();
if ((i % 10) == 0) if ((i % 10) == 0)
......
...@@ -96,7 +96,7 @@ namespace toku { ...@@ -96,7 +96,7 @@ namespace toku {
} }
request.destroy(); request.destroy();
memset(&request, 0xab, sizeof request); request.clearmem(0xab);
toku_pthread_yield(); toku_pthread_yield();
if ((i % 10) == 0) if ((i % 10) == 0)
......
...@@ -98,7 +98,7 @@ namespace toku { ...@@ -98,7 +98,7 @@ namespace toku {
} }
request.destroy(); request.destroy();
memset(&request, 0xab, sizeof request); request.clearmem(0xab);
toku_pthread_yield(); toku_pthread_yield();
if ((i % 10) == 0) if ((i % 10) == 0)
......
...@@ -428,14 +428,14 @@ static int env_del_multiple_test_no_array( ...@@ -428,14 +428,14 @@ static int env_del_multiple_test_no_array(
/* Some macros for evaluating blocks or functions within the scope of a /* Some macros for evaluating blocks or functions within the scope of a
* transaction. */ * transaction. */
#define IN_TXN_COMMIT(env, parent, txn, flags, expr) ({ \ #define IN_TXN_COMMIT(env, parent, txn, flags, expr) ({ \
DB_TXN *(txn); \ DB_TXN *txn; \
{ int chk_r = (env)->txn_begin((env), (parent), &(txn), (flags)); CKERR(chk_r); } \ { int chk_r = (env)->txn_begin((env), (parent), &(txn), (flags)); CKERR(chk_r); } \
(expr); \ (expr); \
{ int chk_r = (txn)->commit((txn), 0); CKERR(chk_r); } \ { int chk_r = (txn)->commit((txn), 0); CKERR(chk_r); } \
}) })
#define IN_TXN_ABORT(env, parent, txn, flags, expr) ({ \ #define IN_TXN_ABORT(env, parent, txn, flags, expr) ({ \
DB_TXN *(txn); \ DB_TXN *txn; \
{ int chk_r = (env)->txn_begin((env), (parent), &(txn), (flags)); CKERR(chk_r); } \ { int chk_r = (env)->txn_begin((env), (parent), &(txn), (flags)); CKERR(chk_r); } \
(expr); \ (expr); \
{ int chk_r = (txn)->abort(txn); CKERR(chk_r); } \ { int chk_r = (txn)->abort(txn); CKERR(chk_r); } \
......
...@@ -68,7 +68,7 @@ seqinsert (int n, float p) { ...@@ -68,7 +68,7 @@ seqinsert (int n, float p) {
int v = i; int v = i;
DBT key, val; DBT key, val;
r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0); r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0);
if (random() <= RAND_MAX * p) { if (random() <= static_cast<float>(RAND_MAX) * p) {
k = htonl(i-1); k = htonl(i-1);
v = i-1; v = i-1;
r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0); r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0);
......
...@@ -432,17 +432,17 @@ tsv_print_perf_totals(const struct cli_args *cli_args, uint64_t *counters[], con ...@@ -432,17 +432,17 @@ tsv_print_perf_totals(const struct cli_args *cli_args, uint64_t *counters[], con
} }
const struct perf_formatter perf_formatters[] = { const struct perf_formatter perf_formatters[] = {
[HUMAN] = { { /* HUMAN */
.header = human_print_perf_header, .header = human_print_perf_header,
.iteration = human_print_perf_iteration, .iteration = human_print_perf_iteration,
.totals = human_print_perf_totals .totals = human_print_perf_totals
}, },
[CSV] = { { /* CSV */
.header = csv_print_perf_header, .header = csv_print_perf_header,
.iteration = csv_print_perf_iteration, .iteration = csv_print_perf_iteration,
.totals = csv_print_perf_totals .totals = csv_print_perf_totals
}, },
[TSV] = { { /* TSV */
.header = tsv_print_perf_header, .header = tsv_print_perf_header,
.iteration = tsv_print_perf_iteration, .iteration = tsv_print_perf_iteration,
.totals = tsv_print_perf_totals .totals = tsv_print_perf_totals
......
...@@ -91,9 +91,7 @@ extern int writing_rollback; ...@@ -91,9 +91,7 @@ extern int writing_rollback;
int toku_close_trace_file (void) { return 0; } int toku_close_trace_file (void) { return 0; }
#endif #endif
extern "C" { extern uint force_recovery;
uint force_recovery = 0;
}
// Set when env is panicked, never cleared. // Set when env is panicked, never cleared.
static int env_is_panicked = 0; static int env_is_panicked = 0;
......
...@@ -509,7 +509,7 @@ int toku_db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, uint32_t ...@@ -509,7 +509,7 @@ int toku_db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, uint32_t
struct lt_on_create_callback_extra on_create_extra = { struct lt_on_create_callback_extra on_create_extra = {
.txn = txn, .txn = txn,
.ft_handle = db->i->ft_handle, .ft_handle = db->i->ft_handle,
open_rw .open_rw = false
}; };
db->i->lt = db->dbenv->i->ltm.get_lt(db->i->dict_id, db->i->lt = db->dbenv->i->ltm.get_lt(db->i->dict_id,
toku_ft_get_comparator(db->i->ft_handle), toku_ft_get_comparator(db->i->ft_handle),
......
--log-warnings=0 --slave-transaction-retries=0 --log-warnings=0 --slave-transaction-retries=0
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