diff --git a/SConstruct b/SConstruct index 62ab953f16..9b2516a94f 100644 --- a/SConstruct +++ b/SConstruct @@ -1646,7 +1646,7 @@ elif env.TargetOSIs('windows'): #env.Append( CCFLAGS=['/Yu"pch.h"'] ) # Don't send error reports in case of internal compiler error - env.Append( CCFLAGS= ["/errorReport:none"] ) + env.Append( CCFLAGS= ["/errorReport:none"] ) # Select debugging format. /Zi gives faster links but seem to use more memory if get_option('msvc-debugging-format') == "codeview": @@ -1821,7 +1821,7 @@ if env.TargetOSIs('posix'): if optBuild and not optBuildForSize: env.Append( CCFLAGS=["-O2"] ) - elif optBuild and optBuildForSize: + elif optBuild and optBuildForSize: env.Append( CCFLAGS=["-Os"] ) else: env.Append( CCFLAGS=["-O0"] ) @@ -3166,6 +3166,9 @@ def doConfigure(myenv): if use_system_version_of_library("snappy"): conf.FindSysLibDep("snappy", ["snappy"]) + conf.FindSysLibDep("zstd", ["zstd"]) + conf.FindSysLibDep("lz4", ["lz4"]) + if use_system_version_of_library("zlib"): conf.FindSysLibDep("zlib", ["zdll" if conf.env.TargetOSIs('windows') else "z"]) @@ -3368,7 +3371,7 @@ def doConfigure(myenv): if conf.CheckExtendedAlignment(size): conf.env.SetConfigHeaderDefine("MONGO_CONFIG_MAX_EXTENDED_ALIGNMENT", size) break - + def CheckMongoCMinVersion(context): compile_test_body = textwrap.dedent(""" #include diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp index 9b1e287619..ab90524ba9 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_global_options.cpp @@ -63,8 +63,8 @@ Status WiredTigerGlobalOptions::add(moe::OptionSection* options) { .addOptionChaining("storage.wiredTiger.engineConfig.journalCompressor", "wiredTigerJournalCompressor", moe::String, - "use a compressor for log records [none|snappy|zlib]") - .format("(:?none)|(:?snappy)|(:?zlib)", "(none/snappy/zlib)") + "use a compressor for log records [none|lz4|snappy|zlib|zstd]") + .format("(:?none)|(:?lz4)|(:?snappy)|(:?zlib)|(:?zstd)", "(none/lz4/snappy/zlib/zstd)") .setDefault(moe::Value(std::string("snappy"))); wiredTigerOptions.addOptionChaining("storage.wiredTiger.engineConfig.directoryForIndexes", "wiredTigerDirectoryForIndexes", @@ -84,8 +84,8 @@ Status WiredTigerGlobalOptions::add(moe::OptionSection* options) { "wiredTigerCollectionBlockCompressor", moe::String, "block compression algorithm for collection data " - "[none|snappy|zlib]") - .format("(:?none)|(:?snappy)|(:?zlib)", "(none/snappy/zlib)") + "[none|lz4|snappy|zlib|zstd]") + .format("(:?none)|(:?lz4)|(:?snappy)|(:?zlib)|(:?zstd)", "(none/lz4/snappy/zlib/zstd)") .setDefault(moe::Value(std::string("snappy"))); wiredTigerOptions .addOptionChaining("storage.wiredTiger.collectionConfig.configString", diff --git a/src/third_party/SConscript b/src/third_party/SConscript index b5d801a9a4..e8307a06b8 100644 --- a/src/third_party/SConscript +++ b/src/third_party/SConscript @@ -200,6 +200,26 @@ snappyEnv.Library( 'shim_snappy.cpp', ]) +zstdEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_ZSTD_SYSLIBDEP'], + ]) +zstdEnv.Library( + target="shim_zstd", + source=[ + 'shim_zstd.cpp', + ]) + +lz4Env = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_LZ4_SYSLIBDEP'], + ]) +lz4Env.Library( + target="shim_lz4", + source=[ + 'shim_lz4.cpp', + ]) + if use_system_version_of_library("zlib"): zlibEnv = env.Clone( SYSLIBDEPS=[ diff --git a/src/third_party/shim_lz4.cpp b/src/third_party/shim_lz4.cpp new file mode 100644 index 0000000000..a3114c1911 --- /dev/null +++ b/src/third_party/shim_lz4.cpp @@ -0,0 +1,3 @@ +// This file intentionally blank. shim_zlib.cpp is part of the +// third_party/zlib library, which is just a placeholder for forwarding +// library dependencies. diff --git a/src/third_party/shim_zstd.cpp b/src/third_party/shim_zstd.cpp new file mode 100644 index 0000000000..a3114c1911 --- /dev/null +++ b/src/third_party/shim_zstd.cpp @@ -0,0 +1,3 @@ +// This file intentionally blank. shim_zlib.cpp is part of the +// third_party/zlib library, which is just a placeholder for forwarding +// library dependencies. diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript index ac120d3aa1..9a72ce0276 100644 --- a/src/third_party/wiredtiger/SConscript +++ b/src/third_party/wiredtiger/SConscript @@ -8,7 +8,7 @@ Import("endian") env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['snappy', 'zlib']) +env.InjectThirdPartyIncludePaths(libraries=['lz4', 'snappy', 'zlib', 'zstd']) if endian == "big": env.Append(CPPDEFINES=[('WORDS_BIGENDIAN', 1)]) @@ -78,8 +78,10 @@ else: "Please generate an approriate wiredtiger_config.h") Exit(1) -useZlib = True +useLz4 = True useSnappy = True +useZlib = True +useZstd = True version_file = 'build_posix/aclocal/version-set.m4' @@ -173,14 +175,22 @@ with open(File(filelistfile).srcnode().abspath) as filelist: with open(File(filelistfile).srcnode().abspath) as filelist: cssources = list(filtered_filelist(filelist, True)) -if useZlib: - env.Append(CPPDEFINES=['HAVE_BUILTIN_EXTENSION_ZLIB']) - wtsources.append("ext/compressors/zlib/zlib_compress.c") +if useLz4: + env.Append(CPPDEFINES=['HAVE_BUILTIN_EXTENSION_LZ4']) + wtsources.append("ext/compressors/lz4/lz4_compress.c") if useSnappy: env.Append(CPPDEFINES=['HAVE_BUILTIN_EXTENSION_SNAPPY']) wtsources.append("ext/compressors/snappy/snappy_compress.c") +if useZlib: + env.Append(CPPDEFINES=['HAVE_BUILTIN_EXTENSION_ZLIB']) + wtsources.append("ext/compressors/zlib/zlib_compress.c") + +if useZstd: + env.Append(CPPDEFINES=['HAVE_BUILTIN_EXTENSION_ZSTD']) + wtsources.append("ext/compressors/zstd/zstd_compress.c") + # Use hardware by default on all platforms if available. # If not available at runtime, we fall back to software in some cases. if (get_option("use-s390x-crc32") == "off"): @@ -196,8 +206,10 @@ wtlib = env.Library( source=wtsources, LIBDEPS=[ 'wiredtiger_checksum', + '$BUILD_DIR/third_party/shim_lz4', '$BUILD_DIR/third_party/shim_snappy', '$BUILD_DIR/third_party/shim_zlib', + '$BUILD_DIR/third_party/shim_zstd', ], LIBDEPS_TAGS=[ 'init-no-global-side-effects',