diff options
Diffstat (limited to 'src/third_party/wiredtiger')
59 files changed, 1123 insertions, 378 deletions
diff --git a/src/third_party/wiredtiger/build_cmake/README.md b/src/third_party/wiredtiger/build_cmake/README.md index 370df3732c7..42842bbe524 100644 --- a/src/third_party/wiredtiger/build_cmake/README.md +++ b/src/third_party/wiredtiger/build_cmake/README.md @@ -1,13 +1,15 @@ # Building WiredTiger with CMake -> *CMake support for building wiredtiger is an active work-in-progress. As of this time CMake can **only** build the WiredTiger library for POSIX platforms (Linux & Darwin) on x86 hosts. We suggest you continue using the autoconf build until further support is added.* +> *CMake support for building wiredtiger is an active work-in-progress. As of this time CMake can **only** build the WiredTiger library for POSIX platforms (Linux & Darwin). We suggest you continue using the SCons buildsystem when compiling for Windows.* ### Build Dependencies To build with CMake we **require** the following dependencies: * `cmake` : Official CMake install instructions found here: https://cmake.org/install/ - * *WiredTiger supports CMake 3.11+* + * *WiredTiger supports CMake 3.10+* * `ninja` : Official ninja install instructions found here: https://ninja-build.org/ +* `python3-dev` : Consult your package management application for installation instructions. This is needed for building with Python support. +* `swig`: Consult your package management application for installation instructions. This is needed for building with Python support. We also strongly suggest the following dependencies are also installed (for improved build times): @@ -23,6 +25,7 @@ Alternatively you can use your system's package manager to install the dependenc sudo apt-get install cmake cmake-curses-gui sudo apt-get install ccache sudo apt-get install ninja-build +sudo apt-get install python3-dev swig ``` ###### Install commands for Mac (using HomeBrew) @@ -31,10 +34,10 @@ sudo apt-get install ninja-build brew install ninja brew install ccache brew install cmake +brew install python +brew install swig ``` - - ### Building the WiredTiger Library > *The below commands are written for Linux and Darwin hosts. Windows instructions coming soon!* @@ -80,6 +83,7 @@ There are a number of additional configuration options you can pass to the CMake * `-DHAVE_DIAGNOSTIC=1` : Enable WiredTiger diagnostics * `-DHAVE_ATTACH=1` : Enable to pause for debugger attach on failure * `-DENABLE_STRICT=1` : Compile with strict compiler warnings enabled +* `-DENABLE_PYTHON=1` : Compile the python API * `-DCMAKE_INSTALL_PREFIX=<path-to-install-directory>` : Path to install directory --- @@ -118,3 +122,26 @@ $ cmake -DCMAKE_TOOLCHAIN_FILE=../build_cmake/toolchains/gcc.cmake -G Ninja ../. $ cd build $ cmake -DCMAKE_TOOLCHAIN_FILE=../build_cmake/toolchains/clang.cmake -G Ninja ../. ``` + +### Running WiredTiger C Tests + +The WiredTiger CMake build makes available a suite of C/C++ based tests (separate from the Python testsuite). The run all the tests available, ensure you're in the build directory and execute: + +```bash +ctest -j$(nproc) +``` + +To run with verbose output: + +```bash +ctest -j$(nproc) -VV +``` + +To run a specfic test: + +```bash +# Note: -R specifies a regex, where any matching test will be run +ctest -R <test_name> -j$(nproc) +``` + +See `ctest --help` for a range of additional supported options. diff --git a/src/third_party/wiredtiger/build_cmake/configs/aarch64/linux/config.cmake b/src/third_party/wiredtiger/build_cmake/configs/aarch64/linux/config.cmake new file mode 100644 index 00000000000..94447ac9ca8 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/configs/aarch64/linux/config.cmake @@ -0,0 +1,34 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information +# +include(CheckCCompilerFlag) + +set(WT_ARCH "aarch64" CACHE STRING "") +set(WT_OS "linux" CACHE STRING "") +set(WT_POSIX ON CACHE BOOL "") + +# Linux requires '_GNU_SOURCE' to be defined for access to GNU/Linux extension functions +# e.g. Access to O_DIRECT on Linux. Append this macro to our compiler flags for Linux-based +# builds. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE" CACHE STRING "" FORCE) + +# Linux requires buffers aligned to 4KB boundaries for O_DIRECT to work. +set(WT_BUFFER_ALIGNMENT_DEFAULT "4096" CACHE STRING "") + +# ARMv8-A is the 64-bit ARM architecture, turn on the optional CRC instructions. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a+crc" CACHE STRING "" FORCE) + +check_c_compiler_flag("-moutline-atomics" has_moutline_atomics) + +# moutline-atomics preserves backwards compatibility with Arm v8.0 systems but also supports +# using Arm v8.1 atomics. The latter can massively improve performance on larger Arm systems. +# The flag was back ported to gcc8, 9 and is the default in gcc10+. See if the compiler supports +# the flag. +if(has_moutline_atomics) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -moutline-atomics" CACHE STRING "" FORCE) +endif() +unset(has_moutline_atomics CACHE) diff --git a/src/third_party/wiredtiger/build_cmake/configs/auto.cmake b/src/third_party/wiredtiger/build_cmake/configs/auto.cmake index c3868bbdcd9..4f9aa657dc5 100644 --- a/src/third_party/wiredtiger/build_cmake/configs/auto.cmake +++ b/src/third_party/wiredtiger/build_cmake/configs/auto.cmake @@ -282,6 +282,14 @@ config_compile( DEPENDS "HAVE_LIBPTHREAD" ) +include(TestBigEndian) +test_big_endian(is_big_endian) +config_bool( + WORDS_BIGENDIAN + "If the target system is big endian" + DEFAULT ${is_big_endian} +) + set(wiredtiger_includes_decl) if(HAVE_SYS_TYPES_H) list(APPEND wiredtiger_includes_decl "#include <sys/types.h>") diff --git a/src/third_party/wiredtiger/build_cmake/configs/base.cmake b/src/third_party/wiredtiger/build_cmake/configs/base.cmake index 20ae0a319d0..a572fcb901e 100644 --- a/src/third_party/wiredtiger/build_cmake/configs/base.cmake +++ b/src/third_party/wiredtiger/build_cmake/configs/base.cmake @@ -15,9 +15,9 @@ config_choice( "Target architecture for WiredTiger" OPTIONS "x86;WT_X86;" - "arm64;WT_ARM64;" - "ppc64;WT_PPC64;" - "zseries;WT_ZSERIES;" + "aarch64;WT_AARCH64;" + "ppc64le;WT_PPC64;" + "s390x;WT_S390X;" ) config_choice( @@ -166,7 +166,7 @@ config_string( config_string( VERSION_PATCH "Path version number for WiredTiger" - DEFAULT 0 + DEFAULT 1 ) @@ -174,11 +174,18 @@ string(TIMESTAMP config_date "%Y-%m-%d") config_string( VERSION_STRING "Version string for WiredTiger" - DEFAULT "\"WiredTiger 10.0.0 (${config_date})\"" + DEFAULT "\"WiredTiger ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} (${config_date})\"" ) -if(HAVE_DIAGNOSTIC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" CACHE STRING "" FORCE) +if(HAVE_DIAGNOSTIC AND (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")) + # Avoid setting diagnostic flags if we are building with Debug mode. + # CMakes Debug config sets compilation with debug symbols by default. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CC_OPTIMIZE_LEVEL}" CACHE STRING "" FORCE) +if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") + # Don't use the optimization level if we have specified a release config. + # CMakes Release config sets compilation to the highest optimization level + # by default. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CC_OPTIMIZE_LEVEL}") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/configs/modes.cmake b/src/third_party/wiredtiger/build_cmake/configs/modes.cmake new file mode 100644 index 00000000000..5be475c51f1 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/configs/modes.cmake @@ -0,0 +1,63 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information +# + +# Establishes build configuration modes we can use when compiling. + +# Create an ASAN build variant +set(CMAKE_C_FLAGS_ASAN + "${CMAKE_C_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING + "Flags used by the C compiler for ASan build type or configuration." FORCE) + +set(CMAKE_CXX_FLAGS_ASAN + "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fno-omit-frame-pointer" CACHE STRING + "Flags used by the C++ compiler for ASan build type or configuration." FORCE) + +set(CMAKE_EXE_LINKER_FLAGS_ASAN + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address -static-libasan" CACHE STRING + "Linker flags to be used to create executables for ASan build type." FORCE) + +set(CMAKE_SHARED_LINKER_FLAGS_ASAN + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address -static-libasan" CACHE STRING + "Linker lags to be used to create shared libraries for ASan build type." FORCE) + +mark_as_advanced( + CMAKE_CXX_FLAGS_ASAN + CMAKE_C_FLAGS_ASAN + CMAKE_EXE_LINKER_FLAGS_ASAN + CMAKE_SHARED_LINKER_FLAGS_ASAN +) + +# Create an UBSAN build variant +set(CMAKE_C_FLAGS_UBSAN + "${CMAKE_C_FLAGS_DEBUG} -fsanitize=undefined -fno-omit-frame-pointer" CACHE STRING + "Flags used by the C compiler for UBSan build type or configuration." FORCE) + +set(CMAKE_CXX_FLAGS_UBSAN + "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined -fno-omit-frame-pointer" CACHE STRING + "Flags used by the C++ compiler for UBSan build type or configuration." FORCE) + +set(CMAKE_EXE_LINKER_FLAGS_UBSAN + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -lubsan" CACHE STRING + "Linker flags to be used to create executables for UBSan build type." FORCE) + +set(CMAKE_SHARED_LINKER_FLAGS_UBSAN + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=undefined -lubsan" CACHE STRING + "Linker lags to be used to create shared libraries for UBSan build type." FORCE) + +mark_as_advanced( + CMAKE_CXX_FLAGS_UBSAN + CMAKE_C_FLAGS_UBSAN + CMAKE_EXE_LINKER_FLAGS_UBSAN + CMAKE_SHARED_LINKER_FLAGS_UBSAN +) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "None" CACHE STRING "Choose the type of build, options are: None Debug Release ASan UBSan." FORCE) +endif() + +set(CMAKE_CONFIGURATION_TYPES None Debug Release ASan UBSan) diff --git a/src/third_party/wiredtiger/build_cmake/configs/ppc64le/linux/config.cmake b/src/third_party/wiredtiger/build_cmake/configs/ppc64le/linux/config.cmake new file mode 100644 index 00000000000..4d1821c9e18 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/configs/ppc64le/linux/config.cmake @@ -0,0 +1,27 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information +# + +set(WT_ARCH "ppc64le" CACHE STRING "") +set(WT_OS "linux" CACHE STRING "") +set(WT_POSIX ON CACHE BOOL "") + +# Linux requires '_GNU_SOURCE' to be defined for access to GNU/Linux extension functions +# e.g. Access to O_DIRECT on Linux. Append this macro to our compiler flags for Linux-based +# builds. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE" CACHE STRING "" FORCE) + +# Linux requires buffers aligned to 4KB boundaries for O_DIRECT to work. +set(WT_BUFFER_ALIGNMENT_DEFAULT "4096" CACHE STRING "") + +# Allow assembler to detect '.sx' file extensions. +list(APPEND CMAKE_ASM_SOURCE_FILE_EXTENSION "sx") + +# Our ASM-based checksum utility 'crc32.sx' triggers unused-macros diagnostic errors +# when compiling. To avoid editing the original source, override the usage '-Wunused-macros' +# for this specific file. +set_source_files_properties(src/checksum/power8/crc32.sx PROPERTIES COMPILE_FLAGS -Wno-unused-macros) diff --git a/src/third_party/wiredtiger/build_cmake/configs/s390x/linux/config.cmake b/src/third_party/wiredtiger/build_cmake/configs/s390x/linux/config.cmake new file mode 100644 index 00000000000..639da9f297e --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/configs/s390x/linux/config.cmake @@ -0,0 +1,22 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information +# + +set(WT_ARCH "s390x" CACHE STRING "") +set(WT_OS "linux" CACHE STRING "") +set(WT_POSIX ON CACHE BOOL "") + +# Linux requires '_GNU_SOURCE' to be defined for access to GNU/Linux extension functions +# e.g. Access to O_DIRECT on Linux. Append this macro to our compiler flags for Linux-based +# builds. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE" CACHE STRING "" FORCE) + +# Linux requires buffers aligned to 4KB boundaries for O_DIRECT to work. +set(WT_BUFFER_ALIGNMENT_DEFAULT "4096" CACHE STRING "") + +# Allow assembler to detect '.sx' file extensions. +list(APPEND CMAKE_ASM_SOURCE_FILE_EXTENSION "sx") diff --git a/src/third_party/wiredtiger/build_cmake/configs/wiredtiger_config.h.in b/src/third_party/wiredtiger/build_cmake/configs/wiredtiger_config.h.in index f772594fc45..50937d6b95d 100644 --- a/src/third_party/wiredtiger/build_cmake/configs/wiredtiger_config.h.in +++ b/src/third_party/wiredtiger/build_cmake/configs/wiredtiger_config.h.in @@ -129,6 +129,9 @@ /* Spinlock type from mutex.h. */ #cmakedefine SPINLOCK_TYPE @SPINLOCK_TYPE_CONFIG_VAR@ +/* Define to 1 if the target system is big endian */ +#cmakedefine WORDS_BIGENDIAN 1 + /* Version number of package */ #define VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" diff --git a/src/third_party/wiredtiger/build_cmake/configs/x86/linux/config.cmake b/src/third_party/wiredtiger/build_cmake/configs/x86/linux/config.cmake index e7d5742fb27..4cd2d6882e4 100644 --- a/src/third_party/wiredtiger/build_cmake/configs/x86/linux/config.cmake +++ b/src/third_party/wiredtiger/build_cmake/configs/x86/linux/config.cmake @@ -13,7 +13,7 @@ set(WT_POSIX ON CACHE BOOL "") # Linux requires '_GNU_SOURCE' to be defined for access to GNU/Linux extension functions # e.g. Access to O_DIRECT on Linux. Append this macro to our compiler flags for Linux-based # builds. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE") # Linux requires buffers aligned to 4KB boundaries for O_DIRECT to work. set(WT_BUFFER_ALIGNMENT_DEFAULT "4096" CACHE STRING "") diff --git a/src/third_party/wiredtiger/build_cmake/helpers.cmake b/src/third_party/wiredtiger/build_cmake/helpers.cmake index 896518f92f5..d353c04aa8a 100644 --- a/src/third_party/wiredtiger/build_cmake/helpers.cmake +++ b/src/third_party/wiredtiger/build_cmake/helpers.cmake @@ -593,11 +593,11 @@ function(parse_filelist_source filelist output_var) # Determine architecture host for our filelist parse. if(WT_X86) set(arch_host "X86_HOST") - elseif(WT_ARM64) + elseif(WT_AARCH64) set(arch_host "ARM64_HOST") elseif(WT_PPC64) set(arch_host "POWERPC_HOST") - elseif(WT_ZSERIES) + elseif(WT_S390X) set(arch_host "ZSERIES_HOST") endif() # Determine platform host for our filelist parse. @@ -624,6 +624,13 @@ function(parse_filelist_source filelist output_var) list(GET file_contents 1 file_group) if ((${file_group} STREQUAL "${plat_host}") OR (${file_group} STREQUAL "${arch_host}")) list(APPEND output_files ${file_name}) + get_filename_component(file_ext ${file_name} EXT) + # POWERPC and ZSERIES hosts use the '.sx' extension for their ASM files. We need to + # manually tell CMake to ASM compile these files otherwise it will ignore them during + # compilation process. + if("${file_ext}" STREQUAL ".sx") + set_source_files_properties(${file_name} PROPERTIES LANGUAGE ASM) + endif() endif() else() message(FATAL_ERROR "filelist (${filelist}) has an unexpected format [Invalid Line: \"${file}]\"") diff --git a/src/third_party/wiredtiger/build_cmake/strict/clang_strict.cmake b/src/third_party/wiredtiger/build_cmake/strict/clang_strict.cmake index 4ab3fa76ccb..b00dd1de6dd 100644 --- a/src/third_party/wiredtiger/build_cmake/strict/clang_strict.cmake +++ b/src/third_party/wiredtiger/build_cmake/strict/clang_strict.cmake @@ -6,34 +6,34 @@ # See the file LICENSE for redistribution information. # -string(APPEND clang_base_c_flags " -Weverything -Werror") -string(APPEND clang_base_c_flags " -Wno-cast-align") -string(APPEND clang_base_c_flags " -Wno-documentation-unknown-command") -string(APPEND clang_base_c_flags " -Wno-format-nonliteral") -string(APPEND clang_base_c_flags " -Wno-packed") -string(APPEND clang_base_c_flags " -Wno-padded") -string(APPEND clang_base_c_flags " -Wno-reserved-id-macro") -string(APPEND clang_base_c_flags " -Wno-zero-length-array") +list(APPEND clang_base_c_flags "-Weverything") +list(APPEND clang_base_c_flags "-Werror") +list(APPEND clang_base_c_flags "-Wno-cast-align") +list(APPEND clang_base_c_flags "-Wno-documentation-unknown-command") +list(APPEND clang_base_c_flags "-Wno-format-nonliteral") +list(APPEND clang_base_c_flags "-Wno-packed") +list(APPEND clang_base_c_flags "-Wno-padded") +list(APPEND clang_base_c_flags "-Wno-reserved-id-macro") +list(APPEND clang_base_c_flags "-Wno-zero-length-array") # We should turn on cast-qual, but not as a fatal error: see WT-2690. # For now, turn it off. -# string(APPEND clang_base_c_flags "-Wno-error=cast-qual") -string(APPEND clang_base_c_flags " -Wno-cast-qual") +list(APPEND clang_base_c_flags "-Wno-cast-qual") # Turn off clang thread-safety-analysis, it doesn't like some of the # code patterns in WiredTiger. -string(APPEND clang_base_c_flags " -Wno-thread-safety-analysis") +list(APPEND clang_base_c_flags "-Wno-thread-safety-analysis") # On Centos 7.3.1611, system header files aren't compatible with # -Wdisabled-macro-expansion. -string(APPEND clang_base_c_flags " -Wno-disabled-macro-expansion") +list(APPEND clang_base_c_flags "-Wno-disabled-macro-expansion") # We occasionally use an extra semicolon to indicate an empty loop or # conditional body. -string(APPEND clang_base_c_flags " -Wno-extra-semi-stmt") +list(APPEND clang_base_c_flags "-Wno-extra-semi-stmt") # Ignore unrecognized options. -string(APPEND clang_base_c_flags " -Wno-unknown-warning-option") +list(APPEND clang_base_c_flags "-Wno-unknown-warning-option") if(WT_DARWIN AND (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.1)) # Apple clang has its own numbering system, and older OS X @@ -41,10 +41,17 @@ if(WT_DARWIN AND (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 4.1)) # Apple's clang 4.1: # Apple clang version 4.1 # ((tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) - string(APPEND clang_base_c_flags " -Wno-attributes") - string(APPEND clang_base_c_flags " -Wno-pedantic") - string(APPEND clang_base_c_flags " -Wno-unused-command-line-argument") + list(APPEND clang_base_c_flags "-Wno-attributes") + list(APPEND clang_base_c_flags "-Wno-pedantic") + list(APPEND clang_base_c_flags "-Wno-unused-command-line-argument") +endif() + +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + # Clang 10+ has added additional on-by-default diagnostics that isn't + # compatible with some of the code patterns in WiredTiger. + list(APPEND clang_base_c_flags "-Wno-implicit-fallthrough") + list(APPEND clang_base_c_flags "-Wno-implicit-int-float-conversion") endif() # Set our base clang flags to ensure it propogates to the rest of our build. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${clang_base_c_flags}" CACHE STRING "" FORCE) +set(COMPILER_DIAGNOSTIC_FLAGS "${COMPILER_DIAGNOSTIC_FLAGS};${clang_base_c_flags}" CACHE INTERNAL "" FORCE) diff --git a/src/third_party/wiredtiger/build_cmake/strict/gcc_strict.cmake b/src/third_party/wiredtiger/build_cmake/strict/gcc_strict.cmake index d417315fc4b..420a4457676 100644 --- a/src/third_party/wiredtiger/build_cmake/strict/gcc_strict.cmake +++ b/src/third_party/wiredtiger/build_cmake/strict/gcc_strict.cmake @@ -6,74 +6,74 @@ # See the file LICENSE for redistribution information. # -string(APPEND gcc_base_c_flags " -Wall") -string(APPEND gcc_base_c_flags " -Wextra") -string(APPEND gcc_base_c_flags " -Werror") -string(APPEND gcc_base_c_flags " -Waggregate-return") -string(APPEND gcc_base_c_flags " -Wbad-function-cast") -string(APPEND gcc_base_c_flags " -Wcast-align") -string(APPEND gcc_base_c_flags " -Wdeclaration-after-statement") -string(APPEND gcc_base_c_flags " -Wdouble-promotion") -string(APPEND gcc_base_c_flags " -Wfloat-equal") -string(APPEND gcc_base_c_flags " -Wformat-nonliteral") -string(APPEND gcc_base_c_flags " -Wformat-security") -string(APPEND gcc_base_c_flags " -Wformat=2") -string(APPEND gcc_base_c_flags " -Winit-self") -string(APPEND gcc_base_c_flags " -Wjump-misses-init") -string(APPEND gcc_base_c_flags " -Wmissing-declarations") -string(APPEND gcc_base_c_flags " -Wmissing-field-initializers") -string(APPEND gcc_base_c_flags " -Wmissing-prototypes") -string(APPEND gcc_base_c_flags " -Wnested-externs") -string(APPEND gcc_base_c_flags " -Wold-style-definition") -string(APPEND gcc_base_c_flags " -Wpacked") -string(APPEND gcc_base_c_flags " -Wpointer-arith") -string(APPEND gcc_base_c_flags " -Wpointer-sign") -string(APPEND gcc_base_c_flags " -Wredundant-decls") -string(APPEND gcc_base_c_flags " -Wshadow") -string(APPEND gcc_base_c_flags " -Wsign-conversion") -string(APPEND gcc_base_c_flags " -Wstrict-prototypes") -string(APPEND gcc_base_c_flags " -Wswitch-enum") -string(APPEND gcc_base_c_flags " -Wundef") -string(APPEND gcc_base_c_flags " -Wuninitialized") -string(APPEND gcc_base_c_flags " -Wunreachable-code") -string(APPEND gcc_base_c_flags " -Wunused") -string(APPEND gcc_base_c_flags " -Wwrite-strings") +list(APPEND gcc_base_c_flags "-Wall") +list(APPEND gcc_base_c_flags "-Wextra") +list(APPEND gcc_base_c_flags "-Werror") +list(APPEND gcc_base_c_flags "-Waggregate-return") +list(APPEND gcc_base_c_flags "-Wbad-function-cast") +list(APPEND gcc_base_c_flags "-Wcast-align") +list(APPEND gcc_base_c_flags "-Wdeclaration-after-statement") +list(APPEND gcc_base_c_flags "-Wdouble-promotion") +list(APPEND gcc_base_c_flags "-Wfloat-equal") +list(APPEND gcc_base_c_flags "-Wformat-nonliteral") +list(APPEND gcc_base_c_flags "-Wformat-security") +list(APPEND gcc_base_c_flags "-Wformat=2") +list(APPEND gcc_base_c_flags "-Winit-self") +list(APPEND gcc_base_c_flags "-Wjump-misses-init") +list(APPEND gcc_base_c_flags "-Wmissing-declarations") +list(APPEND gcc_base_c_flags "-Wmissing-field-initializers") +list(APPEND gcc_base_c_flags "-Wmissing-prototypes") +list(APPEND gcc_base_c_flags "-Wnested-externs") +list(APPEND gcc_base_c_flags "-Wold-style-definition") +list(APPEND gcc_base_c_flags "-Wpacked") +list(APPEND gcc_base_c_flags "-Wpointer-arith") +list(APPEND gcc_base_c_flags "-Wpointer-sign") +list(APPEND gcc_base_c_flags "-Wredundant-decls") +list(APPEND gcc_base_c_flags "-Wshadow") +list(APPEND gcc_base_c_flags "-Wsign-conversion") +list(APPEND gcc_base_c_flags "-Wstrict-prototypes") +list(APPEND gcc_base_c_flags "-Wswitch-enum") +list(APPEND gcc_base_c_flags "-Wundef") +list(APPEND gcc_base_c_flags "-Wuninitialized") +list(APPEND gcc_base_c_flags "-Wunreachable-code") +list(APPEND gcc_base_c_flags "-Wunused") +list(APPEND gcc_base_c_flags "-Wwrite-strings") # Non-fatal informational warnings. # We don't turn on the unsafe-loop-optimizations warning after gcc7, # it's too noisy to tolerate. Regardless, don't fail even when it's # configured. -string(APPEND gcc_base_c_flags " -Wno-error=unsafe-loop-optimizations") +list(APPEND gcc_base_c_flags "-Wno-error=unsafe-loop-optimizations") if(${CMAKE_C_COMPILER_VERSION} VERSION_EQUAL 4.7) - string(APPEND gcc_base_c_flags " -Wno-c11-extensions") - string(APPEND gcc_base_c_flags " -Wunsafe-loop-optimizations") + list(APPEND gcc_base_c_flags "-Wno-c11-extensions") + list(APPEND gcc_base_c_flags "-Wunsafe-loop-optimizations") elseif(${CMAKE_C_COMPILER_VERSION} VERSION_EQUAL 5) - string(APPEND gcc_base_c_flags " -Wunsafe-loop-optimizations") + list(APPEND gcc_base_c_flags "-Wunsafe-loop-optimizations") endif() if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 5) - string(APPEND gcc_base_c_flags " -Wformat-signedness") - string(APPEND gcc_base_c_flags " -Wjump-misses-init") - string(APPEND gcc_base_c_flags " -Wredundant-decls") - string(APPEND gcc_base_c_flags " -Wunused-macros") - string(APPEND gcc_base_c_flags " -Wvariadic-macros") + list(APPEND gcc_base_c_flags "-Wformat-signedness") + list(APPEND gcc_base_c_flags "-Wjump-misses-init") + list(APPEND gcc_base_c_flags "-Wredundant-decls") + list(APPEND gcc_base_c_flags "-Wunused-macros") + list(APPEND gcc_base_c_flags "-Wvariadic-macros") endif() if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 6) - string(APPEND gcc_base_c_flags " -Wduplicated-cond") - string(APPEND gcc_base_c_flags " -Wlogical-op") - string(APPEND gcc_base_c_flags " -Wunused-const-variable=2") + list(APPEND gcc_base_c_flags "-Wduplicated-cond") + list(APPEND gcc_base_c_flags "-Wlogical-op") + list(APPEND gcc_base_c_flags "-Wunused-const-variable=2") endif() if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 7) - string(APPEND gcc_base_c_flags " -Walloca") - string(APPEND gcc_base_c_flags " -Walloc-zero") - string(APPEND gcc_base_c_flags " -Wduplicated-branches") - string(APPEND gcc_base_c_flags " -Wformat-overflow=2") - string(APPEND gcc_base_c_flags " -Wformat-truncation=2") - string(APPEND gcc_base_c_flags " -Wrestrict") + list(APPEND gcc_base_c_flags "-Walloca") + list(APPEND gcc_base_c_flags "-Walloc-zero") + list(APPEND gcc_base_c_flags "-Wduplicated-branches") + list(APPEND gcc_base_c_flags "-Wformat-overflow=2") + list(APPEND gcc_base_c_flags "-Wformat-truncation=2") + list(APPEND gcc_base_c_flags "-Wrestrict") endif() if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER_EQUAL 8) - string(APPEND gcc_base_c_flags " -Wmultistatement-macros") + list(APPEND gcc_base_c_flags "-Wmultistatement-macros") endif() # Set our base gcc flags to ensure it propogates to the rest of our build. -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${gcc_base_c_flags}" CACHE STRING "" FORCE) +set(COMPILER_DIAGNOSTIC_FLAGS "${COMPILER_DIAGNOSTIC_FLAGS};${gcc_base_c_flags}" CACHE INTERNAL "" FORCE) diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/aarch64/linux/plat_clang.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/aarch64/linux/plat_clang.cmake new file mode 100644 index 00000000000..98cc2a8892b --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/toolchains/aarch64/linux/plat_clang.cmake @@ -0,0 +1,15 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# + +if(CMAKE_CROSSCOMPILING) + set(TRIPLE_TARGET "aarch64-unknown-linux-gnu") + set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) + set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/aarch64/linux/plat_gcc.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/aarch64/linux/plat_gcc.cmake new file mode 100644 index 00000000000..b82bbfe9b94 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/toolchains/aarch64/linux/plat_gcc.cmake @@ -0,0 +1,11 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# + +if(CMAKE_CROSSCOMPILING) + set(CROSS_COMPILER_PREFIX "aarch64-linux-gnu-") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/clang.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/clang.cmake index 252f935976f..5b789f1134f 100644 --- a/src/third_party/wiredtiger/build_cmake/toolchains/clang.cmake +++ b/src/third_party/wiredtiger/build_cmake/toolchains/clang.cmake @@ -6,7 +6,7 @@ # See the file LICENSE for redistribution information. # -cmake_minimum_required(VERSION 3.11.0) +cmake_minimum_required(VERSION 3.10.0) set(CMAKE_C_COMPILER "clang") set(CMAKE_C_COMPILER_ID "Clang") diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/gcc.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/gcc.cmake index 25333335a2e..0fa64ed0037 100644 --- a/src/third_party/wiredtiger/build_cmake/toolchains/gcc.cmake +++ b/src/third_party/wiredtiger/build_cmake/toolchains/gcc.cmake @@ -6,7 +6,7 @@ # See the file LICENSE for redistribution information. # -cmake_minimum_required(VERSION 3.11.0) +cmake_minimum_required(VERSION 3.10.0) if(NOT "${COMPILE_DEFINITIONS}" STREQUAL "") ### Additional check to overcome check_[symbol|include|function]_exits using toolchain file without passing WT_ARCH and WT_OS. diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/ppc64le/linux/plat_clang.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/ppc64le/linux/plat_clang.cmake new file mode 100644 index 00000000000..f03d4fdbd97 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/toolchains/ppc64le/linux/plat_clang.cmake @@ -0,0 +1,15 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# + +if(CMAKE_CROSSCOMPILING) + set(TRIPLE_TARGET "powerpc64le-unknown-linux-gnu") + set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) + set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/ppc64le/linux/plat_gcc.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/ppc64le/linux/plat_gcc.cmake new file mode 100644 index 00000000000..47e706c0d39 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/toolchains/ppc64le/linux/plat_gcc.cmake @@ -0,0 +1,11 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# + +if(CMAKE_CROSSCOMPILING) + set(CROSS_COMPILER_PEFIX "powerpc64le-linux-gnu-") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/s390x/linux/plat_clang.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/s390x/linux/plat_clang.cmake new file mode 100644 index 00000000000..f643b9c8df8 --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/toolchains/s390x/linux/plat_clang.cmake @@ -0,0 +1,15 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# + +if(CMAKE_CROSSCOMPILING) + set(TRIPLE_TARGET "s390x-ibm-linux-gnu") + set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) + set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/s390x/linux/plat_gcc.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/s390x/linux/plat_gcc.cmake new file mode 100644 index 00000000000..abfff342dfb --- /dev/null +++ b/src/third_party/wiredtiger/build_cmake/toolchains/s390x/linux/plat_gcc.cmake @@ -0,0 +1,11 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# All rights reserved. +# +# See the file LICENSE for redistribution information. +# + +if(CMAKE_CROSSCOMPILING) + set(CROSS_COMPILER_PEFIX "s390x-linux-gnu-") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_clang.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_clang.cmake index da6aa0762b2..e7130be256f 100644 --- a/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_clang.cmake +++ b/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_clang.cmake @@ -6,9 +6,10 @@ # See the file LICENSE for redistribution information. # -set(TRIPLE_TARGET "x86_64-apple-darwin") - -set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) -set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") -set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") -set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +if(CMAKE_CROSSCOMPILING) + set(TRIPLE_TARGET "x86_64-apple-darwin") + set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) + set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_gcc.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_gcc.cmake index 8ec2f561e54..7a463e46d96 100644 --- a/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_gcc.cmake +++ b/src/third_party/wiredtiger/build_cmake/toolchains/x86/darwin/plat_gcc.cmake @@ -9,6 +9,6 @@ # We are not cross-compiling if our system is Darwin, hence the "x86_64-apple-darwin-" # prefix is not necessary when we are not cross-compiling. Just default to the host # installed 'gcc' binary. -if (NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin") - set(CROSS_COMPILER_PREFIX "x86_64-apple-darwin-" CACHE INTERNAL "" FORCE) +if(CMAKE_CROSSCOMPILING) + set(CROSS_COMPILER_PREFIX "x86_64-apple-darwin-") endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_clang.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_clang.cmake index 7eb4615b92d..126a3a1bbbe 100644 --- a/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_clang.cmake +++ b/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_clang.cmake @@ -6,9 +6,10 @@ # See the file LICENSE for redistribution information. # -set(TRIPLE_TARGET "x86_64-pc-linux-gnu") - -set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) -set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") -set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") -set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +if(CMAKE_CROSSCOMPILING) + set(TRIPLE_TARGET "x86_64-pc-linux-gnu") + set(CROSS_COMPILER_PREFIX ${TRIPLE_TARGET}-) + set(CMAKE_C_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_CXX_COMPILER_TARGET "${TRIPLE_TARGET}") + set(CMAKE_ASM_COMPILER_TARGET "${TRIPLE_TARGET}") +endif() diff --git a/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_gcc.cmake b/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_gcc.cmake index fc1f4307a08..2b36fb667d5 100644 --- a/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_gcc.cmake +++ b/src/third_party/wiredtiger/build_cmake/toolchains/x86/linux/plat_gcc.cmake @@ -6,4 +6,6 @@ # See the file LICENSE for redistribution information. # -set(CROSS_COMPILER_PREFIX "x86_64-linux-gnu-" CACHE INTERNAL "" FORCE) +if(CMAKE_CROSSCOMPILING) + set(CROSS_COMPILER_PREFIX "x86_64-linux-gnu-") +endif() diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py index 3a6abbbab5e..e1c95a1c8bd 100644 --- a/src/third_party/wiredtiger/dist/api_data.py +++ b/src/third_party/wiredtiger/dist/api_data.py @@ -596,9 +596,6 @@ connection_runtime_config = [ versions of WiredTiger. These operations are informational and skipped in recovery.''', type='boolean'), - Config('update_restore_evict', 'false', r''' - if true, control the page eviction through forcing update restore eviction.''', - type='boolean'), ]), Config('error_prefix', '', r''' prefix string for error messages'''), diff --git a/src/third_party/wiredtiger/dist/s_string.ok b/src/third_party/wiredtiger/dist/s_string.ok index db198204b10..e2603e2013d 100644 --- a/src/third_party/wiredtiger/dist/s_string.ok +++ b/src/third_party/wiredtiger/dist/s_string.ok @@ -1450,6 +1450,7 @@ variadic vectorized versa vfprintf +vh vm vpack vpmsum diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 73a1db81000..9464c079a8f 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-5.0", - "commit": "912ceefab6bf5e7287952e713ef5c8b6af648fa2" + "commit": "8e6373247bd61fd6029b9c80599bea3ebe3b1262" } diff --git a/src/third_party/wiredtiger/src/checksum/arm64/crc32-arm64.c b/src/third_party/wiredtiger/src/checksum/arm64/crc32-arm64.c index 3c191235020..3ca1dfed4ba 100644 --- a/src/third_party/wiredtiger/src/checksum/arm64/crc32-arm64.c +++ b/src/third_party/wiredtiger/src/checksum/arm64/crc32-arm64.c @@ -40,10 +40,13 @@ #define CRC32CX(crc, value) \ __asm__("crc32cx %w[c], %w[c], %x[v]" : [ c ] "+r"(*&crc) : [ v ] "r"(+value)) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-macros" #define CRC32CW(crc, value) \ __asm__("crc32cw %w[c], %w[c], %w[v]" : [ c ] "+r"(*&crc) : [ v ] "r"(+value)) #define CRC32CH(crc, value) \ __asm__("crc32ch %w[c], %w[c], %w[v]" : [ c ] "+r"(*&crc) : [ v ] "r"(+value)) +#pragma GCC diagnostic pop #define CRC32CB(crc, value) \ __asm__("crc32cb %w[c], %w[c], %w[v]" : [ c ] "+r"(*&crc) : [ v ] "r"(+value)) diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c index 908e02e8688..ca7b6bca448 100644 --- a/src/third_party/wiredtiger/src/config/config_def.c +++ b/src/third_party/wiredtiger/src/config/config_def.c @@ -48,8 +48,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_debug_mode_subconfigs[] = { {"realloc_exact", "boolean", NULL, NULL, NULL, 0}, {"rollback_error", "int", NULL, "min=0,max=10M", NULL, 0}, {"slow_checkpoint", "boolean", NULL, NULL, NULL, 0}, - {"table_logging", "boolean", NULL, NULL, NULL, 0}, - {"update_restore_evict", "boolean", NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, 0}}; + {"table_logging", "boolean", NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, 0}}; static const WT_CONFIG_CHECK confchk_wiredtiger_open_eviction_subconfigs[] = { {"threads_max", "int", NULL, "min=1,max=20", NULL, 0}, @@ -108,7 +107,7 @@ static const WT_CONFIG_CHECK confchk_WT_CONNECTION_reconfigure[] = { {"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2}, {"compatibility", "category", NULL, NULL, confchk_WT_CONNECTION_reconfigure_compatibility_subconfigs, 1}, - {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 10}, + {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 9}, {"error_prefix", "string", NULL, NULL, NULL, 0}, {"eviction", "category", NULL, NULL, confchk_wiredtiger_open_eviction_subconfigs, 2}, {"eviction_checkpoint_target", "int", NULL, "min=0,max=10TB", NULL, 0}, @@ -757,7 +756,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open[] = { {"checkpoint_sync", "boolean", NULL, NULL, NULL, 0}, {"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3}, {"config_base", "boolean", NULL, NULL, NULL, 0}, {"create", "boolean", NULL, NULL, NULL, 0}, - {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 10}, + {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 9}, {"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0}, {"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3}, {"error_prefix", "string", NULL, NULL, NULL, 0}, @@ -835,7 +834,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_all[] = { {"checkpoint_sync", "boolean", NULL, NULL, NULL, 0}, {"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3}, {"config_base", "boolean", NULL, NULL, NULL, 0}, {"create", "boolean", NULL, NULL, NULL, 0}, - {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 10}, + {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 9}, {"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0}, {"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3}, {"error_prefix", "string", NULL, NULL, NULL, 0}, @@ -912,7 +911,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_basecfg[] = { {"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2}, {"checkpoint_sync", "boolean", NULL, NULL, NULL, 0}, {"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3}, - {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 10}, + {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 9}, {"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0}, {"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3}, {"error_prefix", "string", NULL, NULL, NULL, 0}, @@ -985,7 +984,7 @@ static const WT_CONFIG_CHECK confchk_wiredtiger_open_usercfg[] = { {"checkpoint", "category", NULL, NULL, confchk_wiredtiger_open_checkpoint_subconfigs, 2}, {"checkpoint_sync", "boolean", NULL, NULL, NULL, 0}, {"compatibility", "category", NULL, NULL, confchk_wiredtiger_open_compatibility_subconfigs, 3}, - {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 10}, + {"debug_mode", "category", NULL, NULL, confchk_wiredtiger_open_debug_mode_subconfigs, 9}, {"direct_io", "list", NULL, "choices=[\"checkpoint\",\"data\",\"log\"]", NULL, 0}, {"encryption", "category", NULL, NULL, confchk_wiredtiger_open_encryption_subconfigs, 3}, {"error_prefix", "string", NULL, NULL, NULL, 0}, @@ -1070,11 +1069,11 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "debug_mode=(checkpoint_retention=0,corruption_abort=true," "cursor_copy=false,eviction=false,log_retention=0," "realloc_exact=false,rollback_error=0,slow_checkpoint=false," - "table_logging=false,update_restore_evict=false),error_prefix=," - "eviction=(threads_max=8,threads_min=1)," - "eviction_checkpoint_target=1,eviction_dirty_target=5," - "eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95" - ",eviction_updates_target=0,eviction_updates_trigger=0," + "table_logging=false),error_prefix=,eviction=(threads_max=8," + "threads_min=1),eviction_checkpoint_target=1," + "eviction_dirty_target=5,eviction_dirty_trigger=20," + "eviction_target=80,eviction_trigger=95,eviction_updates_target=0" + ",eviction_updates_trigger=0," "file_manager=(close_handle_minimum=250,close_idle_time=30," "close_scan_interval=10),history_store=(file_max=0)," "io_capacity=(total=0),log=(archive=true,os_cache_dirty_pct=0," @@ -1320,10 +1319,10 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "config_base=true,create=false,debug_mode=(checkpoint_retention=0" ",corruption_abort=true,cursor_copy=false,eviction=false," "log_retention=0,realloc_exact=false,rollback_error=0," - "slow_checkpoint=false,table_logging=false," - "update_restore_evict=false),direct_io=,encryption=(keyid=,name=," - "secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)" - ",eviction_checkpoint_target=1,eviction_dirty_target=5," + "slow_checkpoint=false,table_logging=false),direct_io=," + "encryption=(keyid=,name=,secretkey=),error_prefix=," + "eviction=(threads_max=8,threads_min=1)," + "eviction_checkpoint_target=1,eviction_dirty_target=5," "eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95" ",eviction_updates_target=0,eviction_updates_trigger=0," "exclusive=false,extensions=,file_close_sync=true,file_extend=," @@ -1355,10 +1354,10 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "config_base=true,create=false,debug_mode=(checkpoint_retention=0" ",corruption_abort=true,cursor_copy=false,eviction=false," "log_retention=0,realloc_exact=false,rollback_error=0," - "slow_checkpoint=false,table_logging=false," - "update_restore_evict=false),direct_io=,encryption=(keyid=,name=," - "secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)" - ",eviction_checkpoint_target=1,eviction_dirty_target=5," + "slow_checkpoint=false,table_logging=false),direct_io=," + "encryption=(keyid=,name=,secretkey=),error_prefix=," + "eviction=(threads_max=8,threads_min=1)," + "eviction_checkpoint_target=1,eviction_dirty_target=5," "eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95" ",eviction_updates_target=0,eviction_updates_trigger=0," "exclusive=false,extensions=,file_close_sync=true,file_extend=," @@ -1391,10 +1390,9 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "debug_mode=(checkpoint_retention=0,corruption_abort=true," "cursor_copy=false,eviction=false,log_retention=0," "realloc_exact=false,rollback_error=0,slow_checkpoint=false," - "table_logging=false,update_restore_evict=false),direct_io=," - "encryption=(keyid=,name=,secretkey=),error_prefix=," - "eviction=(threads_max=8,threads_min=1)," - "eviction_checkpoint_target=1,eviction_dirty_target=5," + "table_logging=false),direct_io=,encryption=(keyid=,name=," + "secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)" + ",eviction_checkpoint_target=1,eviction_dirty_target=5," "eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95" ",eviction_updates_target=0,eviction_updates_trigger=0," "extensions=,file_close_sync=true,file_extend=," @@ -1426,10 +1424,9 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "debug_mode=(checkpoint_retention=0,corruption_abort=true," "cursor_copy=false,eviction=false,log_retention=0," "realloc_exact=false,rollback_error=0,slow_checkpoint=false," - "table_logging=false,update_restore_evict=false),direct_io=," - "encryption=(keyid=,name=,secretkey=),error_prefix=," - "eviction=(threads_max=8,threads_min=1)," - "eviction_checkpoint_target=1,eviction_dirty_target=5," + "table_logging=false),direct_io=,encryption=(keyid=,name=," + "secretkey=),error_prefix=,eviction=(threads_max=8,threads_min=1)" + ",eviction_checkpoint_target=1,eviction_dirty_target=5," "eviction_dirty_trigger=20,eviction_target=80,eviction_trigger=95" ",eviction_updates_target=0,eviction_updates_trigger=0," "extensions=,file_close_sync=true,file_extend=," diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c index 71e335cd25b..3d7b5fed416 100644 --- a/src/third_party/wiredtiger/src/conn/conn_api.c +++ b/src/third_party/wiredtiger/src/conn/conn_api.c @@ -1961,11 +1961,6 @@ __wt_debug_mode_config(WT_SESSION_IMPL *session, const char *cfg[]) else FLD_CLR(conn->log_flags, WT_CONN_LOG_DEBUG_MODE); - WT_RET(__wt_config_gets(session, cfg, "debug_mode.update_restore_evict", &cval)); - if (cval.val) - FLD_SET(conn->debug_flags, WT_CONN_DEBUG_UPDATE_RESTORE_EVICT); - else - FLD_CLR(conn->debug_flags, WT_CONN_DEBUG_UPDATE_RESTORE_EVICT); return (0); } diff --git a/src/third_party/wiredtiger/src/conn/conn_cache.c b/src/third_party/wiredtiger/src/conn/conn_cache.c index 53c4d4b1cc1..81fca88fe09 100644 --- a/src/third_party/wiredtiger/src/conn/conn_cache.c +++ b/src/third_party/wiredtiger/src/conn/conn_cache.c @@ -163,7 +163,7 @@ __cache_config_local(WT_SESSION_IMPL *session, bool shared, const char *cfg[]) * Configure or reconfigure the current cache and shared cache. */ int -__wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]) +__wt_cache_config(WT_SESSION_IMPL *session, const char *cfg[], bool reconfig) { WT_CONFIG_ITEM cval; WT_CONNECTION_IMPL *conn; @@ -178,10 +178,10 @@ __wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]) was_shared = F_ISSET(conn, WT_CONN_CACHE_POOL); /* Cleanup if reconfiguring */ - if (reconfigure && was_shared && !now_shared) + if (reconfig && was_shared && !now_shared) /* Remove ourselves from the pool if necessary */ WT_RET(__wt_conn_cache_pool_destroy(session)); - else if (reconfigure && !was_shared && now_shared) + else if (reconfig && !was_shared && now_shared) /* * Cache size will now be managed by the cache pool - the start size always needs to be zero * to allow the pool to manage how much memory is in-use. @@ -203,7 +203,7 @@ __wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]) * Resize the thread group if reconfiguring, otherwise the thread group will be initialized as * part of creating the cache. */ - if (reconfigure) + if (reconfig) WT_RET(__wt_thread_group_resize(session, &conn->evict_threads, conn->evict_threads_min, conn->evict_threads_max, WT_THREAD_CAN_WAIT | WT_THREAD_PANIC_FAIL)); @@ -231,7 +231,7 @@ __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]) cache = conn->cache; /* Use a common routine for run-time configuration options. */ - WT_RET(__wt_cache_config(session, false, cfg)); + WT_RET(__wt_cache_config(session, cfg, false)); /* * The lowest possible page read-generation has a special meaning, it marks a page for forcible diff --git a/src/third_party/wiredtiger/src/conn/conn_reconfig.c b/src/third_party/wiredtiger/src/conn/conn_reconfig.c index dae64bee291..8881d3783ef 100644 --- a/src/third_party/wiredtiger/src/conn/conn_reconfig.c +++ b/src/third_party/wiredtiger/src/conn/conn_reconfig.c @@ -418,7 +418,7 @@ __wt_conn_reconfig(WT_SESSION_IMPL *session, const char **cfg) WT_ERR(ret); WT_ERR(__wt_conn_optrack_setup(session, cfg, true)); WT_ERR(__wt_conn_statistics_config(session, cfg)); - WT_ERR(__wt_cache_config(session, true, cfg)); + WT_ERR(__wt_cache_config(session, cfg, true)); WT_ERR(__wt_capacity_server_create(session, cfg)); WT_ERR(__wt_checkpoint_server_create(session, cfg)); WT_ERR(__wt_debug_mode_config(session, cfg)); diff --git a/src/third_party/wiredtiger/src/docs/build-autoconf.dox b/src/third_party/wiredtiger/src/docs/build-autoconf.dox new file mode 100644 index 00000000000..30310e2fcfe --- /dev/null +++ b/src/third_party/wiredtiger/src/docs/build-autoconf.dox @@ -0,0 +1,205 @@ +/*! @page build-autoconf Building and installing WiredTiger with autoconf/libtool + +@section autoconf_github Building using Git and GitHub + +Skip this step if you are building from a WiredTiger release package, +and proceed with @ref autoconf_building. + +To build from the WiredTiger GitHub repository requires +<a href="http://git-scm.com/">git</a>, +<a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a>, +<a href="http://www.gnu.org/software/autoconf/automake.html">automake</a>, +<a href="http://www.gnu.org/software/libtool/libtool.html">libtool</a> and +related tools. The standard options for those tools can be specified +when configuring and building WiredTiger. + +First, clone the repository: + +@code +git clone git://github.com/wiredtiger/wiredtiger.git +@endcode + +Second, run \c autogen.sh to create the \c configure script: + +@code +cd wiredtiger +sh autogen.sh +@endcode + +Now proceed with @ref autoconf_building. + +@section autoconf_building Building WiredTiger + +To build the WiredTiger software on a POSIX system, change directory to +the top-level directory, then configure and build the software: + +@code +cd wiredtiger +./configure && make +@endcode + +To rebuild from scratch, discard any previous configuration by cleaning +out the build area: + +@code +make distclean +@endcode + +To see additional configuration options, run: + +@code +./configure --help +@endcode + +WiredTiger uses +<a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a> +<a href="http://www.gnu.org/software/autoconf/automake.html">automake</a>, +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 autoconf_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 four versions +of the library in <code>/usr/local/lib</code>. For example: + +@code +file /usr/local/lib/libwiredtiger* +/usr/local/lib/libwiredtiger-1.0.0.so: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, not stripped +/usr/local/lib/libwiredtiger.a: current ar archive +/usr/local/lib/libwiredtiger.la: libtool library file +/usr/local/lib/libwiredtiger.so: symbolic link to `libwiredtiger-1.0.0.so' +@endcode + +WiredTiger uses +<a href="http://www.gnu.org/software/libtool/libtool.html">libtool</a> to +build the libraries. By default, both shared and static libraries are built. +To build only static libraries, configure WiredTiger using the +\c --disable-shared argument. To build only shared libraries, configure using +WiredTiger using the \c --disable-static argument. + +In addition, WiredTiger installs a standalone utility program named +<code>wt</code>. By default, this utility is installed in +<code>/usr/local/bin/wt</code>. + +To install WiredTiger: + +@code +make install +@endcode + +To uninstall WiredTiger: + +@code +make uninstall +@endcode + +To install WiredTiger's libraries or binaries into alternate locations, +use the configuration or installation options described in the +<a href="http://www.gnu.org/prep/standards/">GNU coding standards</a> +documentation. For example, to install the libraries and binaries into +a different location: + +@code +./configure --prefix=/c/wiredtiger +@endcode + +@section autoconf_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-lz4 +Configure WiredTiger for <a href="https://github.com/Cyan4973/lz4">LZ4</a> +compression; see @ref compression for more information. + +@par \c --enable-python +Build the WiredTiger <a href="http://www.python.org">Python</a> API; +requires <a href="http://swig.org">SWIG</a>. + +@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-zlib +Configure WiredTiger for <a href="http://www.zlib.net/">zlib</a> +compression; see @ref compression for more information. + +@par \c --enable-zstd +Configure WiredTiger for <a href="https://github.com/facebook/zstd">Zstd</a> +compression; see @ref compression for more information. + +@par \c --disable-standalone-build +Configure WiredTiger to disable standalone build. Standalone build is enabled +by default. + +@par <code>--with-builtins</code> +Configure WiredTiger to include support for extensions in the main library. +This avoids requiring additional libraries for supported extensions. Currently +supported options are \c lz4, \c snappy, \c zlib and \c zstd. + +@par <code>--with-python-prefix</code> +Configure WiredTiger to install Python libraries to a non-standard Python +install location. + +@par <code>--with-spinlock[=pthread, pthread_adaptive, gcc]</code> +Configure WiredTiger to use a specific mutex type for serialization; +options are \c pthread (the default, which configures WiredTiger to use +POSIX 1003.1c pthread mutexes), \c pthread_adaptive (which configures +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 autoconf_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 +<code>LIBS</code> environment variables: + +@par \c CC +The compiler. +@par \c CFLAGS +Compiler flags. +@par \c LDFLAGS +Loader flags. +@par \c LIBS +Additional libraries. + +For example, to specify a different compiler: + +@code +env CC=mygcc ./configure +@endcode + +By default, WiredTiger builds with the \c -O3 compiler optimization flag +unless the \c --enable-debug configuration option is specified, in which +case the \c -g compiler flag is used instead. For example, to specify +a different level of optimization: + +@code +env CFLAGS=-Os ./configure +@endcode + +To specify a different set of include files: + +@code +env CFLAGS=-I/usr/local/include ./configure +@endcode + +To specify an additional library: + +@code +env LIBS="-lrtf -lmin" LDFLAGS=-L/usr/local/lib ./configure +@endcode + */ diff --git a/src/third_party/wiredtiger/src/docs/build-posix.dox b/src/third_party/wiredtiger/src/docs/build-posix.dox index e0eb1577b29..7fd9cfbec14 100644 --- a/src/third_party/wiredtiger/src/docs/build-posix.dox +++ b/src/third_party/wiredtiger/src/docs/build-posix.dox @@ -1,5 +1,7 @@ /*! @page build-posix Building and installing WiredTiger on POSIX +To read instructions on using the legacy autoconf build system, see @subpage build-autoconf. + @section posix_github Building using Git and GitHub Skip this step if you are building from a WiredTiger release package, @@ -7,11 +9,10 @@ and proceed with @ref posix_building. To build from the WiredTiger GitHub repository requires <a href="http://git-scm.com/">git</a>, -<a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a>, -<a href="http://www.gnu.org/software/autoconf/automake.html">automake</a>, -<a href="http://www.gnu.org/software/libtool/libtool.html">libtool</a> and -related tools. The standard options for those tools can be specified -when configuring and building WiredTiger. +<a href="https://cmake.org/">CMake</a>, +<a href="https://ninja-build.org/">Ninja</a>. +We also suggest <a href="https://ccache.dev/">ccache</a> for improved build times +and <a href="http://www.swig.org/">SWIG</a> for building with Python support. First, clone the repository: @@ -19,68 +20,48 @@ First, clone the repository: git clone git://github.com/wiredtiger/wiredtiger.git @endcode -Second, run \c autogen.sh to create the \c configure script: - -@code -cd wiredtiger -sh autogen.sh -@endcode - Now proceed with @ref posix_building. @section posix_building Building WiredTiger To build the WiredTiger software on a POSIX system, change directory to -the top-level directory, then configure and build the software: +the top-level directory, then configure and create a new directory to run +your build from: @code cd wiredtiger -./configure && make +mkdir build +cd build @endcode -To rebuild from scratch, discard any previous configuration by cleaning -out the build area: - +Change into your newly created build directory and using CMake run the build configuration +step to generate your ninja build. @code -make distclean +cmake -G Ninja ../. @endcode -To see additional configuration options, run: - +Lastly, in the same directory you configured your build, run the ninja command to start the build: @code -./configure --help +ninja @endcode -WiredTiger uses -<a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a> -<a href="http://www.gnu.org/software/autoconf/automake.html">automake</a>, -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 posix_installing Installing WiredTiger -The WiredTiger software consists of a library and a single standalone -utility. +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 four versions -of the library in <code>/usr/local/lib</code>. For example: +WiredTiger's distribution by default builds and installs the shared version library in <code>/usr/local/lib</code>. For example: @code file /usr/local/lib/libwiredtiger* -/usr/local/lib/libwiredtiger-1.0.0.so: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, not stripped -/usr/local/lib/libwiredtiger.a: current ar archive -/usr/local/lib/libwiredtiger.la: libtool library file -/usr/local/lib/libwiredtiger.so: symbolic link to `libwiredtiger-1.0.0.so' +/usr/local/lib/libwiredtiger.so.10.0.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped +/usr/local/lib/libwiredtiger.so: symbolic link to `libwiredtiger.so.10.0.1' @endcode WiredTiger uses -<a href="http://www.gnu.org/software/libtool/libtool.html">libtool</a> to -build the libraries. By default, both shared and static libraries are built. -To build only static libraries, configure WiredTiger using the -\c --disable-shared argument. To build only shared libraries, configure using -WiredTiger using the \c --disable-static argument. +<a href="https://cmake.org/">CMake</a> to build and install the libraries. +By default, the shared libraries are built. To build only static +libraries, configure WiredTiger using the +\c -DENABLE_STATIC=1 argument. In addition, WiredTiger installs a standalone utility program named <code>wt</code>. By default, this utility is installed in @@ -89,71 +70,67 @@ In addition, WiredTiger installs a standalone utility program named To install WiredTiger: @code -make install +ninja install @endcode To uninstall WiredTiger: @code -make uninstall +xargs rm < install_manifest.txt @endcode +The \c install_manifest.txt file is created when you run <code>ninja install</code>. + To install WiredTiger's libraries or binaries into alternate locations, -use the configuration or installation options described in the -<a href="http://www.gnu.org/prep/standards/">GNU coding standards</a> -documentation. For example, to install the libraries and binaries into -a different location: +configure WiredTiger using the \c -DCMAKE_INSTALL_PREFIX=custom_path argument. +For example, to install the libraries and binaries into a different location: @code -./configure --prefix=/c/wiredtiger +cmake -DCMAKE_INSTALL_PREFIX=/c/wiredtiger -G Ninja ../. @endcode @section posix_configure Configuring WiredTiger The WiredTiger software supports some additional configuration options: -@par \c --enable-attach +@par \c -DHAVE_ATTACH=1 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 +@par \c -DHAVE_DIAGNOSTIC=1 Configure WiredTiger to perform various run-time diagnostic tests. <b>DO NOT</b> configure this option in production environments. -@par \c --enable-lz4 +@par \c -DENABLE_LZ4=1 Configure WiredTiger for <a href="https://github.com/Cyan4973/lz4">LZ4</a> compression; see @ref compression for more information. -@par \c --enable-python +@par \c -DENABLE_PYTHON=1 Build the WiredTiger <a href="http://www.python.org">Python</a> API; requires <a href="http://swig.org">SWIG</a>. -@par \c --enable-snappy +@par \c -DENABLE_SNAPPY=1 Configure WiredTiger for <a href="http://code.google.com/p/snappy/">snappy</a> compression; see @ref compression for more information. -@par \c --enable-zlib +@par \c -DENABLE_ZLIB=1 Configure WiredTiger for <a href="http://www.zlib.net/">zlib</a> compression; see @ref compression for more information. -@par \c --enable-zstd +@par \c -DENABLE_ZSTD=1 Configure WiredTiger for <a href="https://github.com/facebook/zstd">Zstd</a> compression; see @ref compression for more information. -@par \c --disable-standalone-build +@par \c -DWT_STANDALONE_BUILD=0 Configure WiredTiger to disable standalone build. Standalone build is enabled by default. -@par <code>--with-builtins</code> +@par \c -DHAVE_BUILTIN_EXTENSION_LZ4=1, \c -DHAVE_BUILTIN_EXTENSION_SNAPPY=1, \c -DHAVE_BUILTIN_EXTENSION_ZLIB=1, \c -DHAVE_BUILTIN_EXTENSION_ZSTD=1 Configure WiredTiger to include support for extensions in the main library. This avoids requiring additional libraries for supported extensions. Currently -supported options are \c lz4, \c snappy, \c zlib and \c zstd. +supported builtin options are for \c lz4, \c snappy, \c zlib and \c zstd. -@par <code>--with-python-prefix</code> -Configure WiredTiger to install Python libraries to a non-standard Python -install location. - -@par <code>--with-spinlock[=pthread, pthread_adaptive, gcc]</code> +@par <code>-DSPINLOCK_TYPE[=pthread, pthread_adaptive, gcc]</code> Configure WiredTiger to use a specific mutex type for serialization; options are \c pthread (the default, which configures WiredTiger to use POSIX 1003.1c pthread mutexes), \c pthread_adaptive (which configures @@ -163,43 +140,27 @@ configures WiredTiger to use gcc-based spinlocks). @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 -<code>LIBS</code> environment variables: - -@par \c CC -The compiler. -@par \c CFLAGS -Compiler flags. -@par \c LDFLAGS -Loader flags. -@par \c LIBS -Additional libraries. - -For example, to specify a different compiler: - -@code -env CC=mygcc ./configure -@endcode +By default CMake will use your default system compiler (\c cc). If you want to use a specific toolchain you can pass a toolchain file. We have +provided a toolchain file for both GCC (\c build_cmake/toolchains/gcc.cmake) and Clang (\c build_cmake/toolchains/clang.cmake). To use either +toolchain you can pass the \c -DCMAKE_TOOLCHAIN_FILE= to the CMake configuration step. For example: -By default, WiredTiger builds with the \c -O3 compiler optimization flag -unless the \c --enable-debug configuration option is specified, in which -case the \c -g compiler flag is used instead. For example, to specify -a different level of optimization: +For example, to explicitly specify the GCC toolchain: @code -env CFLAGS=-Os ./configure +cmake -DCMAKE_TOOLCHAIN_FILE=../build_cmake/toolchains/gcc.cmake -G Ninja ../. @endcode -To specify a different set of include files: +To explicitly specify the Clang toolchain: @code -env CFLAGS=-I/usr/local/include ./configure +cmake -DCMAKE_TOOLCHAIN_FILE=../build_cmake/toolchains/clang.cmake -G Ninja ../. @endcode -To specify an additional library: +By default, WiredTiger builds with the \c -O3 compiler optimization flag +unless manually specified through the \c -DCC_OPTIMIZE_LEVEL configuration option. For example, to specify +a different level of optimization: @code -env LIBS="-lrtf -lmin" LDFLAGS=-L/usr/local/lib ./configure +cmake -DCC_OPTIMIZE_LEVEL=-01 -G Ninja ../. @endcode - */ +*/ diff --git a/src/third_party/wiredtiger/src/docs/spell.ok b/src/third_party/wiredtiger/src/docs/spell.ok index cb5f89ab81d..381b0547ac9 100644 --- a/src/third_party/wiredtiger/src/docs/spell.ok +++ b/src/third_party/wiredtiger/src/docs/spell.ok @@ -5,9 +5,13 @@ ActiveState Adler's ASAN Atomicity +autoconf BLOBs BLRrVv +ccache CFLAGS +cmake +CMake COV CPPFLAGS CPUs @@ -31,7 +35,13 @@ Datastore DbCursor DbEnv DbMultiple +DCC +DCMAKE +DENABLE +DHAVE +DSPINLOCK Durations +DWT EAGAIN EB EBUSY @@ -566,6 +576,7 @@ superset svg sys syscalls +SYSV sz tRuE tablename @@ -581,6 +592,7 @@ timestamp timestamps todo toolchain +toolchains touchpad tpc tpcb @@ -631,6 +643,7 @@ wtstats xa xaa xad +xargs xbe xde xdeadbeef diff --git a/src/third_party/wiredtiger/src/evict/evict_lru.c b/src/third_party/wiredtiger/src/evict/evict_lru.c index 8c593076711..8aa018bb063 100644 --- a/src/third_party/wiredtiger/src/evict/evict_lru.c +++ b/src/third_party/wiredtiger/src/evict/evict_lru.c @@ -633,9 +633,7 @@ __evict_update_work(WT_SESSION_IMPL *session) if (bytes_dirty < (uint64_t)((dirty_target + dirty_trigger) * bytes_max) / 200 && bytes_updates < (uint64_t)((updates_target + updates_trigger) * bytes_max) / 200) LF_SET(WT_CACHE_EVICT_SCRUB); - } else if (FLD_ISSET(conn->debug_flags, WT_CONN_DEBUG_UPDATE_RESTORE_EVICT)) - LF_SET(WT_CACHE_EVICT_SCRUB); - else + } else LF_SET(WT_CACHE_EVICT_NOKEEP); /* diff --git a/src/third_party/wiredtiger/src/include/connection.h b/src/third_party/wiredtiger/src/include/connection.h index b13ab2b911e..6a90cb5e9fc 100644 --- a/src/third_party/wiredtiger/src/include/connection.h +++ b/src/third_party/wiredtiger/src/include/connection.h @@ -543,7 +543,6 @@ struct __wt_connection_impl { #define WT_CONN_DEBUG_CURSOR_COPY 0x04u #define WT_CONN_DEBUG_REALLOC_EXACT 0x08u #define WT_CONN_DEBUG_SLOW_CKPT 0x10u -#define WT_CONN_DEBUG_UPDATE_RESTORE_EVICT 0x20u /* AUTOMATIC FLAG VALUE GENERATION STOP */ uint64_t debug_flags; diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index 8068e402dfd..a2779a3fc63 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -327,7 +327,7 @@ extern int __wt_bulk_insert_var(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk, WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_bulk_wrapup(WT_SESSION_IMPL *session, WT_CURSOR_BULK *cbulk) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cache_config(WT_SESSION_IMPL *session, bool reconfigure, const char *cfg[]) +extern int __wt_cache_config(WT_SESSION_IMPL *session, const char *cfg[], bool reconfig) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cache_create(WT_SESSION_IMPL *session, const char *cfg[]) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index c0e37648b07..13cf882a45f 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -2074,10 +2074,7 @@ struct __wt_connection { * operations\, even operations for tables with logging turned off. This setting introduces * a log format change that may break older versions of WiredTiger. These operations are * informational and skipped in recovery., a boolean flag; default \c false.} - * @config{ update_restore_evict, if true\, control the page eviction - * through forcing update restore eviction., a boolean flag; default \c false.} - * @config{ - * ),,} + * @config{ ),,} * @config{error_prefix, prefix string for error messages., a string; default empty.} * @config{eviction = (, eviction configuration options., a set of related configuration * options defined below.} @@ -2741,8 +2738,6 @@ struct __wt_connection { * tables with logging turned off. This setting introduces a log format change that may break older * versions of WiredTiger. These operations are informational and skipped in recovery., a boolean * flag; default \c false.} - * @config{ update_restore_evict, if true\, control - * the page eviction through forcing update restore eviction., a boolean flag; default \c false.} * @config{ ),,} * @config{direct_io, Use \c O_DIRECT on POSIX systems\, and \c FILE_FLAG_NO_BUFFERING on Windows to * access files. Options are given as a list\, such as <code>"direct_io=[data]"</code>. Configuring diff --git a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c index ef5c3246e30..d1e4d909b50 100644 --- a/src/third_party/wiredtiger/src/reconcile/rec_visibility.c +++ b/src/third_party/wiredtiger/src/reconcile/rec_visibility.c @@ -255,7 +255,7 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, v upd_memsize = 0; max_ts = WT_TS_NONE; max_txn = WT_TXN_NONE; - has_newer_updates = supd_restore = upd_saved = false; + has_newer_updates = upd_saved = false; is_hs_page = F_ISSET(session->dhandle, WT_DHANDLE_HS); session_txnid = WT_SESSION_TXN_SHARED(session)->id; @@ -615,6 +615,8 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, v supd_restore = F_ISSET(r, WT_REC_EVICT) && (has_newer_updates || F_ISSET(S2C(session), WT_CONN_IN_MEMORY) || page->type == WT_PAGE_COL_FIX); + if (supd_restore) + r->cache_write_restore = true; WT_ERR(__rec_update_save(session, r, ins, ripcip, upd_select->upd != NULL && upd_select->upd->type == WT_UPDATE_TOMBSTONE ? NULL : upd_select->upd, @@ -632,13 +634,6 @@ __wt_rec_upd_select(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins, v } /* - * Set statistics for update restore evictions. Update restore eviction debug mode forces update - * restores to both committed or uncommitted changes. - */ - if (supd_restore || F_ISSET(r, WT_REC_SCRUB)) - r->cache_write_restore = true; - - /* * Paranoia: check that we didn't choose an update that has since been rolled back. */ WT_ASSERT(session, upd_select->upd == NULL || upd_select->upd->txnid != WT_TXN_ABORTED); diff --git a/src/third_party/wiredtiger/test/csuite/incr_backup/smoke.sh b/src/third_party/wiredtiger/test/csuite/incr_backup/smoke.sh index 65727df015e..7816a4ec70b 100755 --- a/src/third_party/wiredtiger/test/csuite/incr_backup/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/incr_backup/smoke.sh @@ -4,9 +4,15 @@ set -e # Smoke-test incr-backup as part of running "make check". -# If $top_builddir/$top_srcdir aren't set, default to building in build_posix -# and running in test/csuite. -top_builddir=${top_builddir:-../../build_posix} -top_srcdir=${top_srcdir:-../..} +if [ -n "$1" ] +then + # If the test binary is passed in manually. + $TEST_WRAPPER $1 -v 3 +else + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} -$TEST_WRAPPER $top_builddir/test/csuite/test_incr_backup -v 3 + $TEST_WRAPPER $top_builddir/test/csuite/test_incr_backup -v 3 +fi diff --git a/src/third_party/wiredtiger/test/csuite/random_abort/smoke.sh b/src/third_party/wiredtiger/test/csuite/random_abort/smoke.sh index 713b000b4f1..bfa8656f6b1 100755 --- a/src/third_party/wiredtiger/test/csuite/random_abort/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/random_abort/smoke.sh @@ -4,12 +4,18 @@ set -e # Smoke-test random-abort as part of running "make check". -# If $top_builddir/$top_srcdir aren't set, default to building in build_posix -# and running in test/csuite. -top_builddir=${top_builddir:-../../build_posix} -top_srcdir=${top_srcdir:-../..} - -$TEST_WRAPPER $top_builddir/test/csuite/test_random_abort -t 10 -T 5 -$TEST_WRAPPER $top_builddir/test/csuite/test_random_abort -m -t 10 -T 5 -$TEST_WRAPPER $top_builddir/test/csuite/test_random_abort -C -t 10 -T 5 -$TEST_WRAPPER $top_builddir/test/csuite/test_random_abort -C -m -t 10 -T 5 +if [ -n "$1" ] +then + # If the test binary is passed in manually. + test_bin=$1 +else + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} + test_bin=$top_builddir/test/csuite/test_random_abort +fi +$TEST_WRAPPER $test_bin -t 10 -T 5 +$TEST_WRAPPER $test_bin -m -t 10 -T 5 +$TEST_WRAPPER $test_bin -C -t 10 -T 5 +$TEST_WRAPPER $test_bin -C -m -t 10 -T 5 diff --git a/src/third_party/wiredtiger/test/csuite/random_directio/smoke.sh b/src/third_party/wiredtiger/test/csuite/random_directio/smoke.sh index 7d5b96d9b57..9c7c043beb0 100755 --- a/src/third_party/wiredtiger/test/csuite/random_directio/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/random_directio/smoke.sh @@ -9,8 +9,12 @@ set -e top_builddir=${top_builddir:-../../build_posix} top_srcdir=${top_srcdir:-../..} -RUN_TEST_CMD="$TEST_WRAPPER $top_builddir/test/csuite/test_random_directio" - +if [ -n "$1" ] +then + RUN_TEST_CMD="$TEST_WRAPPER $1" +else + RUN_TEST_CMD="$TEST_WRAPPER $top_builddir/test/csuite/test_random_directio" +fi # Replace for more complete testing #TEST_THREADS="1 5 10" TEST_THREADS="5" diff --git a/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh b/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh index 78effe1acab..5e82ae180bc 100755 --- a/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/schema_abort/smoke.sh @@ -4,15 +4,23 @@ set -e # Smoke-test schema-abort as part of running "make check". -# If $top_builddir/$top_srcdir aren't set, default to building in build_posix -# and running in test/csuite. -top_builddir=${top_builddir:-../../build_posix} -top_srcdir=${top_srcdir:-../..} -$TEST_WRAPPER $top_builddir/test/csuite/test_schema_abort -t 10 -T 5 -$TEST_WRAPPER $top_builddir/test/csuite/test_schema_abort -m -t 10 -T 5 -$TEST_WRAPPER $top_builddir/test/csuite/test_schema_abort -C -t 10 -T 5 -$TEST_WRAPPER $top_builddir/test/csuite/test_schema_abort -C -m -t 10 -T 5 +if [ -n "$1" ] +then + # If the test binary is passed in manually. + test_bin=$1 +else + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} + test_bin=$top_builddir/test/csuite/test_schema_abort +fi + +$TEST_WRAPPER $test_bin -t 10 -T 5 +$TEST_WRAPPER $test_bin -m -t 10 -T 5 +$TEST_WRAPPER $test_bin -C -t 10 -T 5 +$TEST_WRAPPER $test_bin -C -m -t 10 -T 5 # FIXME: In WT-6116 the test is failing if timestamps are turned off. -#$TEST_WRAPPER $top_builddir/test/csuite/test_schema_abort -m -t 10 -T 5 -z -$TEST_WRAPPER $top_builddir/test/csuite/test_schema_abort -m -t 10 -T 5 -x +#$TEST_WRAPPER $test_bin -m -t 10 -T 5 -z +$TEST_WRAPPER $test_bin -m -t 10 -T 5 -x diff --git a/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh b/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh index 0cac6a56ea4..18d7f9b8dae 100755 --- a/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh +++ b/src/third_party/wiredtiger/test/csuite/timestamp_abort/smoke.sh @@ -6,21 +6,25 @@ set -e # to add a stress timing in checkpoint prepare. default_test_args="-t 10 -T 5" -while getopts ":s" opt; do +while getopts ":sb:" opt; do case $opt in s) default_test_args="$default_test_args -s" ;; + b) test_bin=$OPTARG ;; esac done +if [ -z "$test_bin" ] +then + # If $top_builddir/$top_srcdir aren't set, default to building in build_posix + # and running in test/csuite. + top_builddir=${top_builddir:-../../build_posix} + top_srcdir=${top_srcdir:-../..} + test_bin=$top_builddir/test/csuite/test_timestamp_abort +fi -# If $top_builddir/$top_srcdir aren't set, default to building in build_posix -# and running in test/csuite. -top_builddir=${top_builddir:-../../build_posix} -top_srcdir=${top_srcdir:-../..} - -$TEST_WRAPPER $top_builddir/test/csuite/test_timestamp_abort $default_test_args -#$TEST_WRAPPER $top_builddir/test/csuite/test_timestamp_abort $default_test_args -L -$TEST_WRAPPER $top_builddir/test/csuite/test_timestamp_abort -m $default_test_args -#$TEST_WRAPPER $top_builddir/test/csuite/test_timestamp_abort -m $default_test_args -L -$TEST_WRAPPER $top_builddir/test/csuite/test_timestamp_abort -C $default_test_args -$TEST_WRAPPER $top_builddir/test/csuite/test_timestamp_abort -C -m $default_test_args +$TEST_WRAPPER $test_bin $default_test_args +#$TEST_WRAPPER $test_bin $default_test_args -L +$TEST_WRAPPER $test_bin -m $default_test_args +#$TEST_WRAPPER $test_bin -m $default_test_args -L +$TEST_WRAPPER $test_bin -C $default_test_args +$TEST_WRAPPER $test_bin -C -m $default_test_args diff --git a/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c b/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c index c830023c801..e6111dc937b 100644 --- a/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt2909_checkpoint_integrity/main.c @@ -301,6 +301,10 @@ run_check_subtest( subtest_args[narg++] = (char *)"subtest"; subtest_args[narg++] = (char *)"-h"; subtest_args[narg++] = opts->home; + if (opts->build_dir != NULL) { + subtest_args[narg++] = (char *)"-b"; + subtest_args[narg++] = opts->build_dir; + } subtest_args[narg++] = (char *)"-v"; /* subtest is always verbose */ subtest_args[narg++] = (char *)"-p"; subtest_args[narg++] = (char *)"-o"; @@ -498,9 +502,10 @@ subtest_main(int argc, char *argv[], bool close_test) testutil_check(__wt_snprintf(filename, sizeof(filename), "%s/%s", opts->home, STDOUT_FILE)); testutil_assert(freopen(filename, "a", stdout) != NULL); +#ifndef WT_FAIL_FS_LIB #define WT_FAIL_FS_LIB "ext/test/fail_fs/.libs/libwiredtiger_fail_fs.so" - - testutil_build_dir(buf, 1024); +#endif + testutil_build_dir(opts, buf, 1024); testutil_check(__wt_snprintf(config, sizeof(config), "create,cache_size=250M,log=(enabled),transaction_sync=(enabled,method=none),extensions=(%s/" "%s=(early_load,config={environment=true,verbose=true}))", diff --git a/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c b/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c index ac7dfc4e6b9..140d24d55d1 100644 --- a/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt3120_filesys/main.c @@ -46,8 +46,10 @@ main(int argc, char *argv[]) testutil_check(testutil_parse_opts(argc, argv, opts)); testutil_make_work_dir(opts->home); +#ifndef WT_FAIL_FS_LIB #define WT_FAIL_FS_LIB "ext/test/fail_fs/.libs/libwiredtiger_fail_fs.so" - testutil_build_dir(buf, 1024); +#endif + testutil_build_dir(opts, buf, 1024); testutil_check(__wt_snprintf( config, sizeof(config), "create,extensions=(%s/%s=(early_load=true))", buf, WT_FAIL_FS_LIB)); testutil_check(wiredtiger_open(opts->home, NULL, config, &opts->conn)); diff --git a/src/third_party/wiredtiger/test/csuite/wt4333_handle_locks/main.c b/src/third_party/wiredtiger/test/csuite/wt4333_handle_locks/main.c index ed4b8d63869..4eec8ad369e 100644 --- a/src/third_party/wiredtiger/test/csuite/wt4333_handle_locks/main.c +++ b/src/third_party/wiredtiger/test/csuite/wt4333_handle_locks/main.c @@ -31,6 +31,7 @@ #define MAXKEY 10000 #define PERIOD 60 +#define HOME_LEN 256 static WT_CONNECTION *conn; static uint64_t worker, worker_busy, verify, verify_busy; @@ -38,6 +39,8 @@ static u_int workers, uris; static bool done = false; static bool verbose = false; static char *uri_list[750]; +static char home[HOME_LEN]; +extern char *__wt_optarg; static void uri_init(void) @@ -248,11 +251,10 @@ runone(bool config_cache) { pthread_t idlist[1000]; u_int i, j; - char buf[256], home[256]; + char buf[256]; done = false; - testutil_work_dir_from_path(home, sizeof(home), "WT_TEST.wt4333_handle_locks"); testutil_make_work_dir(home); testutil_check(__wt_snprintf(buf, sizeof(buf), @@ -320,23 +322,32 @@ run(int argc, char *argv[]) WT_RAND_STATE rnd; u_int i, n; int ch; + bool default_home; (void)testutil_set_progname(argv); __wt_random_init_seed(NULL, &rnd); - while ((ch = __wt_getopt(argv[0], argc, argv, "v")) != EOF) { + default_home = true; + while ((ch = __wt_getopt(argv[0], argc, argv, "vh:")) != EOF) { switch (ch) { case 'v': verbose = true; break; + case 'h': + strncpy(home, __wt_optarg, HOME_LEN); + home[HOME_LEN - 1] = '\0'; + default_home = false; + break; default: fprintf(stderr, "usage: %s [-v]\n", argv[0]); return (EXIT_FAILURE); } } - (void)signal(SIGALRM, on_alarm); + if (default_home) + testutil_work_dir_from_path(home, sizeof(home), "WT_TEST.wt4333_handle_locks"); + /* Each test in the table runs for a minute, run 5 tests at random. */ for (i = 0; i < 5; ++i) { n = __wt_random(&rnd) % WT_ELEMENTS(runs); diff --git a/src/third_party/wiredtiger/test/ctest_helpers.cmake b/src/third_party/wiredtiger/test/ctest_helpers.cmake new file mode 100644 index 00000000000..08584b719ca --- /dev/null +++ b/src/third_party/wiredtiger/test/ctest_helpers.cmake @@ -0,0 +1,135 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +# create_test_executable(target SOURCES <source files> [EXECUTABLE_NAME <name>] [BINARY_DIR <dir>] [INCLUDES <includes>] +# [ADDITIONAL_FILES <files>] [ADDITIONAL_DIRECTORIES <dirs>] [LIBS <libs>] [FLAGS <flags>]) +# Defines a C test executable binary. This helper does the necessary initialisation to ensure the correct flags and libraries +# are used when compiling the test executable. +# target - Target name of the test. +# SOURCES <source files> - Sources to compile for the given test. +# EXECUTABLE_NAME <name> - A name for the output test binary. Defaults to the target name if not given. +# BINARY_DIR <dir> - The output directory to install the binaries. Defaults to 'CMAKE_CURRENT_BINARY_DIR' if not given. +# INCLUDES <includes> - Additional includes for building the test binary. +# ADDITIONAL_FILES <files> - Additional files, scripts, etc we want to copy over to the output test binary. Useful if we need +# to setup an additional wrappers needed to run the test. +# ADDITIONAL_DIRECTORIES <dirs> - Additional directories we want to copy over to the output test binary. Useful if we need +# to setup an additional configs and environments needed to run the test. +# LIBS <libs> - Additional libs to link to the test binary. +# FLAGS <flags> - Additional flags to compile the test binary with. +function(create_test_executable target) + cmake_parse_arguments( + PARSE_ARGV + 1 + "CREATE_TEST" + "CXX" + "EXECUTABLE_NAME;BINARY_DIR" + "SOURCES;INCLUDES;ADDITIONAL_FILES;ADDITIONAL_DIRECTORIES;LIBS;FLAGS" + ) + if (NOT "${CREATE_TEST_UNPARSED_ARGUMENTS}" STREQUAL "") + message(FATAL_ERROR "Unknown arguments to create_test_executable: ${CREATE_TEST_UNPARSED_ARGUMENTS}") + endif() + if ("${CREATE_TEST_SOURCES}" STREQUAL "") + message(FATAL_ERROR "No sources given to create_test_executable") + endif() + + set(test_binary_dir "${CMAKE_CURRENT_BINARY_DIR}") + # Allow the user to specify a custom binary directory. + if(NOT "${CREATE_TEST_BINARY_DIR}" STREQUAL "") + set(test_binary_dir "${CREATE_TEST_BINARY_DIR}") + endif() + + # Define our test executable. + add_executable(${target} ${CREATE_TEST_SOURCES}) + # If we want the output binary to be a different name than the target. + if (NOT "${CREATE_TEST_EXECUTABLE_NAME}" STREQUAL "") + set_target_properties(${target} + PROPERTIES + OUTPUT_NAME "${CREATE_TEST_EXECUTABLE_NAME}" + ) + endif() + set_target_properties(${target} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${test_binary_dir}" + ) + + # Append the necessary compiler flags. + if(NOT CREATE_TEST_CXX) + # Don't append the strict diagnostic flags to C++ targets (as these are chosen for C targets). + set(test_c_flags "${COMPILER_DIAGNOSTIC_FLAGS}") + endif() + if(NOT "${CREATE_TEST_FLAGS}" STREQUAL "") + list(APPEND test_c_flags ${CREATE_TEST_FLAGS}) + endif() + target_compile_options(${target} PRIVATE ${test_c_flags}) + + # Include the base set of directories for a wiredtiger C test. + target_include_directories(${target} + PRIVATE + ${CMAKE_SOURCE_DIR}/src/include + ${CMAKE_SOURCE_DIR}/test/utility + ${CMAKE_BINARY_DIR}/config + ) + if(NOT "${CREATE_TEST_INCLUDES}" STREQUAL "") + target_include_directories(${target} PRIVATE ${CREATE_TEST_INCLUDES}) + endif() + + # Link the base set of libraries for a wiredtiger C test. + target_link_libraries(${target} wiredtiger test_util) + if(NOT "${CREATE_TEST_LIBS}" STREQUAL "") + target_link_libraries(${target} ${CREATE_TEST_LIBS}) + endif() + + # Install any additional files, scripts, etc in the output test binary + # directory. Useful if we need to setup an additional wrappers needed to run the test + # executable. + foreach(file IN LISTS CREATE_TEST_ADDITIONAL_FILES) + get_filename_component(file_basename ${file} NAME) + # Copy the file to the given test/targets build directory. + add_custom_command(OUTPUT ${test_binary_dir}/${file_basename} + COMMAND ${CMAKE_COMMAND} -E copy + ${file} + ${test_binary_dir}/${file_basename} + DEPENDS ${file} + ) + add_custom_target(copy_file_${target}_${file_basename} DEPENDS ${test_binary_dir}/${file_basename}) + add_dependencies(${target} copy_file_${target}_${file_basename}) + endforeach() + # Install any additional directories in the output test binary directory. + # Useful if we need to setup an additional configs and environments needed to run the test executable. + foreach(dir IN LISTS CREATE_TEST_ADDITIONAL_DIRECTORIES) + get_filename_component(dir_basename ${dir} NAME) + # Copy the file to the given test/targets build directory. + add_custom_command(OUTPUT ${test_binary_dir}/${dir_basename} + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${dir} + ${test_binary_dir}/${dir_basename} + ) + add_custom_target(copy_dir_${target}_${dir_basename} DEPENDS ${test_binary_dir}/${dir_basename}) + add_dependencies(${target} copy_dir_${target}_${dir_basename}) + endforeach() +endfunction() diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml index 4f9e60cd57e..1dbff451061 100755 --- a/src/third_party/wiredtiger/test/evergreen.yml +++ b/src/third_party/wiredtiger/test/evergreen.yml @@ -112,7 +112,7 @@ functions: if [ "$OS" != "Windows_NT" ]; then CC=/opt/mongodbtoolchain/v3/bin/clang CXX=/opt/mongodbtoolchain/v3/bin/clang++ PATH=/opt/mongodbtoolchain/v3/bin:$PATH CFLAGS="-ggdb -fPIC -fno-omit-frame-pointer -fsanitize=address" CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer -ggdb -fPIC" \ ../configure ${configure_python_setting|} \ - --enable-diagnostic --with-builtins=lz4,snappy,zlib + --enable-diagnostic --with-builtins=lz4,snappy,zlib,zstd fi - *make_wiredtiger "compile wiredtiger with builtins": @@ -519,7 +519,7 @@ variables: configure_env_vars: CC="/opt/mongodbtoolchain/v3/bin/clang -fsanitize=address" PATH=/opt/mongodbtoolchain/v3/bin:$PATH CFLAGS="-ggdb -fPIC -fno-omit-frame-pointer" CXXFLAGS="-fsanitize=address -fno-omit-frame-pointer -ggdb -fPIC" - posix_configure_flags: --enable-strict --enable-diagnostic --with-builtins=lz4,snappy,zlib + posix_configure_flags: --enable-strict --enable-diagnostic --with-builtins=lz4,snappy,zlib,zstd - func: "format test script" vars: format_test_script_args: -R -t 360 @@ -1502,6 +1502,16 @@ tasks: - func: "compile wiredtiger" - func: "unit test" + - name: unit-test-zstd + tags: ["python"] + depends_on: + - name: compile + commands: + - func: "fetch artifacts" + - func: "unit test" + vars: + unit_test_args: -v 2 --zstd + - name: unit-test-long tags: ["python"] depends_on: @@ -2041,7 +2051,7 @@ tasks: - func: "compile wiredtiger" vars: configure_env_vars: CC=/opt/mongodbtoolchain/v3/bin/gcc CXX=/opt/mongodbtoolchain/v3/bin/g++ PATH=/opt/mongodbtoolchain/v3/bin:$PATH ADD_CFLAGS="--coverage -fPIC -ggdb" LDFLAGS=--coverage - posix_configure_flags: --enable-silent-rules --enable-diagnostic --enable-strict --enable-python --with-builtins=lz4,snappy,zlib + posix_configure_flags: --enable-silent-rules --enable-diagnostic --enable-strict --enable-python --with-builtins=lz4,snappy,zlib,zstd - func: "make check all" - func: "unit test" vars: @@ -2301,7 +2311,7 @@ tasks: - func: "get project" - func: "compile wiredtiger" vars: - posix_configure_flags: --enable-strict --disable-shared --with-builtins=snappy,zlib + posix_configure_flags: --enable-strict --disable-shared --with-builtins=snappy,zlib,zstd - command: shell.exec params: working_dir: "wiredtiger/build_posix" @@ -2545,6 +2555,7 @@ buildvariants: - name: syscall-linux - name: configure-combinations - name: checkpoint-filetypes-test + - name: unit-test-zstd - name: unit-test-long - name: unit-test-random-seed - name: spinlock-gcc-test @@ -2668,6 +2679,7 @@ buildvariants: distros: rhel80-build - name: syscall-linux - name: checkpoint-filetypes-test + - name: unit-test-zstd - name: unit-test-long - name: spinlock-gcc-test - name: spinlock-pthread-adaptive-test diff --git a/src/third_party/wiredtiger/test/format/config.c b/src/third_party/wiredtiger/test/format/config.c index f7321f77c99..e6d9b6a9ae0 100644 --- a/src/third_party/wiredtiger/test/format/config.c +++ b/src/third_party/wiredtiger/test/format/config.c @@ -611,6 +611,15 @@ config_directio(void) } /* + * Direct I/O may not work with imports for the same reason as for backups. + */ + if (g.c_import) { + if (config_is_perm("import")) + testutil_die(EINVAL, "direct I/O is incompatible with import configurations"); + config_single("import=0", false); + } + + /* * Direct I/O may not work with mmap. Theoretically, Linux ignores direct I/O configurations in * the presence of shared cache configurations (including mmap), but we've seen file corruption * and it doesn't make much sense (the library disallows the combination). diff --git a/src/third_party/wiredtiger/test/suite/run.py b/src/third_party/wiredtiger/test/suite/run.py index 8d74b84259d..d173fb7c10b 100755 --- a/src/third_party/wiredtiger/test/suite/run.py +++ b/src/third_party/wiredtiger/test/suite/run.py @@ -52,8 +52,11 @@ wt_3rdpartydir = os.path.join(wt_disttop, 'test', '3rdparty') # could pick the wrong one. We also need to account for the fact that there # may be an executable 'wt' file the build directory and a subordinate .libs # directory. +env_builddir = os.getenv('WT_BUILDDIR') curdir = os.getcwd() -if os.path.basename(curdir) == '.libs' and \ +if env_builddir and os.path.isfile(os.path.join(env_builddir, 'wt')): + wt_builddir = env_builddir +elif os.path.basename(curdir) == '.libs' and \ os.path.isfile(os.path.join(curdir, os.pardir, 'wt')): wt_builddir = os.path.join(curdir, os.pardir) elif os.path.isfile(os.path.join(curdir, 'wt')): @@ -133,6 +136,7 @@ Options:\n\ -R | --randomseed run with random seeds for generates random numbers\n\ -S | --seed run with two seeds that generates random numbers, \n\ format "seed1.seed2", seed1 or seed2 can\'t be zero\n\ + -z | --zstd run the zstd tests\n\ \n\ Tests:\n\ may be a file name in test/suite: (e.g. test_base01.py)\n\ @@ -307,7 +311,7 @@ def error(exitval, prefix, msg): if __name__ == '__main__': # Turn numbers and ranges into test module names - preserve = timestamp = debug = dryRun = gdbSub = lldbSub = longtest = ignoreStdout = False + preserve = timestamp = debug = dryRun = gdbSub = lldbSub = longtest = zstdtest = ignoreStdout = False removeAtStart = True asan = False parallel = 0 @@ -380,6 +384,9 @@ if __name__ == '__main__': if option == '-long' or option == 'l': longtest = True continue + if option == '-zstd' or option == 'z': + zstdtest = True + continue if option == '-noremove': removeAtStart = False continue @@ -537,7 +544,7 @@ if __name__ == '__main__': # All global variables should be set before any test classes are loaded. # That way, verbose printing can be done at the class definition level. wttest.WiredTigerTestCase.globalSetup(preserve, removeAtStart, timestamp, gdbSub, lldbSub, - verbose, wt_builddir, dirarg, longtest, + verbose, wt_builddir, dirarg, longtest, zstdtest, ignoreStdout, seedw, seedz, hookmgr) # Without any tests listed as arguments, do discovery diff --git a/src/third_party/wiredtiger/test/suite/test_compress02.py b/src/third_party/wiredtiger/test/suite/test_compress02.py new file mode 100644 index 00000000000..a88b8f54304 --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_compress02.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +import fnmatch, os, shutil, threading, time +from wtthread import checkpoint_thread, op_thread +from helper import copy_wiredtiger_home +import wiredtiger, wttest +from wtdataset import SimpleDataSet +from wtscenario import make_scenarios +from wiredtiger import stat + +# test_compress02.py +# This test checks that the compression level can be reconfigured after restart if +# we are using zstd as the block compressor. Tables created before reconfiguration +# will still use the previous compression level. +# + +def timestamp_str(t): + return '%x' % t +class test_compress02(wttest.WiredTigerTestCase): + + # Create a table. + uri = "table:test_compress02" + nrows = 1000 + + def conn_config(self): + config = 'builtin_extension_config={zstd={compression_level=6}},cache_size=10MB,log=(enabled=true)' + return config + + def large_updates(self, uri, value, ds, nrows): + # Update a large number of records. + session = self.session + cursor = session.open_cursor(uri) + for i in range(0, nrows): + session.begin_transaction() + cursor[ds.key(i)] = value + session.commit_transaction() + cursor.close() + + def check(self, check_value, uri, nrows): + session = self.session + session.begin_transaction() + cursor = session.open_cursor(uri) + count = 0 + for k, v in cursor: + self.assertEqual(v, check_value) + count += 1 + session.commit_transaction() + self.assertEqual(count, nrows) + + # Load the compression extension, skip the test if missing + def conn_extensions(self, extlist): + extlist.skip_if_missing = True + extlist.extension('compressors', 'zstd') + + @wttest.zstdtest('Skip zstd on pcc and zseries machines') + def test_compress02(self): + + ds = SimpleDataSet(self, self.uri, 0, key_format="S", value_format="S",config='block_compressor=zstd,log=(enabled=false)') + ds.populate() + valuea = "aaaaa" * 100 + + cursor = self.session.open_cursor(self.uri) + self.large_updates(self.uri, valuea, ds, self.nrows) + + self.check(valuea, self.uri, self.nrows) + self.session.checkpoint() + + #Simulate a crash by copying to a new directory(RESTART). + copy_wiredtiger_home(self, ".", "RESTART") + + # Close the connection and reopen it with a different zstd compression level configuration. + restart_config = 'builtin_extension_config={zstd={compression_level=9}},cache_size=10MB,log=(enabled=true)' + self.close_conn() + self.reopen_conn("RESTART", restart_config) + + # Open the new directory. + self.session = self.setUpSessionOpen(self.conn) + + # Check the table contains the last checkpointed value. + self.check(valuea, self.uri, self.nrows) + +if __name__ == '__main__': + wttest.run() diff --git a/src/third_party/wiredtiger/test/suite/test_debug_mode09.py b/src/third_party/wiredtiger/test/suite/test_debug_mode09.py deleted file mode 100755 index 996bf0a2f0e..00000000000 --- a/src/third_party/wiredtiger/test/suite/test_debug_mode09.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# -# Public Domain 2014-present MongoDB, Inc. -# Public Domain 2008-2014 WiredTiger, Inc. -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -from wiredtiger import stat -import wttest - -# test_debug_mode09.py -# Test the debug mode setting for update_restore_evict. -# Force update restore eviction, whenever we evict a page. -class test_debug_mode09(wttest.WiredTigerTestCase): - conn_config = 'cache_size=100MB,statistics=(all),debug_mode=(update_restore_evict=true)' - - def test_update_restore_evict(self): - uri = "table:test_debug_mode09" - self.session.create(uri, 'key_format=i,value_format=S') - - # Insert a bunch of content - cursor = self.session.open_cursor(uri) - for i in range(0, 100): - self.session.begin_transaction() - cursor[i] = 'a' * 500 - self.session.commit_transaction() - cursor.close() - - # Configure debug behavior on a cursor to evict the page positioned on when the reset API is used. - cursor = self.session.open_cursor(uri, None, "debug=(release_evict=true)") - for i in range(0, 100): - cursor.set_key(i) - self.assertEqual(cursor.search(), 0) - cursor.reset() - cursor.close() - - # Read the statistics of pages that have been update restored - stat_cursor = self.session.open_cursor('statistics:') - pages_update_restored = stat_cursor[stat.conn.cache_write_restore][2] - stat_cursor.close() - self.assertEqual(pages_update_restored, 1) diff --git a/src/third_party/wiredtiger/test/suite/wttest.py b/src/third_party/wiredtiger/test/suite/wttest.py index 2af91d5704c..ab4d7689d3f 100755 --- a/src/third_party/wiredtiger/test/suite/wttest.py +++ b/src/third_party/wiredtiger/test/suite/wttest.py @@ -203,7 +203,7 @@ class WiredTigerTestCase(unittest.TestCase): @staticmethod def globalSetup(preserveFiles = False, removeAtStart = True, useTimestamp = False, gdbSub = False, lldbSub = False, verbose = 1, builddir = None, dirarg = None, - longtest = False, ignoreStdout = False, seedw = 0, seedz = 0, hookmgr = None): + longtest = False, zstdtest = False, ignoreStdout = False, seedw = 0, seedz = 0, hookmgr = None): WiredTigerTestCase._preserveFiles = preserveFiles d = 'WT_TEST' if dirarg == None else dirarg if useTimestamp: @@ -219,6 +219,7 @@ class WiredTigerTestCase(unittest.TestCase): WiredTigerTestCase._gdbSubprocess = gdbSub WiredTigerTestCase._lldbSubprocess = lldbSub WiredTigerTestCase._longtest = longtest + WiredTigerTestCase._zstdtest = zstdtest WiredTigerTestCase._verbose = verbose WiredTigerTestCase._ignoreStdout = ignoreStdout WiredTigerTestCase._dupout = os.dup(sys.stdout.fileno()) @@ -772,6 +773,19 @@ class WiredTigerTestCase(unittest.TestCase): def className(self): return self.__class__.__name__ +def zstdtest(description): + """ + Used as a function decorator, for example, @wttest.zstdtest("description"). + The decorator indicates that this test function should only be included + when running the test suite with the --zstd option. + """ + def runit_decorator(func): + return func + if not WiredTigerTestCase._zstdtest: + return unittest.skip(description + ' (enable with --zstd)') + else: + return runit_decorator + def longtest(description): """ Used as a function decorator, for example, @wttest.longtest("description"). diff --git a/src/third_party/wiredtiger/test/syscall/syscall.py b/src/third_party/wiredtiger/test/syscall/syscall.py index 874ba546944..a57c6bb99c9 100755 --- a/src/third_party/wiredtiger/test/syscall/syscall.py +++ b/src/third_party/wiredtiger/test/syscall/syscall.py @@ -770,8 +770,26 @@ class SyscallCommand: def parse_args(self, argv): srcdir = os.path.join(self.disttop, 'test', 'syscall') self.exetopdir = os.path.join(self.builddir, 'test', 'syscall') - self.incdir1 = os.path.join(self.disttop, 'src', 'include') - self.incdir2 = self.builddir + self.incdirs = [] + + if self.disttop == self.builddir: + # CTest runs a copy of the script in the build directory, so the src include + # is a level above. + self.incdirs.append(os.path.join(self.disttop, '..', 'src', 'include')) + else: + self.incdirs.append(os.path.join(self.disttop, 'src', 'include')) + + if os.path.isfile(os.path.join(self.builddir, 'wiredtiger_config.h')) and \ + os.path.isfile(os.path.join(self.builddir, 'wiredtiger.h')): + # When building with autoconf, the generated includes will be at the top level + # of the build directory. + self.incdirs.append(self.builddir) + elif os.path.isfile(os.path.join(self.builddir, 'config', 'wiredtiger_config.h')) and \ + os.path.isfile(os.path.join(self.builddir, 'include', 'wiredtiger.h')): + # When building with CMake, the generated includes will be in the config and include + # sub-directories. + self.incdirs.append(os.path.join(self.builddir, 'config')) + self.incdirs.append(os.path.join(self.builddir, 'include')) ap = argparse.ArgumentParser('Syscall test runner') ap.add_argument('--systype', @@ -881,8 +899,8 @@ class SyscallCommand: with open(probe_c, "w") as f: f.write(program) ccargs = ['cc', '-o', probe_exe] - ccargs.append('-I' + self.incdir1) - ccargs.append('-I' + self.incdir2) + for inc in self.incdirs: + ccargs.append('-I' + inc) if self.args.systype == 'Linux': ccargs.append('-D_GNU_SOURCE') ccargs.append(probe_c) diff --git a/src/third_party/wiredtiger/test/utility/misc.c b/src/third_party/wiredtiger/test/utility/misc.c index 674a868c35e..16f79426533 100644 --- a/src/third_party/wiredtiger/test/utility/misc.c +++ b/src/third_party/wiredtiger/test/utility/misc.c @@ -141,11 +141,17 @@ testutil_clean_work_dir(const char *dir) * Get the git top level directory and concatenate the build directory. */ void -testutil_build_dir(char *buf, int size) +testutil_build_dir(TEST_OPTS *opts, char *buf, int size) { FILE *fp; char *p; + /* If a build directory was manually given as an option we can directly return this instead. */ + if (opts->build_dir != NULL) { + strncpy(buf, opts->build_dir, (size_t)size); + return; + } + /* Get the git top level directory. */ #ifdef _WIN32 fp = _popen("git rev-parse --show-toplevel", "r"); diff --git a/src/third_party/wiredtiger/test/utility/parse_opts.c b/src/third_party/wiredtiger/test/utility/parse_opts.c index 35b9e2a5542..8e5bf425db1 100644 --- a/src/third_party/wiredtiger/test/utility/parse_opts.c +++ b/src/third_party/wiredtiger/test/utility/parse_opts.c @@ -49,7 +49,7 @@ testutil_parse_opts(int argc, char *const *argv, TEST_OPTS *opts) testutil_print_command_line(argc, argv); - while ((ch = __wt_getopt(opts->progname, argc, argv, "A:dh:n:o:pR:T:t:vW:")) != EOF) + while ((ch = __wt_getopt(opts->progname, argc, argv, "A:dh:b:n:o:pR:T:t:vW:")) != EOF) switch (ch) { case 'A': /* Number of append threads */ opts->n_append_threads = (uint64_t)atoll(__wt_optarg); @@ -60,6 +60,9 @@ testutil_parse_opts(int argc, char *const *argv, TEST_OPTS *opts) case 'h': /* Home directory */ opts->home = dstrdup(__wt_optarg); break; + case 'b': /* Build directory */ + opts->build_dir = dstrdup(__wt_optarg); + break; case 'n': /* Number of records */ opts->nrecords = (uint64_t)atoll(__wt_optarg); break; @@ -104,6 +107,7 @@ testutil_parse_opts(int argc, char *const *argv, TEST_OPTS *opts) "[-A append thread count] " "[-d add data] " "[-h home] " + "[-b build directory] " "[-n record count] " "[-o op count] " "[-p] " diff --git a/src/third_party/wiredtiger/test/utility/test_util.h b/src/third_party/wiredtiger/test/utility/test_util.h index b657d5717a7..6689227d359 100644 --- a/src/third_party/wiredtiger/test/utility/test_util.h +++ b/src/third_party/wiredtiger/test/utility/test_util.h @@ -54,6 +54,7 @@ typedef struct { char *home; const char *argv0; /* Exec name */ const char *progname; /* Truncated program name */ + char *build_dir; /* Build directory path */ enum { TABLE_COL = 1, /* Fixed-length column store */ @@ -268,7 +269,7 @@ void testutil_clean_work_dir(const char *); void testutil_cleanup(TEST_OPTS *); void testutil_copy_data(const char *); bool testutil_is_flag_set(const char *); -void testutil_build_dir(char *, int); +void testutil_build_dir(TEST_OPTS *, char *, int); void testutil_make_work_dir(const char *); int testutil_parse_opts(int, char *const *, TEST_OPTS *); void testutil_print_command_line(int argc, char *const *argv); |