Skip to content

Commit 74956f1

Browse files
ruby-oujoEvergreen Agent
authored andcommitted
Import wiredtiger: 3c4bad55a5e5ea77a5547381f777757349375e2a from branch mongodb-master
ref: a9c02719fb..3c4bad55a5 for: 7.2.0-rc0 WT-11346 Create cppsuite test for background compaction
1 parent f4caafc commit 74956f1

File tree

12 files changed

+944
-340
lines changed

12 files changed

+944
-340
lines changed

src/third_party/wiredtiger/dist/test_data.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def __ge__(self, other):
126126
The rate at which checkpoint is executed.''')
127127
]
128128

129-
background_compact_thread_config = [
129+
background_compact_thread_config = throttle_config + [
130130
Config('thread_count', 0, r'''
131131
Specifies the number of threads that will be used to perform background compaction
132132
operation.''',
@@ -228,6 +228,9 @@ def __ge__(self, other):
228228
type='category', subconfig=operation_tracker),
229229

230230
# Non component top level configuration.
231+
Config('background_compact_debug_mode', 'false', r'''
232+
If true, background compact aggressively removes compact statistics for a file and decreases
233+
the max amount of time a file can be skipped for.''', type='boolean'),
231234
Config('cache_max_wait_ms', 0, r'''
232235
The strict equivalent of cache_max_wait_ms defined in wiredtiger.''', min=0),
233236
Config('cache_size_mb', 0, r'''
@@ -258,6 +261,7 @@ def __ge__(self, other):
258261
# Test and their respective configuration sorted alphabetically.
259262
#
260263
methods = {
264+
'background_compact' : Method(test_config),
261265
'bounded_cursor_perf' : Method(test_config),
262266
'bounded_cursor_prefix_indices' : Method(test_config),
263267
'bounded_cursor_prefix_search_near' : Method(test_config),

src/third_party/wiredtiger/import.data

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"vendor": "wiredtiger",
33
"github": "wiredtiger/wiredtiger.git",
44
"branch": "mongodb-master",
5-
"commit": "a9c02719fbef960e017ab03e789f6a947aaee5c1"
5+
"commit": "3c4bad55a5e5ea77a5547381f777757349375e2a"
66
}

src/third_party/wiredtiger/src/config/test_config.c

Lines changed: 439 additions & 328 deletions
Large diffs are not rendered by default.

src/third_party/wiredtiger/src/conn/conn_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2090,7 +2090,7 @@ __debug_mode_background_compact_config(WT_SESSION_IMPL *session, const char *cfg
20902090
conn->background_compact.full_iteration_wait_time = WT_BACKGROUND_COMPACT_WAIT_TIME_DEBUG;
20912091
} else {
20922092
conn->background_compact.max_file_idle_time = WT_BACKGROUND_COMPACT_MAX_IDLE_TIME;
2093-
conn->background_compact.max_file_skip_time = 60 * WT_BACKGROUND_COMPACT_MAX_SKIP_TIME;
2093+
conn->background_compact.max_file_skip_time = WT_BACKGROUND_COMPACT_MAX_SKIP_TIME;
20942094
conn->background_compact.full_iteration_wait_time = WT_BACKGROUND_COMPACT_WAIT_TIME;
20952095
}
20962096

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Configuration for background_compact.
2+
background_compact_debug_mode=true,
3+
cache_size_mb=10000,
4+
duration_seconds=30,
5+
# We don't need to validate anything with the default config.
6+
validate=false,
7+
workload_manager=
8+
(
9+
populate_config=
10+
(
11+
collection_count=3,
12+
key_count_per_collection=1000000,
13+
thread_count=3,
14+
key_size=10,
15+
value_size=1000
16+
),
17+
insert_config=
18+
(
19+
thread_count=3,
20+
op_rate=10ms,
21+
ops_per_transaction=(min=5,max=20),
22+
key_size=10,
23+
value_size=1000
24+
),
25+
remove_config=
26+
(
27+
op_rate=2s,
28+
ops_per_transaction=(max=1,min=0),
29+
thread_count=1
30+
),
31+
# Set the length of the maintenance window period.
32+
custom_config=
33+
(
34+
op_rate=10s,
35+
thread_count=1
36+
),
37+
background_compact_config=
38+
(
39+
thread_count=1,
40+
free_space_target_mb=1,
41+
op_rate=60s
42+
),
43+
checkpoint_config=
44+
(
45+
op_rate=5s,
46+
)
47+
),
48+
operation_tracker=
49+
(
50+
enabled=false,
51+
)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Configuration for background_compact.
2+
duration_seconds=7200,
3+
cache_size_mb=10000,
4+
workload_manager=
5+
(
6+
populate_config=
7+
(
8+
collection_count=100,
9+
key_count_per_collection=1000000,
10+
thread_count=10,
11+
key_size=10,
12+
value_size=1000
13+
),
14+
insert_config=
15+
(
16+
thread_count=50,
17+
op_rate=10ms,
18+
ops_per_transaction=(min=5,max=20),
19+
key_size=10,
20+
value_size=1000
21+
),
22+
remove_config=
23+
(
24+
op_rate=1s,
25+
ops_per_transaction=( max=1,min=0),
26+
thread_count=1
27+
),
28+
custom_config=
29+
(
30+
op_rate=600s,
31+
thread_count=1
32+
),
33+
background_compact_config=
34+
(
35+
thread_count=1,
36+
free_space_target_mb=1,
37+
op_rate=1200s
38+
),
39+
checkpoint_config=
40+
(
41+
op_rate=60s,
42+
)
43+
),
44+
operation_tracker=
45+
(
46+
enabled=false,
47+
)

src/third_party/wiredtiger/test/cppsuite/src/common/constants.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@
3232
namespace test_harness {
3333

3434
/* Component names. */
35-
const std::string OPERATION_TRACKER = "operation_tracker";
3635
const std::string METRICS_MONITOR = "metrics_monitor";
36+
const std::string OPERATION_TRACKER = "operation_tracker";
3737
const std::string TIMESTAMP_MANAGER = "timestamp_manager";
3838
const std::string WORKLOAD_MANAGER = "workload_manager";
3939

4040
/* Configuration API consts. */
41+
const std::string BACKGROUND_COMPACT_DEBUG_MODE = "background_compact_debug_mode";
4142
const std::string BACKGROUND_COMPACT_OP_CONFIG = "background_compact_config";
4243
const std::string CACHE_HS_INSERT = "cache_hs_insert";
4344
const std::string CACHE_MAX_WAIT_MS = "cache_max_wait_ms";
4445
const std::string CACHE_SIZE_MB = "cache_size_mb";
4546
const std::string CC_PAGES_REMOVED = "cc_pages_removed";
46-
const std::string COLLECTION_COUNT = "collection_count";
4747
const std::string CHECKPOINT_OP_CONFIG = "checkpoint_config";
48+
const std::string COLLECTION_COUNT = "collection_count";
4849
const std::string COMPRESSION_ENABLED = "compression_enabled";
4950
const std::string CUSTOM_OP_CONFIG = "custom_config";
5051
const std::string DURATION_SECONDS = "duration_seconds";
@@ -88,8 +89,8 @@ const std::string STATISTICS_LOG = "statistics_log=(json,wait=1)";
8889

8990
/* Test harness consts. */
9091
const std::string DEFAULT_FRAMEWORK_SCHEMA = "key_format=S,value_format=S,";
92+
const std::string STATISTICS_URI = "statistics:";
9193
const std::string TABLE_OPERATION_TRACKING = "table:operation_tracking";
9294
const std::string TABLE_SCHEMA_TRACKING = "table:schema_tracking";
93-
const std::string STATISTICS_URI = "statistics:";
9495

9596
} // namespace test_harness

src/third_party/wiredtiger/test/cppsuite/src/common/constants.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@
3535
namespace test_harness {
3636

3737
/* Component names. */
38-
extern const std::string OPERATION_TRACKER;
3938
extern const std::string METRICS_MONITOR;
39+
extern const std::string OPERATION_TRACKER;
4040
extern const std::string TIMESTAMP_MANAGER;
4141
extern const std::string WORKLOAD_MANAGER;
4242

4343
/* Configuration API consts. */
44+
extern const std::string BACKGROUND_COMPACT_DEBUG_MODE;
4445
extern const std::string BACKGROUND_COMPACT_OP_CONFIG;
4546
extern const std::string CACHE_HS_INSERT;
4647
extern const std::string CACHE_MAX_WAIT_MS;
4748
extern const std::string CACHE_SIZE_MB;
4849
extern const std::string CC_PAGES_REMOVED;
49-
extern const std::string COLLECTION_COUNT;
5050
extern const std::string CHECKPOINT_OP_CONFIG;
51+
extern const std::string COLLECTION_COUNT;
5152
extern const std::string COMPRESSION_ENABLED;
5253
extern const std::string CUSTOM_OP_CONFIG;
5354
extern const std::string DURATION_SECONDS;
@@ -110,9 +111,9 @@ extern const std::string STATISTICS_LOG;
110111

111112
/* Test harness consts. */
112113
extern const std::string DEFAULT_FRAMEWORK_SCHEMA;
114+
extern const std::string STATISTICS_URI;
113115
extern const std::string TABLE_OPERATION_TRACKING;
114116
extern const std::string TABLE_SCHEMA_TRACKING;
115-
extern const std::string STATISTICS_URI;
116117

117118
} // namespace test_harness
118119

src/third_party/wiredtiger/test/cppsuite/src/main/test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ test::run()
123123
enable_logging = _config->get_bool(ENABLE_LOGGING);
124124
db_create_config += ",log=(enabled=" + std::string(enable_logging ? "true" : "false") + ")";
125125

126+
/* Enable or disable background compact debug mode. */
127+
if (_config->get_bool(BACKGROUND_COMPACT_DEBUG_MODE))
128+
db_create_config += ",debug_mode=(background_compact)";
129+
126130
/* Maximum waiting time for the cache to get unstuck. */
127131
cache_max_wait_ms = _config->get_int(CACHE_MAX_WAIT_MS);
128132
db_create_config += ",cache_max_wait_ms=" + std::to_string(cache_max_wait_ms);

0 commit comments

Comments
 (0)