Skip to content

Commit

Permalink
unit tests: fix CompactionServiceTest.RemoteEventListener (#314)
Browse files Browse the repository at this point in the history
the test assumes that each compaction job_id from the remote compaction
is unique but in fact all the job_ids are 1.
the test passed thus far since there was just 1 bg compaction by default.
once we increased it to 8, there could be concurrent remote compactions
which led to this error.
  • Loading branch information
Yuval-Ariel committed Jan 9, 2023
1 parent 1e6fd16 commit ba4939d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion db/compaction/compaction_service_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ TEST_F(CompactionServiceTest, FallbackLocalManual) {
VerifyTestData();
}

TEST_F(CompactionServiceTest, DISABLED_RemoteEventListener) {
TEST_F(CompactionServiceTest, RemoteEventListener) {
class RemoteEventListenerTest : public EventListener {
public:
const char* Name() const override { return "RemoteEventListenerTest"; }
Expand Down Expand Up @@ -817,7 +817,13 @@ TEST_F(CompactionServiceTest, DISABLED_RemoteEventListener) {
remote_listeners.emplace_back(listener);

Options options = CurrentOptions();
options.max_background_compactions = 1;
ReopenWithCompactionService(&options);
// multiple compactions might notify on OnSubcompactionBegin simultaneously
// which will lead to duplicates in the set. job_id is always 1. was the
// intention that no two compaction service jobs run in parallel? or that the
// job_id should be unique?
env_->SetBackgroundThreads(1, Env::LOW);

for (int i = 0; i < 20; i++) {
for (int j = 0; j < 10; j++) {
Expand Down

0 comments on commit ba4939d

Please sign in to comment.