diff options
author | Will Korteland <will.korteland@mongodb.com> | 2022-09-08 05:18:14 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-08 05:49:29 +0000 |
commit | 3b427ac319ce0c8db3a4b1ee19465d2f8f9e827f (patch) | |
tree | ce1fcaa9bb75aa91c75fdcef2a3ea057b986f7ee /src/third_party | |
parent | 12607cc882b843f9c407733853803c3abca47567 (diff) | |
download | mongo-3b427ac319ce0c8db3a4b1ee19465d2f8f9e827f.tar.gz |
Import wiredtiger: 2537dbfc7938d44113f355000c677bc8badb2969 from branch mongodb-master
ref: fc5838e909..2537dbfc79
for: 6.2.0-rc0
WT-9143 Refactor and review existing CppSuite bounded cursor stress for improvement (#8223)
Diffstat (limited to 'src/third_party')
21 files changed, 180 insertions, 166 deletions
diff --git a/src/third_party/wiredtiger/dist/test_data.py b/src/third_party/wiredtiger/dist/test_data.py index f4f4b80d5da..41c8a625aa2 100644 --- a/src/third_party/wiredtiger/dist/test_data.py +++ b/src/third_party/wiredtiger/dist/test_data.py @@ -246,12 +246,12 @@ methods = { Config("burst_duration", 90, r''' How long the insertions will occur for.''')]), 'cache_resize' : Method(test_config), - 'cursor_bound_01' : Method(test_config), - 'cursor_bound_02' : Method(test_config + [ + 'bounded_cursor_prefix_indices' : Method(test_config), + 'bounded_cursor_prefix_search_near' : Method(test_config), + 'bounded_cursor_prefix_stat' : Method(test_config + [ Config("search_near_threads", 10, r''' Number of threads that execute search near calls.''')]), - 'cursor_bound_03' : Method(test_config), - 'cursor_bound_04' : Method(test_config), + 'bounded_cursor_stress' : Method(test_config), 'hs_cleanup' : Method(test_config), 'operations_test' : Method(test_config), 'search_near_01' : Method(test_config + [ diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index d197b197158..5d839ca8c94 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": "fc5838e9095b279533f151b03dc31ff2f3756b00" + "commit": "2537dbfc7938d44113f355000c677bc8badb2969" } diff --git a/src/third_party/wiredtiger/src/config/test_config.c b/src/third_party/wiredtiger/src/config/test_config.c index 2a57bfd0415..fe7167d5f61 100644 --- a/src/third_party/wiredtiger/src/config/test_config.c +++ b/src/third_party/wiredtiger/src/config/test_config.c @@ -114,8 +114,7 @@ static const WT_CONFIG_CHECK confchk_bounded_cursor_perf[] = { {"workload_manager", "category", NULL, NULL, confchk_workload_manager_subconfigs, 9}, {NULL, NULL, NULL, NULL, NULL, 0}}; -static const WT_CONFIG_CHECK confchk_burst_inserts[] = { - {"burst_duration", "string", NULL, NULL, NULL, 0}, +static const WT_CONFIG_CHECK confchk_bounded_cursor_prefix_indices[] = { {"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0}, {"cache_size_mb", "int", NULL, "min=0,max=100000000000", NULL, 0}, {"compression_enabled", "boolean", NULL, NULL, NULL, 0}, @@ -129,7 +128,7 @@ static const WT_CONFIG_CHECK confchk_burst_inserts[] = { {"workload_manager", "category", NULL, NULL, confchk_workload_manager_subconfigs, 9}, {NULL, NULL, NULL, NULL, NULL, 0}}; -static const WT_CONFIG_CHECK confchk_cache_resize[] = { +static const WT_CONFIG_CHECK confchk_bounded_cursor_prefix_search_near[] = { {"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0}, {"cache_size_mb", "int", NULL, "min=0,max=100000000000", NULL, 0}, {"compression_enabled", "boolean", NULL, NULL, NULL, 0}, @@ -143,7 +142,7 @@ static const WT_CONFIG_CHECK confchk_cache_resize[] = { {"workload_manager", "category", NULL, NULL, confchk_workload_manager_subconfigs, 9}, {NULL, NULL, NULL, NULL, NULL, 0}}; -static const WT_CONFIG_CHECK confchk_cursor_bound_01[] = { +static const WT_CONFIG_CHECK confchk_bounded_cursor_prefix_stat[] = { {"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0}, {"cache_size_mb", "int", NULL, "min=0,max=100000000000", NULL, 0}, {"compression_enabled", "boolean", NULL, NULL, NULL, 0}, @@ -152,12 +151,13 @@ static const WT_CONFIG_CHECK confchk_cursor_bound_01[] = { {"metrics_monitor", "category", NULL, NULL, confchk_metrics_monitor_subconfigs, 6}, {"operation_tracker", "category", NULL, NULL, confchk_operation_tracker_subconfigs, 4}, {"reverse_collator", "boolean", NULL, NULL, NULL, 0}, + {"search_near_threads", "string", NULL, NULL, NULL, 0}, {"statistics_config", "category", NULL, NULL, confchk_statistics_config_subconfigs, 2}, {"timestamp_manager", "category", NULL, NULL, confchk_timestamp_manager_subconfigs, 4}, {"workload_manager", "category", NULL, NULL, confchk_workload_manager_subconfigs, 9}, {NULL, NULL, NULL, NULL, NULL, 0}}; -static const WT_CONFIG_CHECK confchk_cursor_bound_02[] = { +static const WT_CONFIG_CHECK confchk_bounded_cursor_stress[] = { {"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0}, {"cache_size_mb", "int", NULL, "min=0,max=100000000000", NULL, 0}, {"compression_enabled", "boolean", NULL, NULL, NULL, 0}, @@ -166,13 +166,13 @@ static const WT_CONFIG_CHECK confchk_cursor_bound_02[] = { {"metrics_monitor", "category", NULL, NULL, confchk_metrics_monitor_subconfigs, 6}, {"operation_tracker", "category", NULL, NULL, confchk_operation_tracker_subconfigs, 4}, {"reverse_collator", "boolean", NULL, NULL, NULL, 0}, - {"search_near_threads", "string", NULL, NULL, NULL, 0}, {"statistics_config", "category", NULL, NULL, confchk_statistics_config_subconfigs, 2}, {"timestamp_manager", "category", NULL, NULL, confchk_timestamp_manager_subconfigs, 4}, {"workload_manager", "category", NULL, NULL, confchk_workload_manager_subconfigs, 9}, {NULL, NULL, NULL, NULL, NULL, 0}}; -static const WT_CONFIG_CHECK confchk_cursor_bound_03[] = { +static const WT_CONFIG_CHECK confchk_burst_inserts[] = { + {"burst_duration", "string", NULL, NULL, NULL, 0}, {"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0}, {"cache_size_mb", "int", NULL, "min=0,max=100000000000", NULL, 0}, {"compression_enabled", "boolean", NULL, NULL, NULL, 0}, @@ -186,7 +186,7 @@ static const WT_CONFIG_CHECK confchk_cursor_bound_03[] = { {"workload_manager", "category", NULL, NULL, confchk_workload_manager_subconfigs, 9}, {NULL, NULL, NULL, NULL, NULL, 0}}; -static const WT_CONFIG_CHECK confchk_cursor_bound_04[] = { +static const WT_CONFIG_CHECK confchk_cache_resize[] = { {"cache_max_wait_ms", "int", NULL, "min=0", NULL, 0}, {"cache_size_mb", "int", NULL, "min=0,max=100000000000", NULL, 0}, {"compression_enabled", "boolean", NULL, NULL, NULL, 0}, @@ -312,34 +312,7 @@ static const WT_CONFIG_ENTRY config_entries[] = { "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," "min=0),thread_count=0,value_size=5))", confchk_bounded_cursor_perf, 11}, - {"burst_inserts", - "burst_duration=90,cache_max_wait_ms=0,cache_size_mb=0," - "compression_enabled=false,duration_seconds=0," - "enable_logging=false,metrics_monitor=(cache_hs_insert=(max=1," - "min=0,postrun=false,runtime=false,save=false)," - "cc_pages_removed=(max=1,min=0,postrun=false,runtime=false," - "save=false),enabled=true,op_rate=1s,stat_cache_size=(max=1,min=0" - ",postrun=false,runtime=false,save=false),stat_db_size=(max=1," - "min=0,postrun=false,runtime=false,save=false))," - "operation_tracker=(enabled=true,op_rate=1s," - "tracking_key_format=QSQ,tracking_value_format=iS)," - "reverse_collator=false,statistics_config=(enable_logging=true," - "type=all),timestamp_manager=(enabled=true,oldest_lag=1," - "op_rate=1s,stable_lag=1)," - "workload_manager=(checkpoint_config=(op_rate=60s,thread_count=1)" - ",custom_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1" - ",min=0),thread_count=0,value_size=5),enabled=true," - "insert_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," - "min=0),thread_count=0,value_size=5),op_rate=1s," - "populate_config=(collection_count=1,key_count_per_collection=0," - "key_size=5,thread_count=1,value_size=5),read_config=(key_size=5," - "op_rate=1s,ops_per_transaction=(max=1,min=0),thread_count=0," - "value_size=5),remove_config=(op_rate=1s," - "ops_per_transaction=(max=1,min=0),thread_count=0)," - "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," - "min=0),thread_count=0,value_size=5))", - confchk_burst_inserts, 12}, - {"cache_resize", + {"bounded_cursor_prefix_indices", "cache_max_wait_ms=0,cache_size_mb=0,compression_enabled=false," "duration_seconds=0,enable_logging=false," "metrics_monitor=(cache_hs_insert=(max=1,min=0,postrun=false," @@ -364,8 +337,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { "ops_per_transaction=(max=1,min=0),thread_count=0)," "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," "min=0),thread_count=0,value_size=5))", - confchk_cache_resize, 11}, - {"cursor_bound_01", + confchk_bounded_cursor_prefix_indices, 11}, + {"bounded_cursor_prefix_search_near", "cache_max_wait_ms=0,cache_size_mb=0,compression_enabled=false," "duration_seconds=0,enable_logging=false," "metrics_monitor=(cache_hs_insert=(max=1,min=0,postrun=false," @@ -390,8 +363,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { "ops_per_transaction=(max=1,min=0),thread_count=0)," "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," "min=0),thread_count=0,value_size=5))", - confchk_cursor_bound_01, 11}, - {"cursor_bound_02", + confchk_bounded_cursor_prefix_search_near, 11}, + {"bounded_cursor_prefix_stat", "cache_max_wait_ms=0,cache_size_mb=0,compression_enabled=false," "duration_seconds=0,enable_logging=false," "metrics_monitor=(cache_hs_insert=(max=1,min=0,postrun=false," @@ -416,8 +389,8 @@ static const WT_CONFIG_ENTRY config_entries[] = { "remove_config=(op_rate=1s,ops_per_transaction=(max=1,min=0)," "thread_count=0),update_config=(key_size=5,op_rate=1s," "ops_per_transaction=(max=1,min=0),thread_count=0,value_size=5))", - confchk_cursor_bound_02, 12}, - {"cursor_bound_03", + confchk_bounded_cursor_prefix_stat, 12}, + {"bounded_cursor_stress", "cache_max_wait_ms=0,cache_size_mb=0,compression_enabled=false," "duration_seconds=0,enable_logging=false," "metrics_monitor=(cache_hs_insert=(max=1,min=0,postrun=false," @@ -442,8 +415,35 @@ static const WT_CONFIG_ENTRY config_entries[] = { "ops_per_transaction=(max=1,min=0),thread_count=0)," "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," "min=0),thread_count=0,value_size=5))", - confchk_cursor_bound_03, 11}, - {"cursor_bound_04", + confchk_bounded_cursor_stress, 11}, + {"burst_inserts", + "burst_duration=90,cache_max_wait_ms=0,cache_size_mb=0," + "compression_enabled=false,duration_seconds=0," + "enable_logging=false,metrics_monitor=(cache_hs_insert=(max=1," + "min=0,postrun=false,runtime=false,save=false)," + "cc_pages_removed=(max=1,min=0,postrun=false,runtime=false," + "save=false),enabled=true,op_rate=1s,stat_cache_size=(max=1,min=0" + ",postrun=false,runtime=false,save=false),stat_db_size=(max=1," + "min=0,postrun=false,runtime=false,save=false))," + "operation_tracker=(enabled=true,op_rate=1s," + "tracking_key_format=QSQ,tracking_value_format=iS)," + "reverse_collator=false,statistics_config=(enable_logging=true," + "type=all),timestamp_manager=(enabled=true,oldest_lag=1," + "op_rate=1s,stable_lag=1)," + "workload_manager=(checkpoint_config=(op_rate=60s,thread_count=1)" + ",custom_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1" + ",min=0),thread_count=0,value_size=5),enabled=true," + "insert_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," + "min=0),thread_count=0,value_size=5),op_rate=1s," + "populate_config=(collection_count=1,key_count_per_collection=0," + "key_size=5,thread_count=1,value_size=5),read_config=(key_size=5," + "op_rate=1s,ops_per_transaction=(max=1,min=0),thread_count=0," + "value_size=5),remove_config=(op_rate=1s," + "ops_per_transaction=(max=1,min=0),thread_count=0)," + "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," + "min=0),thread_count=0,value_size=5))", + confchk_burst_inserts, 12}, + {"cache_resize", "cache_max_wait_ms=0,cache_size_mb=0,compression_enabled=false," "duration_seconds=0,enable_logging=false," "metrics_monitor=(cache_hs_insert=(max=1,min=0,postrun=false," @@ -468,7 +468,7 @@ static const WT_CONFIG_ENTRY config_entries[] = { "ops_per_transaction=(max=1,min=0),thread_count=0)," "update_config=(key_size=5,op_rate=1s,ops_per_transaction=(max=1," "min=0),thread_count=0,value_size=5))", - confchk_cursor_bound_04, 11}, + confchk_cache_resize, 11}, {"hs_cleanup", "cache_max_wait_ms=0,cache_size_mb=0,compression_enabled=false," "duration_seconds=0,enable_logging=false," diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_04_default.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_indices_default.txt index c6dbcb8534c..c6dbcb8534c 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_04_default.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_indices_default.txt diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_04_stress.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_indices_stress.txt index df4cb3d4d7d..df4cb3d4d7d 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_04_stress.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_indices_stress.txt diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_03_default.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_search_near_default.txt index 7115f00631f..7115f00631f 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_03_default.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_search_near_default.txt diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_03_stress.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_search_near_stress.txt index c344a820ce2..c344a820ce2 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_03_stress.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_search_near_stress.txt diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_02_default.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_stat_default.txt index 23dd7b5c9bb..49c95682df0 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_02_default.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_stat_default.txt @@ -1,4 +1,4 @@ -# Configuration for cursor_bound_02. +# Configuration for bounded_cursor_prefix_stat. # The test will generate key_count_per_collection number of keys for each prefix in aaa -> zzz. # This config will have a 3 minute duration, with 3 tables of an entry for each prefix. # diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_02_stress.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_stat_stress.txt index 77a48670311..9a1cd3b9ec6 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_02_stress.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_prefix_stat_stress.txt @@ -1,4 +1,4 @@ -# Configuration for cursor_bound_02 stress test. +# Configuration for bounded_cursor_prefix_stat stress test. # The test will generate key_count_per_collection number of keys for each prefix in aaa -> zzz. # This config will have a 30 minute duration, with 3 tables of an entry for each prefix. # diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_default.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_default.txt index 8115781804d..f9c75559a7b 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_default.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_default.txt @@ -1,4 +1,4 @@ -# Configuration for cursor_bound_01 default test. +# Configuration for bounded_cursor_stress default test. duration_seconds=60, cache_size_mb=100, reverse_collator=false, diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_reverse_default.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_reverse_default.txt index 26ca8ff3b2f..04d37034e34 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_reverse_default.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_reverse_default.txt @@ -1,4 +1,4 @@ -# Configuration for cursor_bound_01 default test. +# Configuration for bounded_cursor_stress default test. # There are two configurations, one which specifies a reverse collator and one which doesn't. duration_seconds=60, cache_size_mb=100, diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_reverse_stress.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_reverse_stress.txt index 8fea5b21b50..e43e007e0d1 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_reverse_stress.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_reverse_stress.txt @@ -1,4 +1,4 @@ -# Stressful configuration for the cursor_bound_01 test. +# Stressful configuration for the bounded_cursor_stress test. duration_seconds=3600, cache_size_mb=1500, reverse_collator=true, diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_stress.txt b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_stress.txt index 1491b22d126..b906eb740b6 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cursor_bound_01_stress.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/bounded_cursor_stress_stress.txt @@ -1,6 +1,6 @@ -# Stressful configuration for the cursor_bound_01 test. +# Stressful configuration for the bounded_cursor_stress test. duration_seconds=3600, -cache_size_mb=1500, +cache_size_mb=900, reverse_collator=false, timestamp_manager= ( @@ -22,8 +22,8 @@ workload_manager= insert_config= ( key_size=100, - op_rate=100ms, - thread_count=10, + op_rate=10ms, + thread_count=15, value_size=1000000, ops_per_transaction=(max=20,min=0) ), @@ -42,7 +42,7 @@ workload_manager= #100MB/s update rate update_config= ( - op_rate=100ms, + op_rate=10ms, thread_count=10, value_size=1000000, ops_per_transaction=(max=20,min=0) diff --git a/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.cpp b/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.cpp index 3296b23d325..a128ea7bf50 100644 --- a/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.cpp @@ -32,6 +32,10 @@ #include "src/common/constants.h" #include "src/common/random_generator.h" +extern "C" { +#include "test_util.h" +} + namespace test_harness { bound::bound() { @@ -76,6 +80,13 @@ bound::get_inclusive() const } void +bound::apply(scoped_cursor &cursor) const +{ + cursor->set_key(cursor.get(), _key.c_str()); + testutil_check(cursor->bound(cursor.get(), get_config().c_str())); +} + +void bound::clear() { _key.clear(); diff --git a/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.h b/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.h index 8ba4fa15f8c..2aff6ff9d92 100644 --- a/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/bound/bound.h @@ -28,6 +28,8 @@ #pragma once #include <string> +#include "src/storage/scoped_cursor.h" + namespace test_harness { class bound { public: @@ -42,6 +44,7 @@ class bound { bool get_inclusive() const; void clear(); + void apply(scoped_cursor &cursor) const; private: std::string _key; diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_04.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_prefix_indices.cpp index 9609135b7bd..f92fef5c91a 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_04.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_prefix_indices.cpp @@ -42,13 +42,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 cursor_bound_04 : public test { +class bounded_cursor_prefix_indices : 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: - cursor_bound_04(const test_args &args) : test(args) + bounded_cursor_prefix_indices(const test_args &args) : test(args) { init_operation_tracker(); } diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_03.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_prefix_search_near.cpp index a610467217d..97df8e52bf6 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_03.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_prefix_search_near.cpp @@ -41,9 +41,9 @@ using namespace test_harness; * - M threads will execute search_near calls with bounds enabled using random prefixes as well. * Each search_near call with bounds enabled is verified using the default search_near. */ -class cursor_bound_03 : public test { +class bounded_cursor_prefix_search_near : public test { public: - cursor_bound_03(const test_args &args) : test(args) + bounded_cursor_prefix_search_near(const test_args &args) : test(args) { init_operation_tracker(); } diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_02.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_prefix_stat.cpp index 7173f2d5736..b6eb49dbda7 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_02.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_prefix_stat.cpp @@ -44,7 +44,7 @@ using namespace test_harness; * - Using WiredTiger statistics to validate that the number of entries traversed is within * bounds of the search key. */ -class cursor_bound_02 : public test { +class bounded_cursor_prefix_stat : public test { uint64_t keys_per_prefix = 0; uint64_t srchkey_len = 0; const std::string ALPHABET{"abcdefghijklmnopqrstuvwxyz"}; @@ -103,7 +103,7 @@ class cursor_bound_02 : public test { } public: - cursor_bound_02(const test_args &args) : test(args) + bounded_cursor_prefix_stat(const test_args &args) : test(args) { init_operation_tracker(); } diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_stress.cpp index 1fdbd758fa3..1b561d0ca63 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cursor_bound_01.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/bounded_cursor_stress.cpp @@ -26,6 +26,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "src/bound/bound_set.h" #include "src/common/constants.h" #include "src/common/random_generator.h" #include "src/bound/bound.h" @@ -46,7 +47,7 @@ using namespace test_harness; * random bounds set. Both next() and prev() calls with bounds set is verified against the * default cursor next() and prev() calls. */ -class cursor_bound_01 : public test { +class bounded_cursor_stress : public test { /* Class helper to represent the lower and uppers bounds for the range cursor. */ private: bool _reverse_collator_enabled = false; @@ -54,7 +55,7 @@ class cursor_bound_01 : public test { enum class bound_action { NO_BOUNDS, LOWER_BOUND_SET, UPPER_BOUND_SET, ALL_BOUNDS_SET }; public: - cursor_bound_01(const test_args &args) : test(args) + bounded_cursor_stress(const test_args &args) : test(args) { /* Track reverse_collator value as it is required for the custom comparator. */ _reverse_collator_enabled = _config->get_bool(REVERSE_COLLATOR); @@ -82,7 +83,7 @@ class cursor_bound_01 : public test { * bound and upper bound checks while walking the tree. */ void - cursor_traversal(scoped_cursor &range_cursor, scoped_cursor &normal_cursor, + cursor_traversal(scoped_cursor &bounded_cursor, scoped_cursor &normal_cursor, const bound &lower_bound, const bound &upper_bound, bool next) { int exact, normal_ret, range_ret; @@ -91,7 +92,7 @@ class cursor_bound_01 : public test { auto lower_key = lower_bound.get_key(); auto upper_key = upper_bound.get_key(); if (next) { - range_ret = range_cursor->next(range_cursor.get()); + range_ret = bounded_cursor->next(bounded_cursor.get()); /* * If the key exists, position the cursor to the lower key using search near otherwise * use prev(). @@ -106,7 +107,7 @@ class cursor_bound_01 : public test { } else normal_ret = normal_cursor->next(normal_cursor.get()); } else { - range_ret = range_cursor->prev(range_cursor.get()); + range_ret = bounded_cursor->prev(bounded_cursor.get()); /* * If the key exists, position the cursor to the upper key using search near otherwise * use next(). @@ -147,15 +148,15 @@ class cursor_bound_01 : public test { /* Retrieve the key the cursor is pointing at. */ const char *range_key; testutil_check(normal_cursor->get_key(normal_cursor.get(), &normal_key)); - testutil_check(range_cursor->get_key(range_cursor.get(), &range_key)); + testutil_check(bounded_cursor->get_key(bounded_cursor.get(), &range_key)); testutil_assert(std::string(normal_key).compare(range_key) == 0); while (true) { if (next) { normal_ret = normal_cursor->next(normal_cursor.get()); - range_ret = range_cursor->next(range_cursor.get()); + range_ret = bounded_cursor->next(bounded_cursor.get()); } else { normal_ret = normal_cursor->prev(normal_cursor.get()); - range_ret = range_cursor->prev(range_cursor.get()); + range_ret = bounded_cursor->prev(bounded_cursor.get()); } if (normal_ret == WT_ROLLBACK || range_ret == WT_ROLLBACK) @@ -182,7 +183,7 @@ class cursor_bound_01 : public test { } /* Make sure that records match between both cursors. */ testutil_check(normal_cursor->get_key(normal_cursor.get(), &normal_key)); - testutil_check(range_cursor->get_key(range_cursor.get(), &range_key)); + testutil_check(bounded_cursor->get_key(bounded_cursor.get(), &range_key)); testutil_assert(std::string(normal_key).compare(range_key) == 0); if (next && !upper_key.empty()) testutil_assert(custom_lexicographical_compare( @@ -198,43 +199,39 @@ class cursor_bound_01 : public test { * bounds on the range cursor. The lower and upper bounds are randomly generated strings and the * inclusive configuration is also randomly set as well. */ - std::pair<bound, bound> - set_random_bounds(thread_worker *tc, scoped_cursor &range_cursor) + bound_set + set_random_bounds(thread_worker *tc, scoped_cursor &bounded_cursor) { bound lower_bound, upper_bound; - testutil_check(range_cursor->reset(range_cursor.get())); + testutil_check(bounded_cursor->reset(bounded_cursor.get())); bound_action action = static_cast<bound_action>(random_generator::instance().generate_integer(0, 3)); if (action == bound_action::NO_BOUNDS) - testutil_check(range_cursor->bound(range_cursor.get(), "action=clear")); + testutil_check(bounded_cursor->bound(bounded_cursor.get(), "action=clear")); - if (action == bound_action::LOWER_BOUND_SET || action == bound_action::ALL_BOUNDS_SET) { + if (action == bound_action::LOWER_BOUND_SET || action == bound_action::ALL_BOUNDS_SET) lower_bound = bound(tc->key_size, true); - range_cursor->set_key(range_cursor.get(), lower_bound.get_key().c_str()); - testutil_check( - range_cursor->bound(range_cursor.get(), lower_bound.get_config().c_str())); - } if (action == bound_action::UPPER_BOUND_SET || action == bound_action::ALL_BOUNDS_SET) { if (action == bound_action::ALL_BOUNDS_SET) { /* Ensure that the lower and upper bounds are never overlapping. */ - if (_reverse_collator_enabled) - upper_bound = bound(tc->key_size, false, lower_bound.get_key()[0] - 1); - else - upper_bound = bound(tc->key_size, false, lower_bound.get_key()[0] + 1); + auto diff = _reverse_collator_enabled ? -1 : 1; + upper_bound = bound(tc->key_size, false, lower_bound.get_key()[0] + diff); } else upper_bound = bound(tc->key_size, false); - range_cursor->set_key(range_cursor.get(), upper_bound.get_key().c_str()); - testutil_check( - range_cursor->bound(range_cursor.get(), upper_bound.get_config().c_str())); } if (action == bound_action::ALL_BOUNDS_SET) testutil_assert( custom_lexicographical_compare(lower_bound.get_key(), upper_bound.get_key(), false)); - return std::make_pair(lower_bound, upper_bound); + if (!lower_bound.get_key().empty()) + lower_bound.apply(bounded_cursor); + if (!upper_bound.get_key().empty()) + upper_bound.apply(bounded_cursor); + + return bound_set(lower_bound, upper_bound); } /* @@ -245,16 +242,18 @@ class cursor_bound_01 : public test { * key or with WT_NOTFOUND. */ void - validate_bound_search(int range_ret, scoped_cursor &range_cursor, const std::string &search_key, - const bound &lower_bound, const bound &upper_bound) + validate_bound_search(int range_ret, scoped_cursor &bounded_cursor, + const std::string &search_key, const bound_set &bounds) { + auto lower_bound = bounds.get_lower(); + auto upper_bound = bounds.get_upper(); auto lower_key = lower_bound.get_key(); auto upper_key = upper_bound.get_key(); auto lower_inclusive = lower_bound.get_inclusive(); auto upper_inclusive = upper_bound.get_inclusive(); const char *key; - testutil_check(range_cursor->get_key(range_cursor.get(), &key)); + testutil_check(bounded_cursor->get_key(bounded_cursor.get(), &key)); logger::log_msg(LOG_TRACE, "bounded search found key: " + std::string(key) + " with lower bound: " + lower_key + " upper bound: " + upper_key); @@ -296,10 +295,11 @@ class cursor_bound_01 : public test { * valid key or with WT_NOTFOUND. */ void - validate_bound_search_near(int range_ret, int range_exact, scoped_cursor &range_cursor, - scoped_cursor &normal_cursor, const std::string &search_key, const bound &lower_bound, - const bound &upper_bound) + validate_bound_search_near(int range_ret, int range_exact, scoped_cursor &bounded_cursor, + scoped_cursor &normal_cursor, const std::string &search_key, const bound_set &bounds) { + auto lower_bound = bounds.get_lower(); + auto upper_bound = bounds.get_upper(); /* Range cursor has successfully returned with a key. */ if (range_ret == 0) { auto lower_key = lower_bound.get_key(); @@ -308,7 +308,7 @@ class cursor_bound_01 : public test { auto upper_inclusive = upper_bound.get_inclusive(); const char *key; - testutil_check(range_cursor->get_key(range_cursor.get(), &key)); + testutil_check(bounded_cursor->get_key(bounded_cursor.get(), &key)); logger::log_msg(LOG_TRACE, "bounded search_near found key: " + std::string(key) + " with lower bound: " + lower_key + " upper bound: " + upper_key); @@ -619,8 +619,8 @@ class cursor_bound_01 : public test { cursors.emplace(coll.id, std::move(tc->session.open_scoped_cursor(coll.name))); /* Set random bounds on cached range cursor. */ - auto &range_cursor = cursors[coll.id]; - auto bound_pair = set_random_bounds(tc, range_cursor); + auto &bounded_cursor = cursors[coll.id]; + auto bound_pair = set_random_bounds(tc, bounded_cursor); scoped_cursor normal_cursor = tc->session.open_scoped_cursor(coll.name); wt_timestamp_t ts = tc->tsm->get_valid_read_ts(); @@ -638,15 +638,15 @@ class cursor_bound_01 : public test { key_size, characters_type::ALPHABET); int exact = 0; - range_cursor->set_key(range_cursor.get(), srch_key.c_str()); - auto ret = range_cursor->search_near(range_cursor.get(), &exact); + bounded_cursor->set_key(bounded_cursor.get(), srch_key.c_str()); + auto ret = bounded_cursor->search_near(bounded_cursor.get(), &exact); testutil_assert(ret == 0 || ret == WT_NOTFOUND || ret == WT_ROLLBACK); if (ret == WT_ROLLBACK) continue; /* Verify the bound search_near result using the normal cursor. */ - validate_bound_search_near(ret, exact, range_cursor, normal_cursor, srch_key, - bound_pair.first, bound_pair.second); + validate_bound_search_near( + ret, exact, bounded_cursor, normal_cursor, srch_key, bound_pair); /* * If search near was successful, use the key it's currently positioned on as the @@ -654,20 +654,19 @@ class cursor_bound_01 : public test { */ if (ret == 0) { const char *range_srch_key; - testutil_check(range_cursor->get_key(range_cursor.get(), &range_srch_key)); + testutil_check(bounded_cursor->get_key(bounded_cursor.get(), &range_srch_key)); /* * Take a copy of the range search key as it the buffer returned by WiredTiger * won't be valid after the call to set_key. */ std::string range_key_copy(range_srch_key); - range_cursor->set_key(range_cursor.get(), range_key_copy.c_str()); - ret = range_cursor->search(range_cursor.get()); + bounded_cursor->set_key(bounded_cursor.get(), range_key_copy.c_str()); + ret = bounded_cursor->search(bounded_cursor.get()); testutil_assert(ret == 0 || ret == WT_NOTFOUND || ret == WT_ROLLBACK); if (ret == WT_ROLLBACK) continue; - validate_bound_search( - ret, range_cursor, range_key_copy, bound_pair.first, bound_pair.second); + validate_bound_search(ret, bounded_cursor, range_key_copy, bound_pair); } tc->txn.add_op(); @@ -675,7 +674,7 @@ class cursor_bound_01 : public test { tc->txn.commit(); tc->sleep(); } - range_cursor->reset(range_cursor.get()); + bounded_cursor->reset(bounded_cursor.get()); normal_cursor->reset(normal_cursor.get()); } /* Roll back the last transaction if still active now the work is finished. */ @@ -703,8 +702,8 @@ class cursor_bound_01 : public test { cursors.emplace(coll.id, std::move(tc->session.open_scoped_cursor(coll.name))); /* Set random bounds on cached range cursor. */ - auto &range_cursor = cursors[coll.id]; - auto bound_pair = set_random_bounds(tc, range_cursor); + auto &bounded_cursor = cursors[coll.id]; + auto bound_pair = set_random_bounds(tc, bounded_cursor); scoped_cursor normal_cursor = tc->session.open_scoped_cursor(coll.name); wt_timestamp_t ts = tc->tsm->get_valid_read_ts(); @@ -715,11 +714,11 @@ class cursor_bound_01 : public test { tc->txn.begin( "roundup_timestamps=(read=true),read_timestamp=" + tc->tsm->decimal_to_hex(ts)); while (tc->txn.active() && tc->running()) { - cursor_traversal( - range_cursor, normal_cursor, bound_pair.first, bound_pair.second, true); + cursor_traversal(bounded_cursor, normal_cursor, bound_pair.get_lower(), + bound_pair.get_upper(), true); testutil_check(normal_cursor->reset(normal_cursor.get())); - cursor_traversal( - range_cursor, normal_cursor, bound_pair.first, bound_pair.second, false); + cursor_traversal(bounded_cursor, normal_cursor, bound_pair.get_lower(), + bound_pair.get_upper(), false); tc->txn.add_op(); tc->txn.try_rollback(); tc->sleep(); diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp index b6f869e35ea..404ed04b7af 100755 --- a/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/run.cpp @@ -36,10 +36,10 @@ #include "bounded_cursor_perf.cpp" #include "burst_inserts.cpp" #include "cache_resize.cpp" -#include "cursor_bound_01.cpp" -#include "cursor_bound_02.cpp" -#include "cursor_bound_03.cpp" -#include "cursor_bound_04.cpp" +#include "bounded_cursor_stress.cpp" +#include "bounded_cursor_prefix_stat.cpp" +#include "bounded_cursor_prefix_search_near.cpp" +#include "bounded_cursor_prefix_indices.cpp" #include "hs_cleanup.cpp" #include "operations_test.cpp" #include "search_near_01.cpp" @@ -136,14 +136,14 @@ run_test(const std::string &test_name, const std::string &config, const std::str burst_inserts(args).run(); else if (test_name == "cache_resize") cache_resize(args).run(); - else if (test_name == "cursor_bound_01") - cursor_bound_01(args).run(); - else if (test_name == "cursor_bound_02") - cursor_bound_02(args).run(); - else if (test_name == "cursor_bound_03") - cursor_bound_03(args).run(); - else if (test_name == "cursor_bound_04") - cursor_bound_04(args).run(); + else if (test_name == "bounded_cursor_prefix_indices") + bounded_cursor_prefix_indices(args).run(); + else if (test_name == "bounded_cursor_prefix_search_near") + bounded_cursor_prefix_search_near(args).run(); + else if (test_name == "bounded_cursor_prefix_stat") + bounded_cursor_prefix_stat(args).run(); + else if (test_name == "bounded_cursor_stress") + bounded_cursor_stress(args).run(); else if (test_name == "hs_cleanup") hs_cleanup(args).run(); else if (test_name == "operations_test") @@ -178,8 +178,9 @@ main(int argc, char *argv[]) { std::string cfg, config_filename, current_cfg, current_test_name, test_name, wt_open_config; int64_t error_code = 0; - const std::vector<std::string> all_tests = {"bounded_cursor_perf", "burst_inserts", - "cache_resize", "cursor_bound_01", "cursor_bound_02", "cursor_bound_03", "cursor_bound_04", + const std::vector<std::string> all_tests = {"bounded_cursor_perf", + "bounded_cursor_prefix_indices", "bounded_cursor_prefix_search_near", + "bounded_cursor_prefix_stat", "bounded_cursor_stress", "burst_inserts", "cache_resize", "hs_cleanup", "operations_test", "search_near_01", "search_near_02", "search_near_03", "test_template"}; diff --git a/src/third_party/wiredtiger/test/evergreen.yml b/src/third_party/wiredtiger/test/evergreen.yml index 1e37663bc6e..8f6eec56d71 100755 --- a/src/third_party/wiredtiger/test/evergreen.yml +++ b/src/third_party/wiredtiger/test/evergreen.yml @@ -1245,7 +1245,7 @@ tasks: test_config_filename: configs/bounded_cursor_perf_default.txt test_name: bounded_cursor_perf - - name: cppsuite-cursor-bound-01-default + - name: cppsuite-bounded-cursor-stress-default tags: ["pull_request"] depends_on: - name: compile @@ -1254,10 +1254,10 @@ tasks: - func: "cppsuite test" vars: test_config: debug_mode=(cursor_copy=true) - test_config_filename: configs/cursor_bound_01_default.txt - test_name: cursor_bound_01 + test_config_filename: configs/bounded_cursor_stress_default.txt + test_name: bounded_cursor_stress - - name: cppsuite-cursor-bound-01-reverse-default + - name: cppsuite-bounded-cursor-stress-reverse-default tags: ["pull_request"] depends_on: - name: compile @@ -1266,10 +1266,10 @@ tasks: - func: "cppsuite test" vars: test_config: debug_mode=(cursor_copy=true) - test_config_filename: configs/cursor_bound_01_reverse_default.txt - test_name: cursor_bound_01 + test_config_filename: configs/bounded_cursor_stress_reverse_default.txt + test_name: bounded_cursor_stress - - name: cppsuite-cursor-bound-02-default + - name: cppsuite-bounded-cursor-prefix-stat-default tags: ["pull_request"] depends_on: - name: compile @@ -1278,10 +1278,10 @@ tasks: - func: "cppsuite test" vars: test_config: debug_mode=(cursor_copy=true) - test_config_filename: configs/cursor_bound_02_default.txt - test_name: cursor_bound_02 + test_config_filename: configs/bounded_cursor_prefix_stat_default.txt + test_name: bounded_cursor_prefix_stat - - name: cppsuite-cursor-bound-03-default + - name: bounded-cursor-prefix-search-near-default tags: ["pull_request"] depends_on: - name: compile @@ -1290,10 +1290,10 @@ tasks: - func: "cppsuite test" vars: test_config: debug_mode=(cursor_copy=true) - test_config_filename: configs/cursor_bound_03_default.txt - test_name: cursor_bound_03 + test_config_filename: configs/bounded_cursor_prefix_search_near_default.txt + test_name: bounded_cursor_prefix_search_near - - name: cppsuite-cursor-bound-04-default + - name: bounded-cursor-prefix-indices-default tags: ["pull_request"] depends_on: - name: compile @@ -1302,8 +1302,8 @@ tasks: - func: "cppsuite test" vars: test_config: debug_mode=(cursor_copy=true) - test_config_filename: configs/cursor_bound_04_default.txt - test_name: cursor_bound_04 + test_config_filename: configs/bounded_cursor_prefix_indices_default.txt + test_name: bounded_cursor_prefix_indices - name: cppsuite-operations-test-stress depends_on: @@ -1335,55 +1335,55 @@ tasks: test_config_filename: configs/burst_inserts_stress.txt test_name: burst_inserts - - name: cppsuite-cursor-bound-01-stress + - name: cppsuite-bounded-cursor-stress-stress depends_on: - name: compile commands: - func: "fetch artifacts" - func: "cppsuite test" vars: - test_config_filename: configs/cursor_bound_01_stress.txt - test_name: cursor_bound_01 + test_config_filename: configs/bounded_cursor_stress_stress.txt + test_name: bounded_cursor_stress - - name: cppsuite-cursor-bound-01-reverse-stress + - name: cppsuite-bounded-cursor-stress-reverse-stress depends_on: - name: compile commands: - func: "fetch artifacts" - func: "cppsuite test" vars: - test_config_filename: configs/cursor_bound_01_reverse_stress.txt - test_name: cursor_bound_01 + test_config_filename: configs/bounded_cursor_stress_reverse_stress.txt + test_name: bounded_cursor_stress - - name: cppsuite-cursor-bound-02-stress + - name: cppsuite-bounded-cursor-prefix-stat-stress depends_on: - name: compile commands: - func: "fetch artifacts" - func: "cppsuite test" vars: - test_config_filename: configs/cursor_bound_02_stress.txt - test_name: cursor_bound_02 + test_config_filename: configs/bounded_cursor_prefix_stat_stress.txt + test_name: bounded_cursor_prefix_stat - - name: cppsuite-cursor-bound-03-stress + - name: cppsuite-bounded-cursor-prefix-search-near-stress depends_on: - name: compile commands: - func: "fetch artifacts" - func: "cppsuite test" vars: - test_config_filename: configs/cursor_bound_03_stress.txt - test_name: cursor_bound_03 + test_config_filename: configs/bounded_cursor_prefix_search_near_stress.txt + test_name: bounded_cursor_prefix_search_near - - name: cppsuite-cursor-bound-04-stress + - name: cppsuite-bounded-cursor-prefix-indices-stress depends_on: - name: compile commands: - func: "fetch artifacts" - func: "cppsuite test" vars: - test_config_filename: configs/cursor_bound_04_stress.txt - test_name: cursor_bound_04 + test_config_filename: configs/bounded_cursor_prefix_indices_stress.txt + test_name: bounded_cursor_prefix_indices - name: cppsuite-search-near-01-stress depends_on: @@ -4266,11 +4266,11 @@ buildvariants: - name: compile - name: cppsuite-operations-test-stress - name: cppsuite-burst-inserts-stress - - name: cppsuite-cursor-bound-01-stress - - name: cppsuite-cursor-bound-01-reverse-stress - - name: cppsuite-cursor-bound-02-stress - - name: cppsuite-cursor-bound-03-stress - - name: cppsuite-cursor-bound-04-stress + - name: cppsuite-bounded-cursor-prefix-indices-stress + - name: cppsuite-bounded-cursor-prefix-search-near-stress + - name: cppsuite-bounded-cursor-prefix-stat-stress + - name: cppsuite-bounded-cursor-stress-reverse-stress + - name: cppsuite-bounded-cursor-stress-stress - name: cppsuite-hs-cleanup-stress - name: cppsuite-search-near-01-stress - name: cppsuite-search-near-02-stress |