Skip to content

Commit 6441ad2

Browse files
jimwwalkerdaverigby
authored andcommitted
MB-34422: Interlock vbucket delete and warmup
Change-Id: Icbdc4c9e1e8832dd846eefc14dab25bcd69243fc Reviewed-on: http://review.couchbase.org/112341 Reviewed-by: James Harrison <[email protected]> Reviewed-by: Dave Rigby <[email protected]> Tested-by: Dave Rigby <[email protected]>
1 parent 5d6525e commit 6441ad2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

engines/ep/src/ep_engine.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5830,6 +5830,10 @@ cb::mcbp::Status EventuallyPersistentEngine::startFlusher(const char** msg,
58305830
ENGINE_ERROR_CODE EventuallyPersistentEngine::deleteVBucket(
58315831
Vbid vbucket, bool waitForCompletion, const void* cookie) {
58325832
ENGINE_ERROR_CODE status = ENGINE_SUCCESS;
5833+
if (getKVBucket()->maybeWaitForVBucketWarmup(cookie)) {
5834+
return ENGINE_EWOULDBLOCK;
5835+
}
5836+
58335837
void* es = getEngineSpecific(cookie);
58345838
if (waitForCompletion) {
58355839
if (es == nullptr) {

engines/ep/tests/module_tests/evp_store_warmup_test.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ TEST_F(WarmupTest, OperationsInterlockedWithWarmup) {
232232
const void* statsCookie1 = create_mock_cookie();
233233
const void* statsCookie2 = create_mock_cookie();
234234
const void* statsCookie3 = create_mock_cookie();
235+
const void* delVbCookie = create_mock_cookie();
235236

236237
std::unordered_map<const void*, int> notifications;
237238
notifications[setVBStateCookie] =
@@ -248,6 +249,7 @@ TEST_F(WarmupTest, OperationsInterlockedWithWarmup) {
248249
get_number_of_mock_cookie_io_notifications(statsCookie2);
249250
notifications[statsCookie3] =
250251
get_number_of_mock_cookie_io_notifications(statsCookie3);
252+
notifications[delVbCookie] = get_number_of_mock_cookie_io_notifications(delVbCookie);
251253

252254
auto dummyAddStats = [](const char*,
253255
const uint16_t,
@@ -285,6 +287,9 @@ TEST_F(WarmupTest, OperationsInterlockedWithWarmup) {
285287
engine->get_stats(
286288
statsCookie3, "vbucket-seqno", dummyAddStats));
287289

290+
EXPECT_EQ(ENGINE_EWOULDBLOCK,
291+
engine->deleteVBucket(vbid, true, delVbCookie));
292+
288293
executor.runCurrentTask();
289294
}
290295

@@ -318,6 +323,8 @@ TEST_F(WarmupTest, OperationsInterlockedWithWarmup) {
318323
EXPECT_EQ(ENGINE_SUCCESS,
319324
engine->get_stats(statsCookie3, "vbucket-seqno", dummyAddStats));
320325

326+
EXPECT_EQ(ENGINE_SUCCESS, engine->deleteVBucket(vbid, false, delVbCookie));
327+
321328
// finish warmup so the test can exit
322329
while (engine->getKVBucket()->isWarmingUp()) {
323330
CheckedExecutor executor(task_executor, readerQueue);

0 commit comments

Comments
 (0)