Skip to content

Commit 2e3b59f

Browse files
Sriram Ganesandaverigby
authored andcommitted
MB-28685: Expand ep_testsuite tests for compression active mode
As part of expanding ep_testsuite to work with all compression modes, run the ep_testsuite tests for active compression mode Change-Id: Ia61de4deefaa4d69abbbb18769ffb300c0abadb2 Reviewed-on: http://review.couchbase.org/95505 Well-Formed: Build Bot <[email protected]> Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 4451984 commit 2e3b59f

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

engines/ep/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,23 @@ if (COUCHBASE_KV_BUILD_UNIT_TESTS)
591591
COMMAND ${_cmdline} -v -e "compression_mode=off$<SEMICOLON>dbname=./${name}.value_eviction.comp_off.db")
592592
ADD_TEST(NAME ${name}.value_eviction.comp_passive
593593
COMMAND ${_cmdline} -v -e "compression_mode=passive$<SEMICOLON>dbname=./${name}.value_eviction.comp_passive.db")
594+
ADD_TEST(NAME ${name}.value_eviction.comp_active
595+
COMMAND ${_cmdline} -v -e "compression_mode=active$<SEMICOLON>dbname=./${name}.value_eviction.comp_active.db")
594596
ADD_TEST(NAME ${name}.full_eviction.comp_off
595597
COMMAND ${_cmdline} -v -e "compression_mode=off$<SEMICOLON>item_eviction_policy=full_eviction\
596598
$<SEMICOLON>dbname=./${name}.full_eviction.comp_off.db")
597599
ADD_TEST(NAME ${name}.full_eviction.comp_passive
598600
COMMAND ${_cmdline} -v -e "compression_mode=passive$<SEMICOLON>item_eviction_policy=full_eviction\
599601
$<SEMICOLON>dbname=./${name}.full_eviction.comp_passive.db")
602+
ADD_TEST(NAME ${name}.full_eviction.comp_active
603+
COMMAND ${_cmdline} -v -e "compression_mode=active$<SEMICOLON>item_eviction_policy=full_eviction\
604+
$<SEMICOLON>dbname=./${name}.full_eviction.comp_active.db")
600605
SET_TESTS_PROPERTIES(${name}.value_eviction.comp_off PROPERTIES TIMEOUT ${timeout})
601606
SET_TESTS_PROPERTIES(${name}.value_eviction.comp_passive PROPERTIES TIMEOUT ${timeout})
607+
SET_TESTS_PROPERTIES(${name}.value_eviction.comp_active PROPERTIES TIMEOUT ${timeout})
602608
SET_TESTS_PROPERTIES(${name}.full_eviction.comp_off PROPERTIES TIMEOUT ${timeout})
603609
SET_TESTS_PROPERTIES(${name}.full_eviction.comp_passive PROPERTIES TIMEOUT ${timeout})
610+
SET_TESTS_PROPERTIES(${name}.full_eviction.comp_active PROPERTIES TIMEOUT ${timeout})
604611

605612
IF (NOT arg_SKIP_EPHEMERAL)
606613
ADD_TEST(NAME ${name}.ephemeral

engines/ep/tests/ep_test_apis.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,15 @@ void wait_for_flusher_to_settle(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
15971597
wait_for_stat_to_be(h, h1, "ep_flusher_todo", 0);
15981598
}
15991599

1600+
void wait_for_item_compressor_to_settle(ENGINE_HANDLE* h,
1601+
ENGINE_HANDLE_V1* h1) {
1602+
int visited_count = get_int_stat(h, h1, "ep_item_compressor_num_visited");
1603+
1604+
// We need to wait for at least one more run of the item compressor
1605+
wait_for_stat_to_be(
1606+
h, h1, "ep_item_compressor_num_visited", visited_count + 1);
1607+
}
1608+
16001609
void wait_for_rollback_to_finish(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
16011610
useconds_t sleepTime = 128;
16021611
while (get_int_stat(h, h1, "ep_rollback_count") == 0) {

engines/ep/tests/ep_test_apis.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ void wait_for_expired_items_to_be(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1,
444444
const time_t max_wait_time_in_secs = 60);
445445
bool wait_for_warmup_complete(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1);
446446
void wait_for_flusher_to_settle(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1);
447+
void wait_for_item_compressor_to_settle(ENGINE_HANDLE* h, ENGINE_HANDLE_V1* h1);
447448
void wait_for_rollback_to_finish(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1);
448449
void wait_for_persisted_value(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1,
449450
const char *key, const char *val,

engines/ep/tests/ep_testsuite.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,12 +2012,18 @@ static enum test_result test_mem_stats(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
20122012
if (isPersistentBucket(h, h1)) {
20132013
wait_for_stat_change(h, h1, "ep_items_rm_from_checkpoints", itemsRemoved);
20142014
}
2015+
2016+
if (isActiveCompressionEnabled(h, h1)) {
2017+
wait_for_item_compressor_to_settle(h, h1);
2018+
}
2019+
20152020
int mem_used = get_int_stat(h, h1, "mem_used");
20162021
int cache_size = get_int_stat(h, h1, "ep_total_cache_size");
20172022
int overhead = get_int_stat(h, h1, "ep_overhead");
20182023
int value_size = get_int_stat(h, h1, "ep_value_size");
20192024
check((mem_used - overhead) > cache_size,
2020-
"ep_kv_size should be greater than the hashtable cache size due to the checkpoint overhead");
2025+
"ep_kv_size should be greater than the hashtable cache size due to "
2026+
"the checkpoint overhead");
20212027

20222028
if (isPersistentBucket(h, h1)) {
20232029
evict_key(h, h1, "key", 0, "Ejected.");
@@ -2029,10 +2035,15 @@ static enum test_result test_mem_stats(ENGINE_HANDLE *h, ENGINE_HANDLE_V1 *h1) {
20292035

20302036
check_key_value(h, h1, "key", value, strlen(value), 0); // Load an item from disk again.
20312037

2038+
if (isActiveCompressionEnabled(h, h1)) {
2039+
wait_for_item_compressor_to_settle(h, h1);
2040+
}
2041+
20322042
check(get_int_stat(h, h1, "mem_used") >= mem_used,
20332043
"Expected mem_used to remain the same after an item is loaded from disk");
20342044
check(get_int_stat(h, h1, "ep_value_size") == value_size,
2035-
"Expected ep_value_size to remain the same after item is loaded from disk");
2045+
"Expected ep_value_size to remain the same after item is "
2046+
"loaded from disk");
20362047
}
20372048

20382049
return SUCCESS;

0 commit comments

Comments
 (0)