summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2022-11-09 12:26:22 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-09 02:47:22 +0000
commit8b22164b8265a8e71a02efe315a093517bd369f8 (patch)
treead819eedfcd6e7011fc75b10650ad105ab88153d /src/third_party/wiredtiger
parent764fe7a5509489a2dba201fce5590a811b1d30de (diff)
downloadmongo-8b22164b8265a8e71a02efe315a093517bd369f8.tar.gz
Import wiredtiger: 62b81934e662c3a16af434a8da49df142c6ab47d from branch mongodb-master
ref: 26bb60b52e..62b81934e6 for: 6.2.0-rc0 WT-10032 Implement support for truncate operation cpp test framework
Diffstat (limited to 'src/third_party/wiredtiger')
-rw-r--r--src/third_party/wiredtiger/cmake/configs/base.cmake6
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp45
-rw-r--r--src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.h9
-rwxr-xr-xsrc/third_party/wiredtiger/test/evergreen.yml13
5 files changed, 69 insertions, 6 deletions
diff --git a/src/third_party/wiredtiger/cmake/configs/base.cmake b/src/third_party/wiredtiger/cmake/configs/base.cmake
index 0d680efe9ae..7ad914028d0 100644
--- a/src/third_party/wiredtiger/cmake/configs/base.cmake
+++ b/src/third_party/wiredtiger/cmake/configs/base.cmake
@@ -261,6 +261,12 @@ config_bool(
)
config_bool(
+ ENABLE_CPPSUITE
+ "Build the cppsuite"
+ DEFAULT ON
+)
+
+config_bool(
ENABLE_S3
"Build the S3 storage extension"
DEFAULT OFF
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 25326554c0b..390981a5805 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-master",
- "commit": "26bb60b52e5a498365d3155adc293e9e05152da2"
+ "commit": "62b81934e662c3a16af434a8da49df142c6ab47d"
}
diff --git a/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp
index a69ed6b91ea..d88bd718a30 100644
--- a/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp
+++ b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp
@@ -209,6 +209,51 @@ thread_worker::remove(scoped_cursor &cursor, uint64_t collection_id, const std::
return (ret == 0);
}
+/*
+ * Truncate takes in the collection_id to perform truncate on, two optional keys corresponding to
+ * the desired start and stop range, and a configuration string. If a start/stop key exists, we open
+ * a cursor and position on that key, otherwise we pass in a null cursor to the truncate API to
+ * indicate we should truncate all the way to the first and/or last key.
+ */
+bool
+thread_worker::truncate(uint64_t collection_id, std::optional<std::string> start_key,
+ std::optional<std::string> stop_key, const std::string &config)
+{
+ WT_DECL_RET;
+
+ wt_timestamp_t ts = tsm->get_next_ts();
+ ret = txn.set_commit_timestamp(ts);
+ testutil_assert(ret == 0 || ret == EINVAL);
+ if (ret != 0) {
+ txn.set_needs_rollback(true);
+ return (false);
+ }
+
+ const std::string coll_name = db.get_collection(collection_id).name;
+
+ scoped_cursor start_cursor = session.open_scoped_cursor(coll_name);
+ scoped_cursor stop_cursor = session.open_scoped_cursor(coll_name);
+ if (start_key)
+ start_cursor->set_key(start_cursor.get(), start_key.value().c_str());
+
+ if (stop_key)
+ stop_cursor->set_key(stop_cursor.get(), stop_key.value().c_str());
+
+ ret = session->truncate(session.get(), (start_key || stop_key) ? nullptr : coll_name.c_str(),
+ start_key ? start_cursor.get() : nullptr, stop_key ? stop_cursor.get() : nullptr,
+ config.empty() ? nullptr : config.c_str());
+
+ if (ret != 0) {
+ if (ret == WT_ROLLBACK) {
+ txn.set_needs_rollback(true);
+ return (false);
+ } else
+ testutil_die(ret, "unhandled error while trying to truncate a key range");
+ }
+
+ return (ret == 0);
+}
+
void
thread_worker::sleep()
{
diff --git a/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.h b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.h
index 6a0d0c9deee..afc4c8366b0 100644
--- a/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.h
+++ b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.h
@@ -83,6 +83,15 @@ class thread_worker {
* needs to be rolled back.
*/
bool remove(scoped_cursor &cursor, uint64_t collection_id, const std::string &key);
+
+ /*
+ * Generic truncate function.
+ *
+ * Return true if the operation was successful, a return value of false implies the transaction
+ * needs to be rolled back.
+ */
+ bool truncate(uint64_t collection_id, std::optional<std::string> start_key,
+ std::optional<std::string> stop_key, const std::string &config);
void sleep();
bool running() const;
diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml
index 3ea7b757a1a..09c4dcb8b1d 100755
--- a/src/third_party/wiredtiger/test/evergreen.yml
+++ b/src/third_party/wiredtiger/test/evergreen.yml
@@ -119,6 +119,7 @@ functions:
${GNU_C_VERSION|} \
${GNU_CXX_VERSION|} \
${ENABLE_S3|} \
+ ${ENABLE_CPPSUITE|} \
${IMPORT_S3_SDK|} \
${SPINLOCK_TYPE|} \
${CC_OPTIMIZE_LEVEL|}"
@@ -784,6 +785,7 @@ variables:
<<: *configure_flags_with_builtins
CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mongodbtoolchain_v4_clang.cmake
CMAKE_BUILD_TYPE: -DCMAKE_BUILD_TYPE=ASan
+ ENABLE_CPPSUITE: -DENABLE_CPPSUITE=0
#########################################################################################
# The following stress tests are configured to run for six hours via the "-t 360"
@@ -4243,7 +4245,7 @@ buildvariants:
run_on:
- ubuntu2004-test
expansions:
- CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mongodbtoolchain_v4_clang.cmake
+ CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/clang.cmake
CMAKE_BUILD_TYPE: -DCMAKE_BUILD_TYPE=ASan
CMAKE_PREFIX_PATH: -DCMAKE_PREFIX_PATH="$(pwd)/TCMALLOC_LIB"
CMAKE_INSTALL_PREFIX: -DCMAKE_INSTALL_PREFIX=$(pwd)/cmake_build/LOCAL_INSTALL
@@ -4254,7 +4256,7 @@ buildvariants:
WT_BUILDDIR=$WT_TOPDIR/cmake_build
ASAN_OPTIONS="detect_leaks=1:abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1"
LSAN_OPTIONS="print_suppressions=0:suppressions=$WT_TOPDIR/test/evergreen/asan_leaks.supp"
- ASAN_SYMBOLIZER_PATH=/opt/mongodbtoolchain/v4/bin/llvm-symbolizer
+ ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-10/bin/llvm-symbolizer
TESTUTIL_BYPASS_ASAN=1
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libeatmydata.so:$WT_TOPDIR/TCMALLOC_LIB/lib/libtcmalloc.so
PATH=/opt/mongodbtoolchain/v4/bin:$PATH
@@ -4317,7 +4319,7 @@ buildvariants:
run_on:
- ubuntu2004-test
expansions:
- CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mongodbtoolchain_v3_clang.cmake
+ CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/clang.cmake
CMAKE_BUILD_TYPE: -DCMAKE_BUILD_TYPE=UBSan
CC_OPTIMIZE_LEVEL: -DCC_OPTIMIZE_LEVEL=-O1
CMAKE_PREFIX_PATH: -DCMAKE_PREFIX_PATH="$(pwd)/TCMALLOC_LIB"
@@ -4325,7 +4327,7 @@ buildvariants:
smp_command: -j $(grep -c ^processor /proc/cpuinfo)
make_command: ninja
test_env_vars:
- UBSAN_OPTIONS="detect_leaks=1:disable_coredump=0:external_symbolizer_path=/opt/mongodbtoolchain/v4/bin/llvm-symbolizer:abort_on_error=1:print_stacktrace=1"
+ UBSAN_OPTIONS="detect_leaks=1:disable_coredump=0:external_symbolizer_path=/usr/lib/llvm-10/bin/llvm-symbolizer:abort_on_error=1:print_stacktrace=1"
PATH=/opt/mongodbtoolchain/v3/bin:$PATH
WT_TOPDIR=$(git rev-parse --show-toplevel)
WT_BUILDDIR=$WT_TOPDIR/cmake_build
@@ -4601,7 +4603,7 @@ buildvariants:
cmake_generator: "Unix Makefiles"
make_command: make
python_binary: '/opt/mongodbtoolchain/v3/bin/python3'
- CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mongodbtoolchain_v3_gcc.cmake
+ CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/gcc.cmake
CMAKE_INSTALL_PREFIX: -DCMAKE_INSTALL_PREFIX=$(pwd)/cmake_build/LOCAL_INSTALL
tasks:
- name: compile
@@ -4772,6 +4774,7 @@ buildvariants:
LD_LIBRARY_PATH=$WT_BUILDDIR
CMAKE_TOOLCHAIN_FILE: -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/mongodbtoolchain_v4_clang.cmake
CMAKE_INSTALL_PREFIX: -DCMAKE_INSTALL_PREFIX=$(pwd)/cmake_build/LOCAL_INSTALL
+ ENABLE_CPPSUITE: -DENABLE_CPPSUITE=0
python_binary: '/opt/mongodbtoolchain/v4/bin/python3'
# Use quarter of the vCPUs to avoid OOM kill failure and disk issues on this variant.
smp_command: -j $(echo $(grep -c ^processor /proc/cpuinfo) / 4 | bc)