Skip to content

Commit 7734d83

Browse files
BenHuddlestondaverigby
authored andcommitted
MB-39745: Remove BGFetcher::notifyBGEvent
It's always called after adding a pending BG fetch so combine the two functions Change-Id: Iaa60c9c263de46ccb95e8667979c085fb27e14a8 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/137409 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 3b525cb commit 7734d83

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

engines/ep/src/bgfetcher.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ void BgFetcher::stop() {
5656
ExecutorPool::get()->cancel(taskId);
5757
}
5858

59-
void BgFetcher::notifyBGEvent() {
59+
void BgFetcher::addPendingVB(Vbid vbid) {
60+
{ // Scope for queueMutex
61+
LockHolder lh(queueMutex);
62+
pendingVbs.insert(vbid);
63+
}
6064
++stats.numRemainingBgItems;
6165
wakeUpTaskIfSnoozed();
6266
}

engines/ep/src/bgfetcher.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ class BgFetcher {
5858
void start();
5959
void stop();
6060
bool run(GlobalTask *task);
61-
void notifyBGEvent();
6261
void setTaskId(size_t newId) { taskId = newId; }
63-
void addPendingVB(Vbid vbId) {
64-
LockHolder lh(queueMutex);
65-
pendingVbs.insert(vbId);
66-
}
62+
63+
/**
64+
* Add a Vbid to pendingVbs and notify the task if necessary
65+
*/
66+
void addPendingVB(Vbid vbId);
6767

6868
private:
6969
size_t doFetch(Vbid vbId, vb_bgfetch_queue_t& items);

engines/ep/src/ep_vb.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,6 @@ void EPVBucket::bgFetch(const DocKey& key,
753753
key,
754754
std::make_unique<FrontEndBGFetchItem>(cookie, isMeta),
755755
getShard()->getBgFetcher());
756-
if (getShard()) {
757-
getShard()->getBgFetcher()->notifyBGEvent();
758-
}
759756
EP_LOG_DEBUG("Queued a background fetch, now at {}",
760757
uint64_t(bgfetch_size));
761758
}
@@ -789,8 +786,6 @@ void EPVBucket::bgFetchForCompactionExpiry(const DocKey& key,
789786
queueBGFetchItem(key,
790787
std::make_unique<CompactionBGFetchItem>(item),
791788
shard->getBgFetcher());
792-
shard->getBgFetcher()->notifyBGEvent();
793-
794789
EP_LOG_DEBUG("Queue a background fetch for compaction expiry, now at {}",
795790
bgFetchSize);
796791
}

0 commit comments

Comments
 (0)