diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-06-06 10:08:02 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-06 00:50:42 +0000 |
commit | 49a1b239f122661789b8a0468cba33349f8aece3 (patch) | |
tree | 89863f289d84f900a60463189da8309116f86da8 /src/third_party/wiredtiger/test | |
parent | d8d2c708b1b0e01e688aece063b979b7eb2cc5da (diff) | |
download | mongo-49a1b239f122661789b8a0468cba33349f8aece3.tar.gz |
Import wiredtiger: b017f238da1ffd71a0623f6bc2e9eb2425887d44 from branch mongodb-master
ref: dd171a05d5..b017f238da
for: 6.1.0-rc0
WT-9400 Read at or before the stable timestamp in the CppSuite.
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/README.md | 1 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/api_const.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cpp) | 0 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/api_const.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h) | 0 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/logger.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.cpp) | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/logger.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h) | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/random_generator.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/random_generator.cpp) | 1 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/random_generator.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/random_generator.h) | 0 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/thread_manager.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/thread_manager.cpp) | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/common/thread_manager.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/thread_manager.h) | 0 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/checkpoint_manager.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/checkpoint_manager.cpp) | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/checkpoint_manager.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/checkpoint_manager.h) | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/component.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cpp) | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/component.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.h) | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.cpp | 65 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.h) | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/perf_plotter.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/perf_plotter.cpp) | 1 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/perf_plotter.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/perf_plotter.h) | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/runtime_monitor.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/runtime_monitor.cpp) | 18 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/runtime_monitor.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/runtime_monitor.h) | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/timestamp_manager.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cpp) | 33 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/timestamp_manager.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.h) | 21 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/workload_generator.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload_generator.cpp) | 17 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/workload_generator.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload_generator.h) | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/workload_tracking.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cpp) | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/workload_tracking.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.h) | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/workload_validation.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cpp) | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/component/workload_validation.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.h) | 6 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/configuration.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cpp) | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/configuration.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.h) | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/database_model.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cpp) | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/database_model.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.h) | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/database_operation.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cpp) | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/database_operation.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.h) | 0 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/test.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/test.cpp) | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/test.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/test.h) | 18 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/thread_context.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cpp) | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/thread_context.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h) | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/throttle.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/throttle.cpp) | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/main/throttle.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/core/throttle.h) | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/storage/connection_manager.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/connection_manager.cpp) | 9 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/storage/connection_manager.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/connection_manager.h) | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_connection.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cpp) | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_connection.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h) | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_types.cpp (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cpp) | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_types.h (renamed from src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h) | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.cpp | 37 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp | 17 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cpp | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp | 20 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cpp | 13 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp | 16 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cpp | 5 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/operations_test.cpp | 8 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/cppsuite/tests/run.cpp | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cpp | 25 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cpp | 20 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/search_near_03.cpp | 18 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp | 24 | ||||
-rwxr-xr-x | src/third_party/wiredtiger/test/evergreen.yml | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/evergreen/build_windows.ps1 | 3 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_cursor_bound01.py | 25 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_cursor_bound02.py | 294 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/unittest/tests/test_reconciliation_tracking.cpp | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.cpp | 15 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.h | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/windows/windows_shim.h | 1 |
66 files changed, 675 insertions, 325 deletions
diff --git a/src/third_party/wiredtiger/test/cppsuite/README.md b/src/third_party/wiredtiger/test/cppsuite/README.md new file mode 100644 index 00000000000..26c95664ab3 --- /dev/null +++ b/src/third_party/wiredtiger/test/cppsuite/README.md @@ -0,0 +1 @@ +# WiredTiger cppsuite diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cpp b/src/third_party/wiredtiger/test/cppsuite/src/common/api_const.cpp index db313b93ebc..db313b93ebc 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/api_const.cpp diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h b/src/third_party/wiredtiger/test/cppsuite/src/common/api_const.h index 8c0038fdee5..8c0038fdee5 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/api_const.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/api_const.h diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.cpp b/src/third_party/wiredtiger/test/cppsuite/src/common/logger.cpp index 67b72eac172..4bb0e982a31 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/logger.cpp @@ -26,13 +26,15 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <chrono> +#include "logger.h" + #include <iostream> -#include <mutex> #include <sstream> #include <thread> -#include "logger.h" +extern "C" { +#include "test_util.h" +} /* Define helpful functions related to debugging. */ namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h b/src/third_party/wiredtiger/test/cppsuite/src/common/logger.h index 3b30ede7bd4..3284d82ee00 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/logger.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/logger.h @@ -26,8 +26,8 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef DEBUG_UTILS_H -#define DEBUG_UTILS_H +#ifndef LOGGER_H +#define LOGGER_H /* Following definitions are required in order to use printing format specifiers in C++. */ #ifndef __STDC_LIMIT_MACROS @@ -37,15 +37,7 @@ #define __STDC_FORMAT_MACROS #endif -#include <chrono> -#include <iostream> #include <mutex> -#include <sstream> -#include <thread> - -extern "C" { -#include "test_util.h" -} /* Define helpful functions related to debugging. */ namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/random_generator.cpp b/src/third_party/wiredtiger/test/cppsuite/src/common/random_generator.cpp index 3973af7242c..f391db0d180 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/random_generator.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/random_generator.cpp @@ -27,6 +27,7 @@ */ #include "random_generator.h" + #include <algorithm> extern "C" { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/random_generator.h b/src/third_party/wiredtiger/test/cppsuite/src/common/random_generator.h index 967d5566ce1..967d5566ce1 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/random_generator.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/random_generator.h diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/thread_manager.cpp b/src/third_party/wiredtiger/test/cppsuite/src/common/thread_manager.cpp index 29d1e547151..e41516c196e 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/thread_manager.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/thread_manager.cpp @@ -26,9 +26,10 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/util/logger.h" #include "thread_manager.h" +#include "logger.h" + namespace test_harness { thread_manager::~thread_manager() { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/thread_manager.h b/src/third_party/wiredtiger/test/cppsuite/src/common/thread_manager.h index 0fce6bfeb45..0fce6bfeb45 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/thread_manager.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/common/thread_manager.h diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/checkpoint_manager.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/checkpoint_manager.cpp index 66836325acf..ba8de32a03f 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/checkpoint_manager.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/checkpoint_manager.cpp @@ -27,9 +27,15 @@ */ #include "checkpoint_manager.h" -#include "connection_manager.h" -#include "util/api_const.h" -#include "util/logger.h" + +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/main/configuration.h" +#include "src/storage/connection_manager.h" + +extern "C" { +#include "test_util.h" +} namespace test_harness { checkpoint_manager::checkpoint_manager(configuration *configuration) diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/checkpoint_manager.h b/src/third_party/wiredtiger/test/cppsuite/src/component/checkpoint_manager.h index a127ee63657..a570c8d215e 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/checkpoint_manager.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/checkpoint_manager.h @@ -29,8 +29,9 @@ #ifndef CHECKPOINT_MANAGER_H #define CHECKPOINT_MANAGER_H -#include "core/component.h" -#include "util/scoped_types.h" +#include "component.h" + +#include "src/storage/scoped_types.h" namespace test_harness { class checkpoint_manager : public component { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/component.cpp index aeb691fe674..f2966db8d22 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/component.cpp @@ -27,7 +27,9 @@ */ #include "component.h" -#include "test_harness/util/api_const.h" + +#include "src/common/api_const.h" +#include "src/common/logger.h" namespace test_harness { component::component(const std::string &name, configuration *config) : _config(config), _name(name) diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.h b/src/third_party/wiredtiger/test/cppsuite/src/component/component.h index 5a8f8f81cf5..effbd259310 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/component.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/component.h @@ -29,15 +29,15 @@ #ifndef COMPONENT_H #define COMPONENT_H -#include "configuration.h" -#include "throttle.h" +#include <string> + +#include "src/main/configuration.h" +#include "src/main/throttle.h" namespace test_harness { /* * A component is a class that defines 4 unique stages in its life-cycle, the stages must be run in * the following order: load, run, end_run, finish. - * - * */ class component { public: diff --git a/src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.cpp new file mode 100644 index 00000000000..f40cfc22479 --- /dev/null +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.cpp @@ -0,0 +1,65 @@ +/*- + * 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. + */ + +#include "op_tracker.h" + +#include "perf_plotter.h" + +namespace test_harness { +op_tracker::op_tracker(const std::string id, const std::string &test_name) + : _id(id), _test_name(test_name), _it_count(0), _total_time_taken(0) +{ +} + +void +op_tracker::append_stats() +{ + uint64_t avg = (uint64_t)_total_time_taken / _it_count; + std::string stat = "{\"name\":\"" + _id + "\",\"value\":" + std::to_string(avg) + "}"; + perf_plotter::instance().add_stat(stat); +} + +template <typename T> +auto +op_tracker::track(T lambda) +{ + auto _start_time = std::chrono::steady_clock::now(); + int ret = lambda(); + auto _end_time = std::chrono::steady_clock::now(); + _total_time_taken += (_end_time - _start_time).count(); + _it_count += 1; + + return ret; +} + +op_tracker::~op_tracker() +{ + if (_it_count != 0) + append_stats(); +} +}; // namespace test_harness diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.h b/src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.h index eea99b2414c..f9a3c3c5698 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/op_tracker.h @@ -26,8 +26,9 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <chrono> -#include <fstream> +#ifndef OP_TRACKER_H +#define OP_TRACKER_H + #include <string> namespace test_harness { @@ -56,3 +57,5 @@ class op_tracker { uint64_t _total_time_taken; }; } // namespace test_harness + +#endif diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/perf_plotter.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/perf_plotter.cpp index d02c1ae61a9..780dcb4fff9 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/perf_plotter.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/perf_plotter.cpp @@ -25,6 +25,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ + #include "perf_plotter.h" namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/perf_plotter.h b/src/third_party/wiredtiger/test/cppsuite/src/component/perf_plotter.h index 36cd9a5817e..3710f0d1ddf 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/perf_plotter.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/perf_plotter.h @@ -25,11 +25,15 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ + #ifndef PERF_PLOTTER_H #define PERF_PLOTTER_H + #include <fstream> #include <mutex> +#include <string> #include <vector> + namespace test_harness { /* * Singleton class owning the perf plot json, provides access to add statistics, and a central call diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/runtime_monitor.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/runtime_monitor.cpp index 7298175e858..1dce6df6c16 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/runtime_monitor.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/runtime_monitor.cpp @@ -26,16 +26,18 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "runtime_monitor.h" + #include <fstream> -#include "connection_manager.h" -#include "core/component.h" -#include "core/configuration.h" -#include "core/throttle.h" -#include "runtime_monitor.h" -#include "util/api_const.h" -#include "util/logger.h" -#include "util/perf_plotter.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/component/perf_plotter.h" +#include "src/storage/connection_manager.h" + +extern "C" { +#include "test_util.h" +} namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/runtime_monitor.h b/src/third_party/wiredtiger/test/cppsuite/src/component/runtime_monitor.h index a02d9979801..383401aefeb 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/runtime_monitor.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/runtime_monitor.h @@ -29,19 +29,11 @@ #ifndef RUNTIME_MONITOR_H #define RUNTIME_MONITOR_H -#include <string> -#include <vector> +#include <memory> -extern "C" { -#include "test_util.h" -#include "wiredtiger.h" -} - -#include "util/scoped_types.h" -#include "workload/database_model.h" - -/* Forward declarations for classes to reduce compilation time and modules coupling. */ -class configuration; +#include "src/main/configuration.h" +#include "src/main/database_model.h" +#include "src/storage/scoped_types.h" namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/timestamp_manager.cpp index fce4b3ca789..865dad819fa 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/timestamp_manager.cpp @@ -26,15 +26,14 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <chrono> +#include "timestamp_manager.h" + #include <sstream> -#include <thread> -#include "connection_manager.h" -#include "core/configuration.h" -#include "timestamp_manager.h" -#include "util/api_const.h" -#include "workload/random_generator.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/common/random_generator.h" +#include "src/storage/connection_manager.h" namespace test_harness { const std::string @@ -134,10 +133,26 @@ timestamp_manager::get_oldest_ts() const } wt_timestamp_t -timestamp_manager::get_random_ts() const +timestamp_manager::get_valid_read_ts() const { + /* Use get_oldest_ts here to convert from atomic to wt_timestamp_t. */ + wt_timestamp_t current_oldest = get_oldest_ts(); + wt_timestamp_t current_stable = _stable_ts; + if (current_stable > current_oldest) { + --current_stable; + } + /* + * Assert that our stable and oldest match if 0 or that the stable is greater than or equal to + * the oldest. Ensuring that the oldest is never greater than the stable. + */ + testutil_assert( + (current_stable == 0 && current_oldest == 0) || current_stable >= current_oldest); + /* + * Its okay to return a timestamp less than a concurrently updated oldest timestamp as all + * readers should be reading with timestamp rounding. + */ return random_generator::instance().generate_integer<wt_timestamp_t>( - _oldest_ts, static_cast<wt_timestamp_t>(get_time_now_s())); + current_oldest, current_stable); } uint64_t diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.h b/src/third_party/wiredtiger/test/cppsuite/src/component/timestamp_manager.h index 88cff40c30e..55fa4a3cc41 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/timestamp_manager.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/timestamp_manager.h @@ -30,12 +30,12 @@ #define TIMESTAMP_MANAGER_H #include <atomic> -#include <string> -#include "core/component.h" +#include "component.h" -/* Forward declarations for classes to reduce compilation time and modules coupling. */ -class configuration; +extern "C" { +#include "test_util.h" +} namespace test_harness { /* @@ -62,8 +62,17 @@ class timestamp_manager : public component { /* Get oldest timestamp. */ wt_timestamp_t get_oldest_ts() const; - /* Generate a random timestamp between the oldest timestamp and now. */ - wt_timestamp_t get_random_ts() const; + /* + * Generate a timestamp between the oldest timestamp and the stable timestamp. + * + * WiredTiger will abort commit transactions that attempt to commit behind an active read + * timestamp in order to preserve repeatable reads. Currently the cppsuite doesn't handle that + * well, so to avoid this issue we will read behind the stable timestamp. + * + * This timestamp isn't guaranteed to provide a repeatable read as the oldest could move + * concurrently removing the previously seen data. + */ + wt_timestamp_t get_valid_read_ts() const; private: /* Get the current time in seconds, bit shifted to the expected location. */ diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload_generator.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_generator.cpp index 026f05b2cb5..e643a576a55 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload_generator.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_generator.cpp @@ -26,19 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <atomic> -#include <map> - -#include "connection_manager.h" -#include "core/configuration.h" -#include "core/throttle.h" -#include "util/api_const.h" -#include "workload/database_model.h" -#include "workload/database_operation.h" -#include "workload/random_generator.h" -#include "workload/workload_tracking.h" #include "workload_generator.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/storage/connection_manager.h" + namespace test_harness { /* operation_config class implementation */ operation_config::operation_config(configuration *config, thread_type type) @@ -46,7 +39,7 @@ operation_config::operation_config(configuration *config, thread_type type) { } -std::function<void(test_harness::thread_context *)> +std::function<void(thread_context *)> operation_config::get_func(database_operation *dbo) { switch (type) { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload_generator.h b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_generator.h index 11049e53063..53a33311bfc 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload_generator.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_generator.h @@ -29,18 +29,12 @@ #ifndef WORKLOAD_GENERATOR_H #define WORKLOAD_GENERATOR_H -#include <algorithm> #include <functional> -#include "core/component.h" -#include "workload/thread_context.h" -#include "thread_manager.h" -#include "workload/database_operation.h" - -/* Forward declarations for classes to reduce compilation time and modules coupling. */ -class configuration; -class database; -class workload_tracking; +#include "src/common/thread_manager.h" +#include "src/main/configuration.h" +#include "src/main/database_operation.h" +#include "src/main/thread_context.h" namespace test_harness { /* @@ -51,7 +45,7 @@ class operation_config { explicit operation_config(configuration *config, thread_type type); /* Returns a function pointer to the member function of the supplied database operation. */ - std::function<void(test_harness::thread_context *)> get_func(database_operation *dbo); + std::function<void(thread_context *)> get_func(database_operation *dbo); public: configuration *config; diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_tracking.cpp index 9b459bd4ad8..668ce176291 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_tracking.cpp @@ -26,12 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "../connection_manager.h" -#include "../core/configuration.h" -#include "../util/api_const.h" -#include "../util/scoped_types.h" #include "workload_tracking.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/storage/connection_manager.h" + namespace test_harness { workload_tracking::workload_tracking( configuration *_config, const bool use_compression, timestamp_manager &tsm) diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.h b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_tracking.h index 0599c0b5a55..640cb294f0c 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_tracking.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_tracking.h @@ -29,9 +29,9 @@ #ifndef WORKLOAD_TRACKING_H #define WORKLOAD_TRACKING_H -#include "../core/component.h" -#include "../timestamp_manager.h" -#include "../util/scoped_types.h" +#include "component.h" +#include "src/storage/scoped_types.h" +#include "timestamp_manager.h" /* * Default schema for tracking operations on collections (key_format: Collection id / Key / diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_validation.cpp index a64ef7e5b7b..b10958be297 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_validation.cpp @@ -26,11 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "workload_validation.h" + #include <algorithm> -#include "../connection_manager.h" -#include "database_model.h" -#include "workload_validation.h" +#include "src/common/logger.h" +#include "src/storage/connection_manager.h" namespace test_harness { void diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.h b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_validation.h index ba745a225df..ecb8f660bc3 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/workload_validation.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/workload_validation.h @@ -33,11 +33,7 @@ #include <string> #include <vector> -extern "C" { -#include "wiredtiger.h" -} - -#include "../util/scoped_types.h" +#include "src/main/database_model.h" namespace test_harness { struct key_state { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/configuration.cpp index f508dc76bea..3e00cb7450b 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/configuration.cpp @@ -26,10 +26,16 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "configuration.h" + #include <algorithm> #include <stack> -#include "configuration.h" +#include "src/common/logger.h" + +extern "C" { +#include "test_util.h" +} namespace test_harness { /* Static methods implementation. */ diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.h b/src/third_party/wiredtiger/test/cppsuite/src/main/configuration.h index b61defc9d3f..e30291f199b 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/configuration.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/configuration.h @@ -32,10 +32,8 @@ #include <string> #include <vector> -#include "test_harness/util/logger.h" - extern "C" { -#include "test_util.h" +#include "wiredtiger.h" } namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/database_model.cpp index 1fbd40012ed..848eff3863d 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/database_model.cpp @@ -26,15 +26,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <chrono> -#include <tuple> - -#include "../connection_manager.h" -#include "../timestamp_manager.h" -#include "../util/api_const.h" #include "database_model.h" -#include "random_generator.h" -#include "workload_tracking.h" + +#include "src/common/api_const.h" +#include "src/common/random_generator.h" +#include "src/storage/connection_manager.h" namespace test_harness { /* collection class implementation */ diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.h b/src/third_party/wiredtiger/test/cppsuite/src/main/database_model.h index d907dbfbda1..aa239b00c75 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_model.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/database_model.h @@ -29,14 +29,11 @@ #ifndef DATABASE_MODEL_H #define DATABASE_MODEL_H -#include <atomic> #include <string> #include <map> +#include <mutex> -#include "workload_tracking.h" - -/* Forward declarations for classes to reduce compilation time and modules coupling. */ -class timestamp_manager; +#include "src/component/workload_tracking.h" namespace test_harness { /* Key/Value type. */ diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/database_operation.cpp index 549a84b5387..0a72b79a778 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/database_operation.cpp @@ -26,16 +26,14 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <cmath> -#include <map> - -#include "../connection_manager.h" -#include "../thread_manager.h" -#include "../util/api_const.h" #include "database_operation.h" -#include "random_generator.h" -#include "workload_tracking.h" -#include "workload_validation.h" + +#include "src/common/thread_manager.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/common/random_generator.h" +#include "src/component/workload_validation.h" +#include "src/storage/connection_manager.h" namespace test_harness { /* Static methods. */ diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.h b/src/third_party/wiredtiger/test/cppsuite/src/main/database_operation.h index 946a322f25a..946a322f25a 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/database_operation.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/database_operation.h diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/test.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/test.cpp index 9f93415ac64..288ca08e2c4 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/test.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/test.cpp @@ -26,19 +26,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -/* Required to build using older versions of g++. */ -#include <cinttypes> -#include <memory> -#include <mutex> - -#include "connection_manager.h" -#include "core/component.h" -#include "core/configuration.h" #include "test.h" -#include "thread_manager.h" -#include "timestamp_manager.h" -#include "util/api_const.h" -#include "util/perf_plotter.h" + +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/component/perf_plotter.h" namespace test_harness { test::test(const test_args &args) : _args(args) diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/test.h b/src/third_party/wiredtiger/test/cppsuite/src/main/test.h index 5e851cf7d03..513df520e74 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/test.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/test.h @@ -29,20 +29,14 @@ #ifndef TEST_H #define TEST_H -#include <memory> #include <string> -#include <vector> -extern "C" { -#include "wiredtiger.h" -} - -#include "checkpoint_manager.h" -#include "connection_manager.h" -#include "runtime_monitor.h" -#include "util/scoped_connection.h" -#include "workload/database_operation.h" -#include "workload_generator.h" +#include "database_operation.h" +#include "src/component/checkpoint_manager.h" +#include "src/component/runtime_monitor.h" +#include "src/component/workload_generator.h" +#include "src/storage/connection_manager.h" +#include "src/storage/scoped_connection.h" namespace test_harness { class test_args { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_context.cpp index 75f1c338f74..b48b985b91f 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_context.cpp @@ -26,14 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "../core/configuration.h" -#include "../timestamp_manager.h" -#include "../util/api_const.h" -#include "../util/logger.h" -#include "workload_tracking.h" -#include "random_generator.h" #include "thread_context.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/common/random_generator.h" + namespace test_harness { const std::string diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_context.h index e968db51ec9..c97038f11cf 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/workload/thread_context.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_context.h @@ -31,17 +31,11 @@ #include <string> -extern "C" { -#include "test_util.h" -} - -#include "../core/throttle.h" -#include "../workload/database_model.h" - -/* Forward declarations for classes to reduce compilation time and modules coupling. */ -class configuration; -class timestamp_manager; -class workload_tracking; +#include "database_model.h" +#include "src/component/workload_tracking.h" +#include "src/component/timestamp_manager.h" +#include "src/main/configuration.h" +#include "src/storage/scoped_types.h" namespace test_harness { enum thread_type { CUSTOM, INSERT, READ, REMOVE, UPDATE }; diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/throttle.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/throttle.cpp index af7b94e8f98..98263140d4d 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/throttle.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/throttle.cpp @@ -26,11 +26,15 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "throttle.h" + #include <thread> -#include "configuration.h" -#include "test_harness/util/api_const.h" -#include "throttle.h" +#include "src/common/api_const.h" + +extern "C" { +#include "test_util.h" +} namespace test_harness { throttle::throttle(const std::string &throttle_rate) diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/throttle.h b/src/third_party/wiredtiger/test/cppsuite/src/main/throttle.h index 24161ea956e..29dd622f872 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/throttle.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/throttle.h @@ -31,8 +31,7 @@ #include <string> -/* Forward declarations for classes to reduce compilation time and modules coupling. */ -class configuration; +#include "configuration.h" namespace test_harness { class throttle { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/connection_manager.cpp b/src/third_party/wiredtiger/test/cppsuite/src/storage/connection_manager.cpp index 292cfbbfeab..f5bf44637bb 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/connection_manager.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/storage/connection_manager.cpp @@ -27,9 +27,12 @@ */ #include "connection_manager.h" -#include "util/api_const.h" -#include "util/logger.h" -#include "util/scoped_connection.h" + +#include "src/common/logger.h" + +extern "C" { +#include "test_util.h" +} namespace test_harness { connection_manager & diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/connection_manager.h b/src/third_party/wiredtiger/test/cppsuite/src/storage/connection_manager.h index 2fef81d2af8..20161126736 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/connection_manager.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/storage/connection_manager.h @@ -39,12 +39,7 @@ #include <mutex> -extern "C" { -#include "test_util.h" -#include "wiredtiger.h" -} - -#include "util/scoped_types.h" +#include "scoped_types.h" namespace test_harness { /* diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cpp b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_connection.cpp index 39a8fede916..ca879aa4da9 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_connection.cpp @@ -25,12 +25,11 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -#include <iostream> -#include <utility> -#include "../connection_manager.h" #include "scoped_connection.h" +#include "connection_manager.h" + namespace test_harness { scoped_connection::scoped_connection(const std::string &db_conn_config, const std::string &home) diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_connection.h index 6e999b6db54..2d76b800235 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_connection.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_connection.h @@ -37,12 +37,12 @@ #define __STDC_FORMAT_MACROS #endif +#include <string> + extern "C" { #include "test_util.h" } -#include "../connection_manager.h" - namespace test_harness { class scoped_connection { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cpp b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_types.cpp index b0b20ccc0f8..4c97213abc8 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_types.cpp @@ -26,11 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <string> -#include <utility> - #include "scoped_types.h" +extern "C" { +#include "test_util.h" +} + namespace test_harness { /* scoped_cursor implementation */ diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_types.h index c015c0c909b..e6f33931319 100644 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/util/scoped_types.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/storage/scoped_types.h @@ -37,8 +37,10 @@ #define __STDC_FORMAT_MACROS #endif +#include <string> + extern "C" { -#include "test_util.h" +#include "wiredtiger.h" } namespace test_harness { diff --git a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.cpp b/src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.cpp deleted file mode 100644 index af806927768..00000000000 --- a/src/third_party/wiredtiger/test/cppsuite/test_harness/core/op_tracker.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "test_harness/test.h" -#include "test_harness/util/perf_plotter.h" -#include "op_tracker.h" - -namespace test_harness { -op_tracker::op_tracker(const std::string id, const std::string &test_name) - : _id(id), _test_name(test_name), _it_count(0), _total_time_taken(0) -{ -} - -void -op_tracker::append_stats() -{ - uint64_t avg = (uint64_t)_total_time_taken / _it_count; - std::string stat = "{\"name\":\"" + _id + "\",\"value\":" + std::to_string(avg) + "}"; - perf_plotter::instance().add_stat(stat); -} - -template <typename T> -auto -op_tracker::track(T lambda) -{ - auto _start_time = std::chrono::steady_clock::now(); - int ret = lambda(); - auto _end_time = std::chrono::steady_clock::now(); - _total_time_taken += (_end_time - _start_time).count(); - _it_count += 1; - - return ret; -} - -op_tracker::~op_tracker() -{ - if (_it_count != 0) - append_stats(); -} -}; // namespace test_harness diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp index 7f4dfea30b0..faa002f06af 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_perf.cpp @@ -26,14 +26,10 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <time.h> +#include "src/component/op_tracker.cpp" +#include "src/main/test.h" -#include "test_harness/core/op_tracker.cpp" -#include "test_harness/test.h" -#include "test_harness/util/api_const.h" -#include "test_harness/workload/random_generator.h" - -namespace test_harness { +using namespace test_harness; /* * This test performs cursor traversal operations next() and prev() on a collection with both @@ -50,9 +46,11 @@ class bounded_cursor_perf : public test { static void set_bounds(scoped_cursor &cursor) { - cursor->set_key(cursor.get(), std::string(1, ('0' - 1)).c_str()); + std::string lower_bound(1, ('0' - 1)); + cursor->set_key(cursor.get(), lower_bound.c_str()); cursor->bound(cursor.get(), "bound=lower"); - cursor->set_key(cursor.get(), std::string(1, ('9' + 1)).c_str()); + std::string upper_bound(1, ('9' + 1)); + cursor->set_key(cursor.get(), upper_bound.c_str()); cursor->bound(cursor.get(), "bound=upper"); } @@ -114,4 +112,3 @@ class bounded_cursor_perf : public test { } } }; -} // namespace test_harness diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cpp index 97341e356b3..64ae392d14b 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/burst_inserts.cpp @@ -26,9 +26,8 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" -#include "test_harness/workload/random_generator.h" -#include "test_harness/timestamp_manager.h" +#include "src/common/random_generator.h" +#include "src/main/test.h" using namespace test_harness; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp index ccffed30420..98b357b7eb8 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp @@ -26,11 +26,15 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" +#include "src/common/api_const.h" +#include "src/common/random_generator.h" +#include "src/component/workload_tracking.h" +#include "src/main/test.h" + +using namespace test_harness; -namespace test_harness { /* Defines what data is written to the tracking table for use in custom validation. */ -class tracking_table_cache_resize : public test_harness::workload_tracking { +class tracking_table_cache_resize : public workload_tracking { public: tracking_table_cache_resize( @@ -55,16 +59,16 @@ class tracking_table_cache_resize : public test_harness::workload_tracking { * than the cache size they are rejected, so only transactions made when cache size is 500MB should * be allowed. */ -class cache_resize : public test_harness::test { +class cache_resize : public test { public: - cache_resize(const test_harness::test_args &args) : test(args) + cache_resize(const test_args &args) : test(args) { init_tracking(new tracking_table_cache_resize(_config->get_subconfig(WORKLOAD_TRACKING), _config->get_bool(COMPRESSION_ENABLED), *_timestamp_manager)); } void - custom_operation(test_harness::thread_context *tc) override final + custom_operation(thread_context *tc) override final { WT_CONNECTION *conn = connection_manager::instance().get_connection(); WT_CONNECTION_IMPL *conn_impl = (WT_CONNECTION_IMPL *)conn; @@ -120,7 +124,7 @@ class cache_resize : public test_harness::test { } void - insert_operation(test_harness::thread_context *tc) override final + insert_operation(thread_context *tc) override final { const uint64_t collection_count = tc->db.get_collection_count(); testutil_assert(collection_count > 0); @@ -233,5 +237,3 @@ class cache_resize : public test_harness::test { */ } }; - -} // namespace test_harness diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cpp index 0b5a2966b2f..155ffc101e9 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/csuite_style_example_test.cpp @@ -33,15 +33,16 @@ * test_template.cpp and create_script.sh. */ -#include "test_harness/connection_manager.h" -#include "test_harness/thread_manager.h" -#include "test_harness/util/api_const.h" -#include "test_harness/util/logger.h" -#include "test_harness/util/scoped_connection.h" -#include "test_harness/workload/random_generator.h" +#include "src/common/api_const.h" +#include "src/common/logger.h" +#include "src/common/random_generator.h" +#include "src/common/thread_manager.h" +#include "src/storage/connection_manager.h" +#include "src/storage/scoped_connection.h" extern "C" { #include "wiredtiger.h" +#include "test_util.h" } using namespace test_harness; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp index f3f733dfe25..ba048dbbca8 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp @@ -26,9 +26,11 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" -#include "test_harness/util/api_const.h" -#include "test_harness/workload/random_generator.h" +#include "src/common/api_const.h" +#include "src/common/random_generator.h" +#include "src/main/test.h" + +using namespace test_harness; /* * In this test, we want to verify the usage of the cursor bound API and check that the cursor @@ -43,8 +45,6 @@ * random bounds set. Both next() and prev() calls with bounds set is verified against the * default cursor next() and prev() calls. */ -namespace test_harness { - class cursor_bound_01 : public test { /* Class helper to represent the lower and uppers bounds for the range cursor. */ class bound { @@ -605,7 +605,7 @@ class cursor_bound_01 : public test { } scoped_cursor normal_cursor = tc->session.open_scoped_cursor(coll.name); - wt_timestamp_t ts = tc->tsm->get_random_ts(); + wt_timestamp_t ts = tc->tsm->get_valid_read_ts(); /* * The oldest timestamp might move ahead and the reading timestamp might become invalid. * To tackle this issue, we round the timestamp to the oldest timestamp value. @@ -677,7 +677,7 @@ class cursor_bound_01 : public test { } scoped_cursor normal_cursor = tc->session.open_scoped_cursor(coll.name); - wt_timestamp_t ts = tc->tsm->get_random_ts(); + wt_timestamp_t ts = tc->tsm->get_valid_read_ts(); /* * The oldest timestamp might move ahead and the reading timestamp might become invalid. * To tackle this issue, we round the timestamp to the oldest timestamp value. @@ -699,5 +699,3 @@ class cursor_bound_01 : public test { tc->transaction.rollback(); } }; - -} // namespace test_harness diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cpp index 475153ae9c7..a92b53066fb 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/hs_cleanup.cpp @@ -26,9 +26,8 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" - -#include "test_harness/connection_manager.h" +#include "src/common/random_generator.h" +#include "src/main/test.h" using namespace test_harness; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/operations_test.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/operations_test.cpp index b96ba0ebd86..7be490958ff 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/operations_test.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/operations_test.cpp @@ -26,7 +26,9 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" +#include "src/main/test.h" + +using namespace test_harness; /* * The "base test" that the framework uses, because its not overloading any of the database @@ -34,9 +36,9 @@ * * Can be used to create stress tests in various ways. */ -class operations_test : public test_harness::test { +class operations_test : public test { public: - operations_test(const test_harness::test_args &args) : test(args) + operations_test(const test_args &args) : test(args) { init_tracking(); } diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp index 6d52caee4fb..c79c0cb4220 100755 --- a/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp @@ -26,12 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include <fstream> +#include <algorithm> #include <iostream> #include <string> -#include "test_harness/util/logger.h" -#include "test_harness/test.h" +#include "src/common/logger.h" +#include "src/main/test.h" #include "bounded_cursor_perf.cpp" #include "burst_inserts.cpp" @@ -44,6 +44,10 @@ #include "search_near_03.cpp" #include "test_template.cpp" +extern "C" { +#include "test_util.h" +} + /* Declarations to avoid the error raised by -Werror=missing-prototypes. */ const std::string parse_configuration_from_file(const std::string &filename); void print_help(); diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cpp index dcb6692f643..b70c5573f74 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_01.cpp @@ -26,13 +26,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/util/api_const.h" -#include "test_harness/workload/random_generator.h" -#include "test_harness/workload/thread_context.h" -#include "test_harness/test.h" -#include "test_harness/thread_manager.h" +#include "src/common/api_const.h" +#include "src/common/random_generator.h" +#include "src/main/test.h" using namespace test_harness; + /* * In this test, we want to verify that search_near with prefix enabled only traverses the portion * of the tree that follows the prefix portion of the search key. The test is composed of a populate @@ -43,7 +42,7 @@ using namespace test_harness; * - Using WiredTiger statistics to validate that the number of entries traversed is within * bounds of the search key. */ -class search_near_01 : public test_harness::test { +class search_near_01 : public test { uint64_t keys_per_prefix = 0; uint64_t srchkey_len = 0; const std::string ALPHABET{"abcdefghijklmnopqrstuvwxyz"}; @@ -102,14 +101,14 @@ class search_near_01 : public test_harness::test { } public: - search_near_01(const test_harness::test_args &args) : test(args) + search_near_01(const test_args &args) : test(args) { init_tracking(); } void - populate(test_harness::database &database, test_harness::timestamp_manager *tsm, - test_harness::configuration *config, test_harness::workload_tracking *tracking) override final + populate(database &database, timestamp_manager *tsm, configuration *config, + workload_tracking *tracking) override final { uint64_t collection_count, key_size; std::vector<thread_context *> workers; @@ -180,8 +179,8 @@ class search_near_01 : public test_harness::test { } static void - perform_search_near(test_harness::thread_context *tc, std::string collection_name, - uint64_t srchkey_len, std::atomic<int64_t> &z_key_searches) + perform_search_near(thread_context *tc, std::string collection_name, uint64_t srchkey_len, + std::atomic<int64_t> &z_key_searches) { std::string srch_key; int cmpp = 0; @@ -223,13 +222,13 @@ class search_near_01 : public test_harness::test { } void - read_operation(test_harness::thread_context *tc) override final + read_operation(thread_context *tc) override final { /* Make sure that thread statistics cursor is null before we open it. */ testutil_assert(tc->stat_cursor.get() == nullptr); /* This test will only work with one read thread. */ testutil_assert(tc->thread_count == 1); - test_harness::configuration *workload_config, *read_config; + configuration *workload_config, *read_config; std::vector<thread_context *> workers; std::atomic<int64_t> z_key_searches; int64_t entries_stat, expected_entries, prefix_stat, prev_entries_stat, prev_prefix_stat; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cpp index 63d0354c9c8..dd98a88e6dc 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_02.cpp @@ -26,9 +26,9 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" -#include "test_harness/util/api_const.h" -#include "test_harness/workload/random_generator.h" +#include "src/common/api_const.h" +#include "src/common/random_generator.h" +#include "src/main/test.h" using namespace test_harness; @@ -39,16 +39,16 @@ using namespace test_harness; * - M threads will execute search_near calls with prefix enabled using random prefixes as well. * Each search_near call with prefix enabled is verified using the default search_near. */ -class search_near_02 : public test_harness::test { +class search_near_02 : public test { public: - search_near_02(const test_harness::test_args &args) : test(args) + search_near_02(const test_args &args) : test(args) { init_tracking(); } void - populate(test_harness::database &database, test_harness::timestamp_manager *, - test_harness::configuration *config, test_harness::workload_tracking *) override final + populate(database &database, timestamp_manager *, configuration *config, + workload_tracking *) override final { /* * The populate phase only creates empty collections. The number of collections is defined @@ -66,7 +66,7 @@ class search_near_02 : public test_harness::test { } void - insert_operation(test_harness::thread_context *tc) override final + insert_operation(thread_context *tc) override final { /* Each insert operation will insert new keys in the collections. */ logger::log_msg( @@ -145,7 +145,7 @@ class search_near_02 : public test_harness::test { } void - read_operation(test_harness::thread_context *tc) override final + read_operation(thread_context *tc) override final { /* * Each read operation performs search_near calls with and without prefix enabled on random @@ -176,7 +176,7 @@ class search_near_02 : public test_harness::test { auto &cursor_prefix = cursors[coll.id]; - wt_timestamp_t ts = tc->tsm->get_random_ts(); + wt_timestamp_t ts = tc->tsm->get_valid_read_ts(); /* * The oldest timestamp might move ahead and the reading timestamp might become invalid. * To tackle this issue, we round the timestamp to the oldest timestamp value. diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_03.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_03.cpp index dc6b4a0352a..b4b365a9792 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/search_near_03.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/search_near_03.cpp @@ -26,9 +26,9 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" -#include "test_harness/util/api_const.h" -#include "test_harness/workload/random_generator.h" +#include "src/common/api_const.h" +#include "src/common/random_generator.h" +#include "src/main/test.h" using namespace test_harness; @@ -40,13 +40,13 @@ using namespace test_harness; * - M threads will traverse the collections and ensure that the number of records in the * collections don't change. */ -class search_near_03 : public test_harness::test { +class search_near_03 : public test { /* A 2D array consisted of a mapping between each collection and their inserted prefixes. */ std::vector<std::vector<std::string>> prefixes_map; const std::string ALPHABET{"abcdefghijklmnopqrstuvwxyz"}; public: - search_near_03(const test_harness::test_args &args) : test(args) + search_near_03(const test_args &args) : test(args) { init_tracking(); } @@ -143,8 +143,8 @@ class search_near_03 : public test_harness::test { } void - populate(test_harness::database &database, test_harness::timestamp_manager *tsm, - test_harness::configuration *config, test_harness::workload_tracking *tracking) override final + populate(database &database, timestamp_manager *tsm, configuration *config, + workload_tracking *tracking) override final { uint64_t collection_count, key_count, key_size; std::vector<thread_context *> workers; @@ -217,7 +217,7 @@ class search_near_03 : public test_harness::test { } void - insert_operation(test_harness::thread_context *tc) override final + insert_operation(thread_context *tc) override final { std::map<uint64_t, scoped_cursor> cursors; std::string prefix_key; @@ -261,7 +261,7 @@ class search_near_03 : public test_harness::test { } void - read_operation(test_harness::thread_context *tc) override final + read_operation(thread_context *tc) override final { uint64_t key_count = 0; int ret = 0; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp index 96e9ff29fdc..5ddf4826597 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp @@ -26,11 +26,14 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#include "test_harness/test.h" +#include <iostream> + +#include "src/common/api_const.h" +#include "src/main/test.h" namespace test_harness { /* Defines what data is written to the tracking table for use in custom validation. */ -class tracking_table_template : public test_harness::workload_tracking { +class tracking_table_template : public workload_tracking { public: tracking_table_template( @@ -54,9 +57,9 @@ class tracking_table_template : public test_harness::workload_tracking { * Class that defines operations that do nothing as an example. This shows how database operations * can be overridden and customized. */ -class test_template : public test_harness::test { +class test_template : public test { public: - test_template(const test_harness::test_args &args) : test(args) + test_template(const test_args &args) : test(args) { init_tracking(new tracking_table_template(_config->get_subconfig(WORKLOAD_TRACKING), _config->get_bool(COMPRESSION_ENABLED), *_timestamp_manager)); @@ -70,38 +73,37 @@ class test_template : public test_harness::test { } void - populate(test_harness::database &, test_harness::timestamp_manager *, - test_harness::configuration *, test_harness::workload_tracking *) override final + populate(database &, timestamp_manager *, configuration *, workload_tracking *) override final { std::cout << "populate: nothing done." << std::endl; } void - custom_operation(test_harness::thread_context *) override final + custom_operation(thread_context *) override final { std::cout << "custom_operation: nothing done." << std::endl; } void - insert_operation(test_harness::thread_context *) override final + insert_operation(thread_context *) override final { std::cout << "insert_operation: nothing done." << std::endl; } void - read_operation(test_harness::thread_context *) override final + read_operation(thread_context *) override final { std::cout << "read_operation: nothing done." << std::endl; } void - remove_operation(test_harness::thread_context *) override final + remove_operation(thread_context *) override final { std::cout << "remove_operation: nothing done." << std::endl; } void - update_operation(test_harness::thread_context *) override final + update_operation(thread_context *) override final { std::cout << "update_operation: nothing done." << std::endl; } diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml index d431af14ddf..105abffe6d7 100755 --- a/src/third_party/wiredtiger/test/evergreen.yml +++ b/src/third_party/wiredtiger/test/evergreen.yml @@ -1030,6 +1030,8 @@ tasks: - func: "compile wiredtiger" vars: posix_configure_flags: -DENABLE_STRICT=1 -DHAVE_DIAGNOSTIC=1 -DENABLE_LZ4=1 -DENABLE_SNAPPY=1 -DENABLE_ZLIB=1 -DHAVE_UNITTEST=1 + # Different flags for windows based on what is supported and enabled by default. + windows_configure_flags: -DHAVE_DIAGNOSTIC=1 -DHAVE_UNITTEST=1 - command: shell.exec params: working_dir: "wiredtiger/cmake_build" @@ -4353,6 +4355,7 @@ buildvariants: - name: make-check-test - name: ".unit_test" - name: fops + - name: unittest-test - name: macos-1014 display_name: "OS X 10.14" diff --git a/src/third_party/wiredtiger/test/evergreen/build_windows.ps1 b/src/third_party/wiredtiger/test/evergreen/build_windows.ps1 index 001a93dbab4..56a68b0ab55 100644 --- a/src/third_party/wiredtiger/test/evergreen/build_windows.ps1 +++ b/src/third_party/wiredtiger/test/evergreen/build_windows.ps1 @@ -27,7 +27,8 @@ cd cmake_build # Configure build with CMake. if( $configure -eq $true) { - C:\cmake\bin\cmake --no-warn-unused-cli -DSWIG_DIR="C:\swigwin-3.0.2" -DSWIG_EXECUTABLE="C:\swigwin-3.0.2\swig.exe" -DCMAKE_BUILD_TYPE='None' -DENABLE_PYTHON=1 -DENABLE_STRICT=1 -DCMAKE_TOOLCHAIN_FILE='..\cmake\toolchains\cl.cmake' -G "Ninja" ..\. + # Note that ${args} are all the command line options that are not automatically parsed by the param function. + C:\cmake\bin\cmake --no-warn-unused-cli -DSWIG_DIR='C:\swigwin-3.0.2' -DSWIG_EXECUTABLE='C:\swigwin-3.0.2\swig.exe' -DCMAKE_BUILD_TYPE='None' -DENABLE_PYTHON=1 -DENABLE_STRICT=1 -DCMAKE_TOOLCHAIN_FILE='..\cmake\toolchains\cl.cmake' ${args} -G "Ninja" ..\. } # Execute Ninja build. diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py index 7e806650f33..c0baf30ee22 100644 --- a/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py +++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound01.py @@ -30,25 +30,34 @@ import wiredtiger, wttest from wtscenario import make_scenarios # test_cursor_bound01.py -# Basic cursor bound API validation +# Basic cursor bound API validation. class test_cursor_bound01(wttest.WiredTigerTestCase): file_name = 'test_cursor_bound01' types = [ - ('file', dict(uri='file:', use_index = False)), - ('table', dict(uri='table:', use_index = False)), - ('lsm', dict(uri='lsm:', use_index = False)), - ('index', dict(uri='table:', use_index = True)), + ('file', dict(uri='file:', use_index = False, use_colgroup = False)), + ('table', dict(uri='table:', use_index = False, use_colgroup = False)), + ('lsm', dict(uri='lsm:', use_index = False, use_colgroup = False)), + ('colgroup', dict(uri='table:', use_index = False, use_colgroup = False)), + #FIXME: Turn on once index cursor bound implementation is done. + #('index', dict(uri='table:', use_index = True)), ] - scenarios = make_scenarios(types) def test_bound_api(self): uri = self.uri + self.file_name create_params = 'value_format=S,key_format=i' - if self.use_index: + if self.use_index or self.use_colgroup: create_params += ",columns=(k,v)" + if self.use_colgroup: + create_params += ',colgroups=(g0)' self.session.create(uri, create_params) + # Add in column group. + if self.use_colgroup: + create_params = 'columns=(v),' + suburi = 'colgroup:table0:g0' + self.session.create(suburi, create_params) + cursor = None if self.use_index: # Test Index Cursors bound API support. @@ -69,7 +78,9 @@ class test_cursor_bound01(wttest.WiredTigerTestCase): '/Invalid argument/') # Check that bound configuration works properly. + cursor.set_key(0) cursor.bound("bound=lower") + cursor.set_key(10) cursor.bound("bound=upper") # Clear and inclusive configuration are not compatible with each other. diff --git a/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py b/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py new file mode 100644 index 00000000000..5e8ec36f422 --- /dev/null +++ b/src/third_party/wiredtiger/test/suite/test_cursor_bound02.py @@ -0,0 +1,294 @@ +#!/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 wiredtiger, wttest +from wtscenario import make_scenarios + +# test_cursor_bound02.py +# Test that setting bounds of different key formats works in the cursor bound API. Make +# sure that WiredTiger complains when the upper and lower bounds overlap and that clearing the +# bounds through the bound API and reset calls work appriopately. +class test_cursor_bound02(wttest.WiredTigerTestCase): + file_name = 'test_cursor_bound02' + + types = [ + ('file', dict(uri='file:', use_colgroup=False)), + ('table', dict(uri='table:', use_colgroup=False)), + ('colgroup', dict(uri='table:', use_colgroup=True)) + ] + + key_format_values = [ + ('string', dict(key_format='S')), + ('var', dict(key_format='r')), + ('int', dict(key_format='i')), + ('bytes', dict(key_format='u')), + ('composite_string', dict(key_format='SSS')), + ('composite_int_string', dict(key_format='iS')), + ('composite_complex', dict(key_format='iSru')), + ] + + inclusive = [ + ('inclusive', dict(inclusive=True)), + ('no-inclusive', dict(inclusive=False)) + ] + scenarios = make_scenarios(types, key_format_values, inclusive) + + def gen_key(self, i): + tuple_key = [] + for key in self.key_format: + if key == 'S' or key == 'u': + tuple_key.append('key' + str(i)) + elif key == "r": + tuple_key.append(self.recno(i)) + elif key == "i": + tuple_key.append(i) + + if (len(self.key_format) == 1): + return tuple_key[0] + else: + return tuple(tuple_key) + + def gen_colgroup_create_param(self): + create_params = ",columns=(" + start = 0 + for _ in self.key_format: + create_params += "k{0},".format(str(start)) + start += 1 + create_params += "v),colgroups=(g0)" + return create_params + + def set_bounds(self, cursor, bound_config): + inclusive_config = ",inclusive=false" if self.inclusive == False else "" + return cursor.bound("bound={0}{1}".format(bound_config, inclusive_config)) + + def test_bound_api(self): + uri = self.uri + self.file_name + create_params = 'value_format=S,key_format={}'.format(self.key_format) + if self.use_colgroup: + create_params += self.gen_colgroup_create_param() + self.session.create(uri, create_params) + # Add in column group. + if self.use_colgroup: + create_params = 'columns=(v),' + suburi = 'colgroup:{0}:g0'.format(self.file_name) + self.session.create(suburi, create_params) + + cursor = self.session.open_cursor(uri) + + # Test bound API: Basic usage. + cursor.set_key(self.gen_key(40)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Upper bound < lower bound. + cursor.set_key(self.gen_key(30)) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "upper"), '/Invalid argument/') + + # Test bound API: Lower bound > upper bound. + cursor.set_key(self.gen_key(95)) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "lower"), '/Invalid argument/') + + # Test bound API: Test setting lower bound to 20, which would succeed setting upper + # bound to 30 + cursor.set_key(self.gen_key(20)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(30)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Test setting upper bound to 99, which would succeed setting lower + # bound to 90 + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + + # Test bound API: No key set. + cursor.reset() + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "lower"), '/Invalid argument/') + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "upper"), '/Invalid argument/') + + # Test bound API: Test that the key persists after lower bound call. + cursor.set_key(self.gen_key(30)) + cursor.set_value("30") + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.insert() + + # Test bound API: Test that the key persists after upper bound call. + cursor.set_key(self.gen_key(90)) + cursor.set_value("90") + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + cursor.insert() + + # Test bound API: that if lower bound is equal to the upper bound, that both bounds needs to + # have inclusive configured. + cursor.bound("action=clear") + cursor.set_key(self.gen_key(50)) + self.assertEqual(cursor.bound("bound=lower,inclusive=true"), 0) + self.assertEqual(cursor.bound("bound=upper,inclusive=true"), 0) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=lower,inclusive=false"), '/Invalid argument/') + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=upper,inclusive=false"), '/Invalid argument/') + + # Test bound API: Test that only setting one of the bound inclusive config to true, should + # fail too. + cursor.bound("action=clear") + self.assertEqual(cursor.bound("bound=lower,inclusive=false"), 0) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=upper,inclusive=false"), '/Invalid argument/') + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=upper,inclusive=true"), '/Invalid argument/') + + cursor.bound("action=clear") + self.assertEqual(cursor.bound("bound=upper,inclusive=false"), 0) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=lower,inclusive=false"), '/Invalid argument/') + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: cursor.bound("bound=lower,inclusive=true"), '/Invalid argument/') + + + def test_bound_api_reset(self): + uri = self.uri + self.file_name + create_params = 'value_format=S,key_format={}'.format(self.key_format) + if self.use_colgroup: + create_params += self.gen_colgroup_create_param() + self.session.create(uri, create_params) + # Add in column group. + if self.use_colgroup: + create_params = 'columns=(v),' + suburi = 'colgroup:{0}:g0'.format(self.file_name) + self.session.create(suburi, create_params) + cursor = self.session.open_cursor(uri) + + cursor.set_key(self.gen_key(30)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Test that cursor reset works on the lower bound. + cursor.set_key(self.gen_key(10)) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "upper"), '/Invalid argument/') + cursor.reset() + cursor.set_key(self.gen_key(10)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Test that cursor reset works on the upper bound. + cursor.set_key(self.gen_key(99)) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "lower"), '/Invalid argument/') + cursor.reset() + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + + # Test bound API: Test that cursor reset works the clearing bounds both ways. + cursor.set_key(self.gen_key(50)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.reset() + cursor.set_key(self.gen_key(20)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + cursor.set_key(self.gen_key(55)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + cursor.reset() + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Make sure that a clear and reset works sequentially. + cursor.reset() + self.assertEqual(cursor.bound("action=clear"), 0) + + cursor.set_key(self.gen_key(30)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + self.assertEqual(cursor.bound("action=clear"), 0) + cursor.reset() + + # Test bound API: Test that reset works after a reset. + cursor.set_key(self.gen_key(30)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + cursor.reset() + cursor.reset() + + def test_bound_api_clear(self): + uri = self.uri + self.file_name + create_params = 'value_format=S,key_format={}'.format(self.key_format) + if self.use_colgroup: + create_params += self.gen_colgroup_create_param() + self.session.create(uri, create_params) + # Add in column group. + if self.use_colgroup: + create_params = 'columns=(v),' + suburi = 'colgroup:{0}:g0'.format(self.file_name) + self.session.create(suburi, create_params) + cursor = self.session.open_cursor(uri) + + cursor.set_key(self.gen_key(30)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Test that clearing the lower bound works. + cursor.set_key(self.gen_key(10)) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "upper"), '/Invalid argument/') + self.assertEqual(cursor.bound("action=clear,bound=lower"), 0) + cursor.set_key(self.gen_key(10)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Test that clearing the upper bound works. + cursor.set_key(self.gen_key(99)) + self.assertRaisesWithMessage(wiredtiger.WiredTigerError, lambda: self.set_bounds(cursor, "lower"), '/Invalid argument/') + self.assertEqual(cursor.bound("action=clear,bound=upper"), 0) + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + + # Test bound API: Test that clearing both of the bounds works. + cursor.reset() + cursor.set_key(self.gen_key(50)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + self.assertEqual(cursor.bound("action=clear"), 0) + cursor.set_key(self.gen_key(90)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + cursor.reset() + cursor.set_key(self.gen_key(50)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + self.assertEqual(cursor.bound("action=clear"), 0) + cursor.set_key(self.gen_key(20)) + self.assertEqual(self.set_bounds(cursor, "lower"), 0) + cursor.set_key(self.gen_key(99)) + self.assertEqual(self.set_bounds(cursor, "upper"), 0) + + # Test bound API: Test that clear works after a clear. + self.assertEqual(cursor.bound("action=clear"), 0) + self.assertEqual(cursor.bound("action=clear"), 0) + +if __name__ == '__main__': + wttest.run() diff --git a/src/third_party/wiredtiger/test/unittest/tests/test_reconciliation_tracking.cpp b/src/third_party/wiredtiger/test/unittest/tests/test_reconciliation_tracking.cpp index 59dfebc19ba..a3461ccd814 100644 --- a/src/third_party/wiredtiger/test/unittest/tests/test_reconciliation_tracking.cpp +++ b/src/third_party/wiredtiger/test/unittest/tests/test_reconciliation_tracking.cpp @@ -37,7 +37,7 @@ TEST_CASE("Reconciliation tracking: ovfl_discard_verbose", "[reconciliation]") SECTION("handle null page and tag") { - REQUIRE(__ut_ovfl_discard_verbose(session, nullptr, nullptr, nullptr) == 0); + REQUIRE(__ut_ovfl_discard_verbose(session, nullptr, nullptr, nullptr) == EINVAL); } } diff --git a/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.cpp b/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.cpp index 81d838d7f3b..0bb79182546 100644 --- a/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.cpp +++ b/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.cpp @@ -16,7 +16,20 @@ ConnectionWrapper::ConnectionWrapper(const std::string &db_home) : _conn_impl(nullptr), _conn(nullptr), _db_home(db_home) { - utils::throwIfNonZero(mkdir(_db_home.c_str(), 0700)); + struct stat sb; + /* + * Check if the DB Home exists and is a directory, without this the mkdir can fail on some + * platforms (win). + */ + if (stat(_db_home.c_str(), &sb) == 0) { + if (!S_ISDIR(sb.st_mode)) { + std::string errorMessage("Path exists and is not a directory: " + db_home); + throw std::runtime_error(errorMessage); + } + /* We are happy that it is an existing directory. */ + } else { + utils::throwIfNonZero(mkdir(_db_home.c_str(), 0700)); + } utils::throwIfNonZero(wiredtiger_open(_db_home.c_str(), nullptr, "create", &_conn)); } diff --git a/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.h b/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.h index 1093e4465d9..c064639a903 100644 --- a/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.h +++ b/src/third_party/wiredtiger/test/unittest/tests/wrappers/connection_wrapper.h @@ -13,6 +13,10 @@ #include <string> #include "wt_internal.h" +#ifdef _WIN32 +#include "windows_shim.h" +#endif + /* * Prefer a "real" class over a mock class when you need a fully fleshed-out connection or session. * There's a speed cost to this, since it will write a bunch of files to disk during the test, which diff --git a/src/third_party/wiredtiger/test/windows/windows_shim.h b/src/third_party/wiredtiger/test/windows/windows_shim.h index 15bd2ac19dc..06b60360c69 100644 --- a/src/third_party/wiredtiger/test/windows/windows_shim.h +++ b/src/third_party/wiredtiger/test/windows/windows_shim.h @@ -44,6 +44,7 @@ * Emulate <sys/stat.h> */ #define mkdir(path, mode) _mkdir(path) +#define S_ISDIR(mode) ((mode & _S_IFDIR) == _S_IFDIR) /* * Emulate <sys/time.h> |