diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2015-02-03 12:31:08 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2015-02-03 12:31:08 +1100 |
commit | 146f50469d9b4af40e7d66e9b26ff3664edbd6c7 (patch) | |
tree | c1cfcfeb8d2505590c6e0646dc7fe56584017b99 | |
parent | 5f00de07b5bad20a6ffb5ec7d412c4ca0b10c64f (diff) | |
parent | 7a68a1643f9beafc34b69d2e52c8af741e9dc333 (diff) | |
download | mongo-146f50469d9b4af40e7d66e9b26ff3664edbd6c7.tar.gz |
Merge branch 'develop' into split-gen
39 files changed, 462 insertions, 133 deletions
diff --git a/SConstruct b/SConstruct index b075afe696a..1c109c973c0 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,10 @@ # -*- mode: python; -*- import re import os +import shutil +import subprocess +import sys +import tempfile import textwrap import distutils.sysconfig @@ -10,33 +14,51 @@ if not os.sys.platform == "win32": print ("SConstruct is only supported for Windows, use build_posix for other platforms") Exit(1) -AddOption("--with-berkeley-db", dest="bdb", type="string", nargs=1, action="store", - help="Berkeley DB install path, ie, /usr/local") +# Command line options +# +AddOption("--dynamic-crt", dest="dynamic-crt", action="store_true", default=False, + help="Link with the MSVCRT DLL version") -AddOption("--enable-zlib", dest="zlib", type="string", nargs=1, action="store", - help="Use zlib compression") +AddOption("--enable-attach", dest="attach", action="store_true", default=False, + help="Configure for debugger attach on failure.") + +AddOption("--enable-diagnostic", dest="diagnostic", action="store_true", default=False, + help="Configure WiredTiger to perform various run-time diagnostic tests. DO NOT configure this option in production environments.") + +AddOption("--enable-python", dest="lang-python", type="string", nargs=1, action="store", + help="Build Python extension, specify location of swig.exe binary") AddOption("--enable-snappy", dest="snappy", type="string", nargs=1, action="store", help="Use snappy compression") -AddOption("--enable-swig", dest="swig", type="string", nargs=1, action="store", - help="Build python extension, specify location of swig.exe binary") +AddOption("--enable-verbose", dest="verbose", action="store_true", default=False, + help="Configure WiredTiger to support the verbose configuration string to wiredtiger_open") -AddOption("--dynamic-crt", dest="dynamic-crt", action="store_true", default=False, - help="Link with the MSVCRT DLL version") +AddOption("--enable-zlib", dest="zlib", type="string", nargs=1, action="store", + help="Use zlib compression") +AddOption("--prefix", dest="prefix", type="string", nargs=1, action="store", default="package", + help="Install directory") + +AddOption("--with-berkeley-db", dest="bdb", type="string", nargs=1, action="store", + help="Berkeley DB install path, ie, /usr/local") + +# Get the swig binary from the command line option since SCONS cannot find it automatically +# +swig_binary = GetOption("lang-python") + +# Initialize environment +# env = Environment( CPPPATH = ["#/src/include/", "#/build_win", "#/test/windows", "#/.", - distutils.sysconfig.get_python_inc() ], - #CPPDEFINES = ["HAVE_DIAGNOSTIC", "HAVE_VERBOSE"], CFLAGS = [ "/Z7", # Generate debugging symbols "/wd4090", # Ignore warning about mismatched const qualifiers - "/wd4996", + "/wd4996", "/W3", # Warning level 3 "/we4013", # Error on undefined functions "/TC", # Compile as C code @@ -59,17 +81,12 @@ env = Environment( "/DYNAMICBASE", "/NXCOMPAT", ], - LIBPATH=[ distutils.sysconfig.PREFIX + r"\libs"], tools=["default", "swig", "textfile"], - SWIGFLAGS=['-python', - "-threads", - "-O", - "-nodefaultctor", - "-nodefaultdtor" - ], - SWIG=GetOption("swig") + SWIG=swig_binary ) +env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 + useZlib = GetOption("zlib") useSnappy = GetOption("snappy") useBdb = GetOption("bdb") @@ -109,7 +126,24 @@ if useBdb: env = conf.Finish() +# Configure build environment variables +# +if GetOption("attach"): + env.Append(CPPDEFINES = ["HAVE_ATTACH"]) + +if GetOption("diagnostic"): + env.Append(CPPDEFINES = ["HAVE_DIAGNOSTIC"]) + +if GetOption("lang-python"): + env.Append(LIBPATH=[distutils.sysconfig.PREFIX + r"\libs"]) + env.Append(CPPPATH=[distutils.sysconfig.get_python_inc()]) +if GetOption("verbose"): + env.Append(CPPDEFINES = ["HAVE_VERBOSE"]) + + +# Build WiredTiger.h file +# version_file = 'build_posix/aclocal/version-set.m4' VERSION_MAJOR = None @@ -147,7 +181,7 @@ replacements = { '@wiredtiger_includes_decl@': wiredtiger_includes } -env.Substfile( +wtheader = env.Substfile( target='wiredtiger.h', source=[ 'src/include/wiredtiger.in', @@ -170,11 +204,27 @@ if useZlib: if useSnappy: wtsources.append("ext/compressors/snappy/snappy_compress.c") -wtlib = env.Library("wiredtiger", wtsources) +wt_objs = [env.Object(a) for a in wtsources] + +# Static Library - libwiredtiger.lib +# +wtlib = env.Library( + target="libwiredtiger", + source=wt_objs, LIBS=wtlibs) env.Depends(wtlib, [filelistfile, version_file]) -env.Program("wt", [ +# Dynamically Loaded Library - wiredtiger.dll +# +wtdll = env.SharedLibrary( + target="wiredtiger", + source=wt_objs + ['build_win/wiredtiger.def'], LIBS=wtlibs) + +env.Depends(wtdll, [filelistfile, version_file]) + +Default(wtlib, wtdll) + +wtbin = env.Program("wt", [ "src/utilities/util_backup.c", "src/utilities/util_cpyright.c", "src/utilities/util_compact.c", @@ -198,27 +248,48 @@ env.Program("wt", [ "src/utilities/util_write.c"], LIBS=[wtlib] + wtlibs) -if GetOption("swig"): - swiglib = env.SharedLibrary('_wiredtiger', +Default(wtbin) + +# Python SWIG wrapper for WiredTiger +if GetOption("lang-python"): + # Check that this version of python is 64-bit + # + if sys.maxsize < 2**32: + print "The Python Interpreter must be 64-bit in order to build the python bindings" + Exit(1) + + pythonEnv = env.Clone() + pythonEnv.Append(SWIGFLAGS=[ + "-python", + "-threads", + "-O", + "-nodefaultctor", + "-nodefaultdtor", + ]) + + swiglib = pythonEnv.SharedLibrary('_wiredtiger', [ 'lang\python\wiredtiger.i'], SHLIBSUFFIX=".pyd", - LIBS=[wtlib]) + LIBS=[wtlib] + wtlibs) - copySwig = env.Command( + copySwig = pythonEnv.Command( 'lang/python/wiredtiger/__init__.py', 'lang/python/wiredtiger.py', Copy('$TARGET', '$SOURCE')) - env.Depends(copySwig, swiglib) + pythonEnv.Depends(copySwig, swiglib) - env.Install('lang/python/wiredtiger/', swiglib) + swiginstall = pythonEnv.Install('lang/python/wiredtiger/', swiglib) + + Default(swiginstall, copySwig) # Shim library of functions to emulate POSIX on Windows shim = env.Library("window_shim", ["test/windows/windows_shim.c"]) -env.Program("t_bloom", +t = env.Program("t_bloom", "test/bloom/test_bloom.c", - LIBS=[wtlib]) + LIBS=[wtlib] + wtlibs) +Default(t) #env.Program("t_checkpoint", #["test/checkpoint/checkpointer.c", @@ -226,9 +297,10 @@ env.Program("t_bloom", #"test/checkpoint/workers.c"], #LIBS=[wtlib]) -env.Program("t_huge", +t = env.Program("t_huge", "test/huge/huge.c", - LIBS=[wtlib]) + LIBS=[wtlib] + wtlibs) +Default(t) #env.Program("t_fops", #["test/fops/file.c", @@ -241,7 +313,7 @@ if useBdb: benv.Append(CPPDEFINES=['BERKELEY_DB_PATH=\\"' + useBdb.replace("\\", "\\\\") + '\\"']) - benv.Program("t_format", + t = benv.Program("t_format", ["test/format/backup.c", "test/format/bdb.c", "test/format/bulk.c", @@ -252,7 +324,8 @@ if useBdb: "test/format/t.c", "test/format/util.c", "test/format/wts.c"], - LIBS=[wtlib, shim, "libdb61"]) + LIBS=[wtlib, shim, "libdb61"] + wtlibs) + Default(t) #env.Program("t_thread", #["test/thread/file.c", @@ -265,13 +338,14 @@ if useBdb: #["test/salvage/salvage.c"], #LIBS=[wtlib]) -env.Program("wtperf", [ +t = env.Program("wtperf", [ "bench/wtperf/config.c", "bench/wtperf/misc.c", "bench/wtperf/track.c", "bench/wtperf/wtperf.c", ], - LIBS=[wtlib, shim] ) + LIBS=[wtlib, shim] + wtlibs) +Default(t) examples = [ "ex_access", @@ -293,9 +367,52 @@ examples = [ "ex_thread", ] +# WiredTiger Smoke Test suppor +# Runs each test in a custom temporary directory +# +def run_smoke_test(x): + print "Running Smoke Test: " + x + + # Make temp dir + temp_dir = tempfile.mkdtemp(prefix="wt_home") + + try: + # Set WT_HOME environment variable for test + os.environ["WIREDTIGER_HOME"] = temp_dir + + # Run the test + ret = subprocess.call(x); + if( ret != 0): + sys.stderr.write("Bad exit code %d\n" % (ret)) + raise Exception() + + finally: + # Clean directory + # + shutil.rmtree(temp_dir) + +def builder_smoke_test(target, source, env): + run_smoke_test(source[0].abspath) + return None + +env.Append(BUILDERS={'SmokeTest' : Builder(action = builder_smoke_test)}) + for ex in examples: - if(ex in ['ex_async', 'ex_thread']): - env.Program(ex, "examples/c/" + ex + ".c", LIBS=[wtlib, shim]) + if(ex in ['ex_all', 'ex_async', 'ex_thread']): + exp = env.Program(ex, "examples/c/" + ex + ".c", LIBS=[wtlib, shim] + wtlibs) + Default(exp) + env.Alias("check", env.SmokeTest(exp)) else: - env.Program(ex, "examples/c/" + ex + ".c", LIBS=[wtlib]) + exp = env.Program(ex, "examples/c/" + ex + ".c", LIBS=[wtdll[1]] + wtlibs) + Default(exp) + if not ex == 'ex_log': + env.Alias("check", env.SmokeTest(exp)) +# Install Target +# +prefix = GetOption("prefix") +env.Alias("install", env.Install(os.path.join(prefix, "bin"), wtbin)) +env.Alias("install", env.Install(os.path.join(prefix, "bin"), wtdll[0])) # Just the dll +env.Alias("install", env.Install(os.path.join(prefix, "include"), wtheader)) +env.Alias("install", env.Install(os.path.join(prefix, "lib"), wtdll[1])) # Just the import lib +env.Alias("install", env.Install(os.path.join(prefix, "lib"), wtlib)) diff --git a/build_win/wiredtiger.def b/build_win/wiredtiger.def new file mode 100644 index 00000000000..02884e4fd65 --- /dev/null +++ b/build_win/wiredtiger.def @@ -0,0 +1,21 @@ +LIBRARY WIREDTIGER +EXPORTS + wiredtiger_config_parser_open + wiredtiger_open + wiredtiger_pack_close + wiredtiger_pack_int + wiredtiger_pack_item + wiredtiger_pack_start + wiredtiger_pack_str + wiredtiger_pack_uint + wiredtiger_strerror + wiredtiger_strerror_r + wiredtiger_struct_pack + wiredtiger_struct_size + wiredtiger_struct_unpack + wiredtiger_unpack_int + wiredtiger_unpack_item + wiredtiger_unpack_start + wiredtiger_unpack_str + wiredtiger_unpack_uint + wiredtiger_version diff --git a/dist/api_data.py b/dist/api_data.py index 7754a3a1d13..65af833c4a2 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -241,6 +241,12 @@ file_config = format_meta + [ minimum gain before prefix compression will be used on row-store leaf pages''', min=0), + Config('split_deepen_min_child', '0', r''' + minimum entries in a page to consider deepening the tree''', + type='int', undoc=True), + Config('split_deepen_per_child', '0', r''' + entries allocated per child when deepening the tree''', + type='int', undoc=True), Config('split_pct', '75', r''' the Btree page split size as a percentage of the maximum Btree page size, that is, when a Btree page is split, it will be diff --git a/dist/s_all b/dist/s_all index b63ed314453..96e69ddff04 100644 --- a/dist/s_all +++ b/dist/s_all @@ -66,6 +66,7 @@ run "sh ./s_tags" "building tags files" run "sh ./s_copyright" "checking copyright notices" run "sh ./s_define" "checking for unused #defines" +run "sh ./s_export" "checking external symbol names" run "sh ./s_funcs" "checking for unused functions" run "sh ./s_getopt" "checking for incorrect getopt usage" run "sh ./s_lang" "checking for SWIG generated name conflicts" @@ -74,7 +75,6 @@ run "sh ./s_stat" "checking for unused statistics fields" run "sh ./s_string" "checking string spelling" run "python style.py" "checking style (pass 1)" run "sh ./s_style" "checking style (pass 2)" -run "sh ./s_symbols" "checking external symbol names" run "sh ./s_typedef -c" "checking for unused typedefs" run "sh ./s_whitespace" "checking whitespace" run "sh ./s_win" "checking windows config" diff --git a/dist/s_define.list b/dist/s_define.list index 7803b628917..91fbc971afa 100644 --- a/dist/s_define.list +++ b/dist/s_define.list @@ -34,11 +34,14 @@ WT_ATOMIC_SUB2 WT_BARRIER WT_BLOCK_DESC_SIZE WT_CACHE_LINE_ALIGNMENT +WT_COMPILER_TYPE_ALIGN WT_CONN_CHECK_PANIC WT_DEADLOCK WT_DEBUG_BYTE WT_HANDLE_CLOSED WT_HANDLE_NULLABLE +WT_PACKED_STRUCT_BEGIN +WT_PACKED_STRUCT_END WT_READ_BARRIER WT_REF_SIZE WT_SPINLOCK_MAX diff --git a/dist/s_symbols b/dist/s_export index e590ab6f62c..1212b5b2c1f 100644 --- a/dist/s_symbols +++ b/dist/s_export @@ -23,7 +23,7 @@ esac check() { - (sed -e '/^#/d' s_symbols.list && + (sed -e '/^#/d' s_export.list && eval $NM | sed 's/.* //' | egrep -v '^__wt') | diff --git a/dist/s_symbols.list b/dist/s_export.list index 8f469e94433..8f469e94433 100644 --- a/dist/s_symbols.list +++ b/dist/s_export.list diff --git a/dist/s_prototypes b/dist/s_prototypes index f29b96a1f55..603c0f5633d 100755 --- a/dist/s_prototypes +++ b/dist/s_prototypes @@ -31,7 +31,7 @@ for i in `sed -e '/^[a-z]/!d' filelist`; do -e 's/\* /\*/g' \ -e 's/ */ /g' \ -e 's/^/extern /' \ - -e 's/WT_GCC_FUNC_/WT_GCC_/' \ + -e 's/WT_GCC_FUNC_/WT_GCC_FUNC_DECL_/' \ -e 's/$/;/p' \ < ../$i done) > $t diff --git a/dist/s_string.ok b/dist/s_string.ok index cea96db2848..1658684313c 100644 --- a/dist/s_string.ok +++ b/dist/s_string.ok @@ -881,6 +881,7 @@ poptable pos posint posix +pragmas pre prealloc preload diff --git a/dist/s_typedef b/dist/s_typedef index 6b230223baa..2e206757f48 100644..100755 --- a/dist/s_typedef +++ b/dist/s_typedef @@ -20,8 +20,12 @@ build() { l=`ls ../src/include/*.[hi] ../src/include/*.in | sed -e '/wiredtiger.*/d' -e '/queue.h/d'` - egrep -h '^[ ]*(struct|union)[ ]*__.*[ ]*{' $l | \ - sed -e 's/^[ ]*//' -e 's/[ ]*{.*//' | sort | \ + egrep -h \ + '^[ ]*(((struct|union)[ ].*__wt_.*{)|WT_PACKED_STRUCT_BEGIN)' \ + $l | + sed -e 's/WT_PACKED_STRUCT_BEGIN(\(.*\))/struct \1 {/' \ + -e 's/WT_COMPILER_TYPE_ALIGN(.*)[ ]*//' \ + -e 's/^[ ]*//' -e 's/[ ]*{.*//' | sort | \ while read t n; do upper=`echo $n | sed -e 's/^__//' | tr [a-z] [A-Z]` echo "$t $n;" diff --git a/dist/s_win b/dist/s_win index 187de91e498..cdfc71a8a1e 100755 --- a/dist/s_win +++ b/dist/s_win @@ -26,6 +26,19 @@ win_config() } } +win_export() +{ + # Build the Windows list of exported symbols. + f='../build_win/wiredtiger.def' + (echo 'LIBRARY WIREDTIGER' + echo 'EXPORTS' + sed -e '/^$/d' \ + -e '/^#/d' \ + -e 's/^/ /') < s_export.list > $t + cmp $t $f > /dev/null 2>&1 || + (echo "Building $f" && rm -f $f && cp $t $f) +} + win_filelist() { f='../build_win/filelist.win' @@ -65,6 +78,7 @@ win_filelist() } win_config +win_export win_filelist exit 0 diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index af9f6a669f2..5a3342e62a9 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -48,7 +48,7 @@ static void __debug_row_skip(WT_DBG *, WT_INSERT_HEAD *); static int __debug_tree(WT_SESSION_IMPL *, WT_PAGE *, const char *, uint32_t); static void __debug_update(WT_DBG *, WT_UPDATE *, int); static void __dmsg(WT_DBG *, const char *, ...) - WT_GCC_ATTRIBUTE((format (printf, 2, 3))); + WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 2, 3))); static void __dmsg_wrapup(WT_DBG *); /* diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index f0414c4e855..14d16afb9a3 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -676,6 +676,22 @@ __btree_page_sizes(WT_SESSION_IMPL *session) leaf_split_size = __wt_split_page_size(btree, btree->maxleafpage); /* + * In-memory split configuration. + */ + if (__wt_config_gets( + session, cfg, "split_deepen_min_child", &cval) == WT_NOTFOUND || + cval.val == 0) + btree->split_deepen_min_child = WT_SPLIT_DEEPEN_MIN_CHILD_DEF; + else + btree->split_deepen_min_child = (u_int)cval.val; + if (__wt_config_gets( + session, cfg, "split_deepen_per_child", &cval) == WT_NOTFOUND || + cval.val == 0) + btree->split_deepen_per_child = WT_SPLIT_DEEPEN_PER_CHILD_DEF; + else + btree->split_deepen_per_child = (u_int)cval.val; + + /* * Get the maximum internal/leaf page key/value sizes. * * In historic versions of WiredTiger, the maximum internal/leaf page diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index a11c75a00ba..108d873ca2e 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -170,13 +170,6 @@ __split_safe_free(WT_SESSION_IMPL *session, } /* - * Tuning; global variables to allow the binary to be patched, we don't yet have - * any real understanding of what might be useful to surface to applications. - */ -static u_int __split_deepen_min_child = 10000; -static u_int __split_deepen_per_child = 100; - -/* * __split_should_deepen -- * Return if we should deepen the tree. */ @@ -184,11 +177,13 @@ static int __split_should_deepen( WT_SESSION_IMPL *session, WT_REF *ref, uint32_t *childrenp) { - WT_PAGE_INDEX *pindex; + WT_BTREE *btree; WT_PAGE *page; + WT_PAGE_INDEX *pindex; *childrenp = 0; + btree = S2BT(session); page = ref->page; pindex = WT_INTL_INDEX_COPY(page); @@ -205,8 +200,8 @@ __split_should_deepen( * we get a significant payback (in the case of a set of large keys, * splitting won't help). */ - if (pindex->entries > __split_deepen_min_child) { - *childrenp = pindex->entries / __split_deepen_per_child; + if (pindex->entries > btree->split_deepen_min_child) { + *childrenp = pindex->entries / btree->split_deepen_per_child; return (1); } diff --git a/src/btree/bt_vrfy.c b/src/btree/bt_vrfy.c index fafb4b58fc4..2957eda3a49 100644 --- a/src/btree/bt_vrfy.c +++ b/src/btree/bt_vrfy.c @@ -366,11 +366,16 @@ recno_chk: if (recno != vs->record_total + 1) goto celltype_err; break; case WT_PAGE_COL_VAR: - case WT_PAGE_ROW_LEAF: if (unpack->raw != WT_CELL_ADDR_LEAF && unpack->raw != WT_CELL_ADDR_LEAF_NO) goto celltype_err; break; + case WT_PAGE_ROW_LEAF: + if (unpack->raw != WT_CELL_ADDR_DEL && + unpack->raw != WT_CELL_ADDR_LEAF && + unpack->raw != WT_CELL_ADDR_LEAF_NO) + goto celltype_err; + break; case WT_PAGE_COL_INT: case WT_PAGE_ROW_INT: if (unpack->raw != WT_CELL_ADDR_INT) diff --git a/src/config/config_def.c b/src/config/config_def.c index 646551cdd38..a7e9419a65c 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -152,6 +152,8 @@ static const WT_CONFIG_CHECK confchk_file_meta[] = { { "os_cache_max", "int", "min=0", NULL }, { "prefix_compression", "boolean", NULL, NULL }, { "prefix_compression_min", "int", "min=0", NULL }, + { "split_deepen_min_child", "int", NULL, NULL }, + { "split_deepen_per_child", "int", NULL, NULL }, { "split_pct", "int", "min=25,max=100", NULL }, { "value_format", "format", NULL, NULL }, { "version", "string", NULL, NULL }, @@ -246,6 +248,8 @@ static const WT_CONFIG_CHECK confchk_session_create[] = { { "prefix_compression", "boolean", NULL, NULL }, { "prefix_compression_min", "int", "min=0", NULL }, { "source", "string", NULL, NULL }, + { "split_deepen_min_child", "int", NULL, NULL }, + { "split_deepen_per_child", "int", NULL, NULL }, { "split_pct", "int", "min=25,max=100", NULL }, { "type", "string", NULL, NULL }, { "value_format", "format", NULL, NULL }, @@ -585,7 +589,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { ",key_format=u,key_gap=10,leaf_item_max=0,leaf_key_max=0," "leaf_page_max=32KB,leaf_value_max=0,memory_page_max=5MB," "os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0," - "prefix_compression_min=4,split_pct=75,value_format=u," + "prefix_compression_min=4,split_deepen_min_child=0," + "split_deepen_per_child=0,split_pct=75,value_format=u," "version=(major=0,minor=0)", confchk_file_meta }, @@ -626,8 +631,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { "bloom_hash_count=8,bloom_oldest=0,chunk_max=5GB,chunk_size=10MB," "merge_max=15,merge_min=0),memory_page_max=5MB," "os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0," - "prefix_compression_min=4,source=,split_pct=75,type=file," - "value_format=u", + "prefix_compression_min=4,source=,split_deepen_min_child=0," + "split_deepen_per_child=0,split_pct=75,type=file,value_format=u", confchk_session_create }, { "session.drop", diff --git a/src/docs/install.dox b/src/docs/build-posix.dox index eae566f4291..db382561b60 100644 --- a/src/docs/install.dox +++ b/src/docs/build-posix.dox @@ -1,11 +1,9 @@ -/*! @page install Building and installing WiredTiger +/*! @page build-posix Building and installing WiredTiger on POSIX -This section explains how to build and install the WiredTiger software. - -@section github Building using Git and GitHub +@section posix_github Building using Git and GitHub Skip this step if you are building from a WiredTiger release package, -and proceed with @ref building. +and proceed with @ref posix_building. To build from the WiredTiger GitHub repository requires <a href="http://git-scm.com/">git</a>, @@ -28,11 +26,11 @@ cd wiredtiger sh autogen.sh @endcode -Now proceed with @ref building. +Now proceed with @ref posix_building. -@section building Building WiredTiger +@section posix_building Building WiredTiger -To build the WiredTiger software on a POSIX-like system, change directory to +To build the WiredTiger software on a POSIX system, change directory to the top-level directory, then configure and build the software: @code @@ -60,7 +58,7 @@ and <a href="http://www.gnu.org/software/libtool/libtool.html">libtool</a> to create the configure script and Makefiles. The standard options for those tools can be specified when configuring and building WiredTiger. -@section installing Installing WiredTiger +@section posix_installing Installing WiredTiger The WiredTiger software consists of a library and a single standalone utility. @@ -110,7 +108,7 @@ a different location: ./configure --prefix=/c/wiredtiger @endcode -@section configure Configuring WiredTiger +@section posix_configure Configuring WiredTiger The WiredTiger software supports some additional configuration options: @@ -169,7 +167,7 @@ WiredTiger to use POSIX 1003.1c pthread mutexes configured to be adaptive (where that functionality is available), or \c gcc (which configures WiredTiger to use gcc-based spinlocks). -@section compiler Changing compiler or loader options +@section posix_compiler Changing compiler or loader options To change the compiler or loader behavior during the build, use the <code>CC</code>, <code>CFLAGS</code>, <code>LDFLAGS</code>, or diff --git a/src/docs/build-windows.dox b/src/docs/build-windows.dox new file mode 100644 index 00000000000..79df6b9712d --- /dev/null +++ b/src/docs/build-windows.dox @@ -0,0 +1,108 @@ +/*! @page build-windows Building and installing WiredTiger on Windows + +@section windows_github Building using Git and GitHub + +Skip this step if you are building from a WiredTiger release package, +and proceed with @ref windows_building + +First, clone the repository: + +@code +git clone git://github.com/wiredtiger/wiredtiger.git +@endcode + +Now proceed with @ref windows_building + +@section windows_building Building on Windows + +Building WiredTiger on Windows requires +<a href="http://www.scons.org">SCons</a> as well as the Microsoft Visual +C++ compiler in Microsoft Visual Studio. + +Change directory to the top-level directory, then build the software: + +@code +cd wiredtiger +scons +@endcode + +To rebuild from scratch, discard any previous configuration by cleaning +out the build area: + +@code +scons -c +@endcode + +To see additional configuration options, run: + +@code +scons --help +@endcode + +To build the python language support, a 64-bit version of Python is +required. The required version is referred to as x86-64 on +<a href="www.python.org">Python.org</a> or x64 on +<a href="http://www.activestate.com/activepython/downloads"> +ActiveState Python</a>. + +@section windows_installing Installing WiredTiger + +The WiredTiger software consists of a library and a single standalone +utility. + +WiredTiger's distribution follows the GNU Coding Standards installation +guidelines, and by default WiredTiger builds and installs a static library +and dll version of the library. + +@code +file <root directory>/package/bin/ +wt.exe: x64 standalone executable +wiredtiger.dll: x64 dynamically linked library + +file <root directory>/package/lib/ +libwiredtiger.lib: x64 static library +wiredtiger.lib: x64 import library for dll +@endcode + +To install WiredTiger: + +@code +scons install +@endcode + +To install WiredTiger's libraries or binaries into alternate locations, +you can use the --prefix configuration option. + +@code +scons --prefix=c:\wiredtiger install +@endcode + +@section windows_configure Configuring WiredTiger + +The WiredTiger software supports some additional configuration options: + +@par \c --enable-attach +Configure WiredTiger to sleep and wait for a debugger to attach on failure. +<b>DO NOT</b> configure this option in production environments. + +@par \c --enable-diagnostic +Configure WiredTiger to perform various run-time diagnostic tests. +<b>DO NOT</b> configure this option in production environments. + +@par \c --enable-python +Build the WiredTiger <a href="http://www.python.org">Python</a> API, +requires path to swig.exe on Windows. + +@par \c --enable-snappy +Configure WiredTiger for <a href="http://code.google.com/p/snappy/">snappy</a> +compression; see @ref compression for more information. + +@par \c --enable-verbose +Configure WiredTiger to support the \c verbose configuration string to +::wiredtiger_open. + +@par \c --enable-zlib +Configure WiredTiger for <a href="http://www.zlib.net/">zlib</a> +compression; see @ref compression for more information. + + */ diff --git a/src/docs/introduction.dox b/src/docs/introduction.dox index 8e8c0d9e7cf..cc2a25d2d0e 100644 --- a/src/docs/introduction.dox +++ b/src/docs/introduction.dox @@ -25,14 +25,16 @@ right for your project, see: For more information about building and installing WiredTiger, see: -- @subpage install -- @subpage leveldb +- @subpage build-posix +- @subpage build-windows For more information about writing WiredTiger applications, see: - @subpage programming - @subpage programming_lang_java +(The Java API is not available on Windows.) - @ref wt "WiredTiger API reference manual" +- @subpage leveldb - @subpage performance For more information about administrating WiredTiger databases, see: diff --git a/src/docs/spell.ok b/src/docs/spell.ok index 56d1aa1170f..f7531ef881e 100644 --- a/src/docs/spell.ok +++ b/src/docs/spell.ok @@ -1,5 +1,6 @@ personal_ws-1.1 en 200 ACM +ActiveState APIs Adler's Atomicity @@ -64,6 +65,7 @@ Riak RocksDB Roelofs Rrx +SCons Seward's SiH TXT @@ -161,6 +163,7 @@ destructors dev distclean dl +dll dlp dontlock dp @@ -181,6 +184,7 @@ env eof erlang errno +exe fadvise failchk fd's @@ -371,6 +375,7 @@ sHq scalable scanf schemas +scons selectable seqname seqno diff --git a/src/evict/evict_file.c b/src/evict/evict_file.c index 553acc988f0..98821b6eb11 100644 --- a/src/evict/evict_file.c +++ b/src/evict/evict_file.c @@ -116,7 +116,7 @@ __wt_evict_file(WT_SESSION_IMPL *session, int syncop) if (syncop == WT_SYNC_DISCARD_FORCE) F_SET(session, WT_SESSION_DISCARD_FORCE); - __wt_rec_page_clean_update(session, ref); + __wt_evict_page_clean_update(session, ref); F_CLR(session, WT_SESSION_DISCARD_FORCE); break; WT_ILLEGAL_VALUE_ERR(session); diff --git a/src/evict/evict_page.c b/src/evict/evict_page.c index 5bbf3b891f7..c4b175efe41 100644 --- a/src/evict/evict_page.c +++ b/src/evict/evict_page.c @@ -98,7 +98,7 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive) if (__wt_ref_is_root(ref)) __wt_ref_out(session, ref); else - __wt_rec_page_clean_update(session, ref); + __wt_evict_page_clean_update(session, ref); WT_STAT_FAST_CONN_INCR(session, cache_eviction_clean); WT_STAT_FAST_DATA_INCR(session, cache_eviction_clean); @@ -139,11 +139,11 @@ done: session->excl_next = 0; } /* - * __wt_rec_page_clean_update -- + * __wt_evict_page_clean_update -- * Update a clean page's reference on eviction. */ void -__wt_rec_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref) +__wt_evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref) { /* * Discard the page and update the reference structure; if the page has diff --git a/src/include/btmem.h b/src/include/btmem.h index d020d29351c..8362b760da3 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -759,11 +759,11 @@ struct __wt_col { * with RLE counts greater than 1 when reading the page. We can do a binary * search in this array, then an offset calculation to find the cell. */ -struct __wt_col_rle { +WT_PACKED_STRUCT_BEGIN(__wt_col_rle) uint64_t recno; /* Record number of first repeat. */ uint64_t rle; /* Repeat count. */ uint32_t indx; /* Slot of entry in col_var.d */ -} WT_GCC_ATTRIBUTE((packed)); +WT_PACKED_STRUCT_END /* * WT_COL_PTR, WT_COL_PTR_SET -- @@ -827,7 +827,7 @@ struct __wt_ikey { * is done for an entry, WT_UPDATE structures are formed into a forward-linked * list. */ -struct __wt_update { +WT_PACKED_STRUCT_BEGIN(__wt_update) uint64_t txnid; /* update transaction */ WT_UPDATE *next; /* forward-linked list */ @@ -846,7 +846,7 @@ struct __wt_update { /* The untyped value immediately follows the WT_UPDATE structure. */ #define WT_UPDATE_DATA(upd) \ ((void *)((uint8_t *)(upd) + sizeof(WT_UPDATE))) -} WT_GCC_ATTRIBUTE((packed)); +}; /* * WT_INSERT -- diff --git a/src/include/btree.h b/src/include/btree.h index fa01dd5edc2..dd3acf6940d 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -98,14 +98,21 @@ struct __wt_btree { CKSUM_UNCOMPRESSED=3 /* Uncompressed blocks only */ } checksum; /* Checksum configuration */ - u_int dictionary; /* Reconcile: dictionary slots */ - int internal_key_truncate; /* Reconcile: internal key truncate */ - int maximum_depth; /* Reconcile: maximum tree depth */ - int prefix_compression; /* Reconcile: prefix compression */ - u_int prefix_compression_min; /* Reconcile: prefix compression min */ - int split_pct; /* Reconcile: split page percent */ - WT_COMPRESSOR *compressor; /* Reconcile: page compressor */ - WT_RWLOCK *ovfl_lock; /* Reconcile: overflow lock */ + /* + * Reconciliation... + */ + u_int dictionary; /* Dictionary slots */ + int internal_key_truncate; /* Internal key truncate */ + int maximum_depth; /* Maximum tree depth */ + int prefix_compression; /* Prefix compression */ + u_int prefix_compression_min; /* Prefix compression min */ +#define WT_SPLIT_DEEPEN_MIN_CHILD_DEF 10000 + u_int split_deepen_min_child; /* Minimum entries to deepen tree */ +#define WT_SPLIT_DEEPEN_PER_CHILD_DEF 100 + u_int split_deepen_per_child; /* Entries per child when deepened */ + int split_pct; /* Split page percent */ + WT_COMPRESSOR *compressor; /* Page compressor */ + WT_RWLOCK *ovfl_lock; /* Overflow lock */ uint64_t last_recno; /* Column-store last record number */ diff --git a/src/include/extern.h b/src/include/extern.h index ee9c27581c8..e47f4ba09c0 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -302,7 +302,7 @@ extern int __wt_evict_lru_page(WT_SESSION_IMPL *session, int is_server); extern int __wt_cache_wait(WT_SESSION_IMPL *session, int full); extern void __wt_cache_dump(WT_SESSION_IMPL *session); extern int __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive); -extern void __wt_rec_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref); +extern void __wt_evict_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref); extern int __wt_log_ckpt(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn); extern void __wt_log_written_reset(WT_SESSION_IMPL *session); extern int __wt_log_get_all_files(WT_SESSION_IMPL *session, char ***filesp, u_int *countp, uint32_t *maxid, int active_only); @@ -423,7 +423,7 @@ extern int __wt_meta_track_handle_lock(WT_SESSION_IMPL *session, int created); extern int __wt_turtle_init(WT_SESSION_IMPL *session); extern int __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **valuep); extern int __wt_turtle_update( WT_SESSION_IMPL *session, const char *key, const char *value); -extern void __wt_abort(WT_SESSION_IMPL *session) WT_GCC_ATTRIBUTE((noreturn)); +extern void __wt_abort(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((noreturn)); extern int __wt_calloc(WT_SESSION_IMPL *session, size_t number, size_t size, void *retp); extern int __wt_realloc(WT_SESSION_IMPL *session, size_t *bytes_allocated_ret, size_t bytes_to_allocate, void *retp); extern int __wt_realloc_aligned(WT_SESSION_IMPL *session, size_t *bytes_allocated_ret, size_t bytes_to_allocate, void *retp); @@ -567,13 +567,13 @@ extern uint32_t __wt_cksum(const void *chunk, size_t len); extern void __wt_cksum_init(void); extern void __wt_event_handler_set(WT_SESSION_IMPL *session, WT_EVENT_HANDLER *handler); extern int __wt_eventv(WT_SESSION_IMPL *session, int msg_event, int error, const char *file_name, int line_number, const char *fmt, va_list ap); -extern void __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); -extern void __wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 2, 3))); -extern int __wt_ext_err_printf( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); -extern int __wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 2, 3))); -extern int __wt_ext_msg_printf( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); +extern void __wt_err(WT_SESSION_IMPL *session, int error, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4))); +extern void __wt_errx(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 2, 3))); +extern int __wt_ext_err_printf( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4))); +extern int __wt_msg(WT_SESSION_IMPL *session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 2, 3))); +extern int __wt_ext_msg_printf( WT_EXTENSION_API *wt_api, WT_SESSION *wt_session, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4))); extern int __wt_progress(WT_SESSION_IMPL *session, const char *s, uint64_t v); -extern void __wt_assert(WT_SESSION_IMPL *session, int error, const char *file_name, int line_number, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 5, 6))); +extern void __wt_assert(WT_SESSION_IMPL *session, int error, const char *file_name, int line_number, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 5, 6))); extern int __wt_panic(WT_SESSION_IMPL *session); extern int __wt_illegal_value(WT_SESSION_IMPL *session, const char *name); extern int __wt_object_unsupported(WT_SESSION_IMPL *session, const char *uri); @@ -616,8 +616,8 @@ extern uint32_t __wt_rduppo2(uint32_t n, uint32_t po2); extern void __wt_random_init(uint32_t *rnd); extern uint32_t __wt_random(uint32_t *rnd); extern int __wt_buf_grow_worker(WT_SESSION_IMPL *session, WT_ITEM *buf, size_t size); -extern int __wt_buf_fmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); -extern int __wt_buf_catfmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...) WT_GCC_ATTRIBUTE((format (printf, 3, 4))); +extern int __wt_buf_fmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4))); +extern int __wt_buf_catfmt(WT_SESSION_IMPL *session, WT_ITEM *buf, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4))); extern int __wt_scr_alloc_func(WT_SESSION_IMPL *session, size_t size, WT_ITEM **scratchp #ifdef HAVE_DIAGNOSTIC diff --git a/src/include/gcc.h b/src/include/gcc.h index 7b606ca80b1..805838eb84b 100644 --- a/src/include/gcc.h +++ b/src/include/gcc.h @@ -7,7 +7,12 @@ */ /* Add GCC-specific attributes to types and function declarations. */ -#define WT_GCC_ATTRIBUTE(x) __attribute__(x) +#define WT_COMPILER_TYPE_ALIGN(x) __attribute__((aligned(x))) + +#define WT_PACKED_STRUCT_BEGIN(name) \ + struct __attribute__ ((__packed__)) name { +#define WT_PACKED_STRUCT_END \ + }; /* * Attribute are only permitted on function declarations, not definitions. @@ -15,6 +20,7 @@ * dist/s_prototypes to create extern.h. */ #define WT_GCC_FUNC_ATTRIBUTE(x) +#define WT_GCC_FUNC_DECL_ATTRIBUTE(x) __attribute__(x) /* * Atomic writes: diff --git a/src/include/lint.h b/src/include/lint.h index 9c560339e03..5668abc6dab 100644 --- a/src/include/lint.h +++ b/src/include/lint.h @@ -6,8 +6,15 @@ * See the file LICENSE for redistribution information. */ -#define WT_GCC_ATTRIBUTE(x) +#define WT_COMPILER_TYPE_ALIGN(x) + +#define WT_PACKED_STRUCT_BEGIN(name) \ + struct name { +#define WT_PACKED_STRUCT_END \ + }; + #define WT_GCC_FUNC_ATTRIBUTE(x) +#define WT_GCC_FUNC_DECL_ATTRIBUTE(x) #define __WT_ATOMIC_ADD(v, val) \ ((v) += (val)) diff --git a/src/include/log.h b/src/include/log.h index f88a5381227..82d90070609 100644 --- a/src/include/log.h +++ b/src/include/log.h @@ -70,7 +70,7 @@ #define WT_LOG_SLOT_FREE 1 #define WT_LOG_SLOT_PENDING 2 #define WT_LOG_SLOT_READY 3 -typedef struct { +typedef WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) struct { int64_t slot_state; /* Slot state */ uint64_t slot_group_size; /* Group size */ int32_t slot_error; /* Error value */ @@ -90,7 +90,7 @@ typedef struct { #define SLOT_SYNC 0x08 /* Needs sync on release */ #define SLOT_SYNC_DIR 0x10 /* Directory sync on release */ uint32_t flags; /* Flags */ -} WT_LOGSLOT WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT))); +} WT_LOGSLOT; typedef struct { WT_LOGSLOT *slot; diff --git a/src/include/lsm.h b/src/include/lsm.h index 8038e5a34ab..8d50f3ea73b 100644 --- a/src/include/lsm.h +++ b/src/include/lsm.h @@ -73,7 +73,7 @@ struct __wt_cursor_lsm { * WT_LSM_CHUNK -- * A single chunk (file) in an LSM tree. */ -struct __wt_lsm_chunk { +struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_lsm_chunk { const char *uri; /* Data source for this chunk */ const char *bloom_uri; /* URI of Bloom filter, if any */ struct timespec create_ts; /* Creation time (for rate limiting) */ @@ -101,7 +101,7 @@ struct __wt_lsm_chunk { #define WT_LSM_CHUNK_ONDISK 0x04 #define WT_LSM_CHUNK_STABLE 0x08 uint32_t flags; -} WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT))); +}; /* * Different types of work units. Used by LSM worker threads to choose which diff --git a/src/include/msvc.h b/src/include/msvc.h index f176a40f2bf..3ec74b2d629 100644 --- a/src/include/msvc.h +++ b/src/include/msvc.h @@ -13,8 +13,21 @@ #define inline __inline -#define WT_GCC_ATTRIBUTE(x) +/* + * Add MSVC-specific attributes and pragmas to types and function declarations. + */ +#define WT_COMPILER_TYPE_ALIGN(x) __declspec(align(x)) + +#define WT_PACKED_STRUCT_BEGIN(name) \ + __pragma(pack(push,1)) \ + struct name { + +#define WT_PACKED_STRUCT_END \ + }; \ + __pragma(pack(pop)) + #define WT_GCC_FUNC_ATTRIBUTE(x) +#define WT_GCC_FUNC_DECL_ATTRIBUTE(x) #define __WT_ATOMIC_ADD(v, val, n, s, t) \ (WT_STATIC_ASSERT(sizeof(v) == (n)), \ diff --git a/src/include/mutex.h b/src/include/mutex.h index c5b7587303d..07aa740c525 100644 --- a/src/include/mutex.h +++ b/src/include/mutex.h @@ -68,15 +68,15 @@ struct __wt_rwlock { #if SPINLOCK_TYPE == SPINLOCK_GCC -typedef volatile int - WT_SPINLOCK WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT))); +typedef volatile int WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) + WT_SPINLOCK; #elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX ||\ SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE ||\ SPINLOCK_TYPE == SPINLOCK_MSVC ||\ SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_LOGGING -typedef struct { +typedef WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) struct { wt_mutex_t lock; uint64_t counter; /* Statistics: counter */ @@ -85,7 +85,7 @@ typedef struct { int8_t id; /* Statistics: current holder ID */ int8_t initialized; /* Lock initialized, for cleanup */ -} WT_SPINLOCK WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT))); +} WT_SPINLOCK; #else diff --git a/src/include/session.h b/src/include/session.h index c2ed3473dfb..909f1daf5a4 100644 --- a/src/include/session.h +++ b/src/include/session.h @@ -42,7 +42,7 @@ struct __wt_hazard { * WT_SESSION_IMPL -- * Implementation of WT_SESSION. */ -struct __wt_session_impl { +struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_session_impl { WT_SESSION iface; void *lang_private; /* Language specific private storage */ @@ -190,4 +190,4 @@ struct __wt_session_impl { uint32_t hazard_size; /* Allocated slots in hazard array. */ uint32_t nhazard; /* Count of active hazard pointers */ WT_HAZARD *hazard; /* Hazard pointer array */ -} WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT))); +}; diff --git a/src/include/txn.h b/src/include/txn.h index 8380e55effb..c1c4703316b 100644 --- a/src/include/txn.h +++ b/src/include/txn.h @@ -25,10 +25,10 @@ #define WT_SESSION_TXN_STATE(s) (&S2C(s)->txn_global.states[(s)->id]) -struct __wt_txn_state { +struct WT_COMPILER_TYPE_ALIGN(WT_CACHE_LINE_ALIGNMENT) __wt_txn_state { volatile uint64_t id; volatile uint64_t snap_min; -} WT_GCC_ATTRIBUTE((aligned(WT_CACHE_LINE_ALIGNMENT))); +}; struct __wt_txn_global { volatile uint64_t current; /* Current transaction ID. */ diff --git a/src/include/wt_internal.h b/src/include/wt_internal.h index 1b3a9b62626..576827bebcd 100644 --- a/src/include/wt_internal.h +++ b/src/include/wt_internal.h @@ -36,7 +36,9 @@ extern "C" { #include <io.h> #endif #include <limits.h> -#ifndef _WIN32 +#ifdef _WIN32 +#include <process.h> +#else #include <pthread.h> #endif #ifdef HAVE_PTHREAD_NP_H diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 4b60fe6a6cd..a49b4c6a296 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -4009,7 +4009,6 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page) WT_ERR(__rec_child_modify(session, r, ref, &hazard, &state)); addr = ref->addr; child = ref->page; - vtype = 0; /* Deleted child we don't have to write. */ if (state == WT_CHILD_IGNORE) { @@ -4027,10 +4026,6 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page) continue; } - /* Deleted child requiring a proxy cell. */ - if (state == WT_CHILD_PROXY) - vtype = WT_CELL_ADDR_DEL; - /* * Modified child. Empty pages are merged into the parent and * discarded. @@ -4080,22 +4075,22 @@ __rec_row_int(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_PAGE *page) /* * Build the value cell, the child page's address. Addr points - * to an on-page cell or an off-page WT_ADDR structure. The - * cell type has been set in the case of page deletion requiring + * to an on-page cell or an off-page WT_ADDR structure. There's + * a special cell type in the case of page deletion requiring * a proxy cell, otherwise use the information from the addr or * original cell. */ if (__wt_off_page(page, addr)) { p = addr->addr; size = addr->size; - if (vtype == 0) - vtype = __rec_vtype(addr); + vtype = state == WT_CHILD_PROXY ? + WT_CELL_ADDR_DEL : __rec_vtype(addr); } else { __wt_cell_unpack(ref->addr, vpack); p = vpack->data; size = vpack->size; - if (vtype == 0) - vtype = vpack->raw; + vtype = state == WT_CHILD_PROXY ? + WT_CELL_ADDR_DEL : vpack->raw; } __rec_cell_build_addr(r, p, size, vtype, 0); CHILD_RELEASE_ERR(session, hazard, ref); diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c index 62890db7895..71f5df9dda2 100644 --- a/src/txn/txn_recover.c +++ b/src/txn/txn_recover.c @@ -47,10 +47,6 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r, c = NULL; - /* Track the largest file ID we have seen. */ - if (id > r->max_fileid) - r->max_fileid = id; - /* * Metadata operations have an id of 0. Match operations based * on the id and the current pass of recovery for metadata. @@ -313,6 +309,10 @@ __recovery_setup_file(WT_RECOVERY *r, const char *uri, const char *config) WT_RET(__wt_config_getones(r->session, config, "id", &cval)); fileid = (uint32_t)cval.val; + /* Track the largest file ID we have seen. */ + if (fileid > r->max_fileid) + r->max_fileid = fileid; + if (r->nfiles <= fileid) { WT_RET(__wt_realloc_def( r->session, &r->file_alloc, fileid + 1, &r->files)); diff --git a/test/mciproject.yml b/test/mciproject.yml index fe0f880602c..d7f66212b2a 100644 --- a/test/mciproject.yml +++ b/test/mciproject.yml @@ -53,7 +53,7 @@ tasks: set -o errexit set -o verbose - scons.bat --enable-swig=c:\\swigwin-3.0.2\\swig.exe ${smp_command|} + scons.bat --enable-python=c:\\swigwin-3.0.2\\swig.exe ${smp_command|} ${test_env_vars|} python ./test/suite/run.py -v 2 diff --git a/test/suite/test_truncate03.py b/test/suite/test_truncate03.py index 4e83734a77b..a69421b4217 100644 --- a/test/suite/test_truncate03.py +++ b/test/suite/test_truncate03.py @@ -100,7 +100,7 @@ class test_truncate_address_deleted(wttest.WiredTigerTestCase): # Test object creation, recovery, and conversion of address-deleted cells # into free pages, but instead of verifying the final object, instantiate - # empty pages by a reader the underlying leaf pages are removed. + # empty pages by a reader after the underlying leaf pages are removed. def test_truncate_address_deleted_empty_page(self): # Create the object on disk. self.address_deleted() diff --git a/test/windows/windows_shim.h b/test/windows/windows_shim.h index 441201e3744..97d1e996eaa 100644 --- a/test/windows/windows_shim.h +++ b/test/windows/windows_shim.h @@ -33,6 +33,7 @@ #include <stdint.h> #include <direct.h> #include <io.h> +#include <process.h> #define inline __inline @@ -66,8 +67,6 @@ int sched_yield(void); /* * Emulate <unistd.h> */ -#define getpid GetCurrentProcessId - typedef uint32_t useconds_t; int |