Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
add sleep options
Browse files Browse the repository at this point in the history
  • Loading branch information
bright-starry-sky committed Aug 5, 2021
1 parent ad2514b commit 2368c7a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conf/nebula-storaged.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@
############## Runtime global Options ##############
# Index rebuild batch number
--rebuild_index_batch_num=256
# Index rebuild processing interval, microsecond.
--rebuild_index_process_interval=30000
2 changes: 2 additions & 0 deletions conf/nebula-storaged.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@
############## Runtime global Options ##############
# Index rebuild batch number
--rebuild_index_batch_num=256
# Index rebuild processing interval, microsecond.
--rebuild_index_process_interval=30000
3 changes: 3 additions & 0 deletions src/storage/StorageFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ DEFINE_int32(rebuild_index_batch_num, 256,
DEFINE_int32(rebuild_index_locked_threshold, 256,
"The locked threshold will refuse writing.");

DEFINE_int32(rebuild_index_process_interval, 30000,
"Index rebuild processing interval, microsecond.");

DEFINE_bool(enable_vertex_cache, true, "Enable vertex cache");

DEFINE_int32(reader_handlers, 32, "Total reader handlers");
Expand Down
2 changes: 2 additions & 0 deletions src/storage/StorageFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ DECLARE_int32(rebuild_index_batch_num);

DECLARE_int32(rebuild_index_locked_threshold);

DECLARE_int32(rebuild_index_process_interval);

DECLARE_bool(enable_vertex_cache);

DECLARE_int32(reader_handlers);
Expand Down
1 change: 1 addition & 0 deletions src/storage/admin/RebuildEdgeIndexTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ RebuildEdgeIndexTask::buildIndexGlobal(GraphSpaceID space,
}
}
iter->next();
usleep(FLAGS_rebuild_index_process_interval);
}

auto result = writeData(space, part, std::move(data));
Expand Down
2 changes: 2 additions & 0 deletions src/storage/admin/RebuildIndexTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ RebuildIndexTask::buildIndexOnOperations(GraphSpaceID space, PartitionID part) {
operations.clear();
}
operationIter->next();
usleep(FLAGS_rebuild_index_process_interval);
}

auto ret = cleanupOperationLogs(space, part, operations);
Expand Down Expand Up @@ -224,6 +225,7 @@ RebuildIndexTask::removeLegacyLogs(GraphSpaceID space,
operations.clear();
}
operationIter->next();
usleep(FLAGS_rebuild_index_process_interval);
}

return nebula::cpp2::ErrorCode::SUCCEEDED;
Expand Down
1 change: 1 addition & 0 deletions src/storage/admin/RebuildTagIndexTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ RebuildTagIndexTask::buildIndexGlobal(GraphSpaceID space,
}
}
iter->next();
usleep(FLAGS_rebuild_index_process_interval);
}

auto result = writeData(space, part, std::move(data));
Expand Down
1 change: 1 addition & 0 deletions src/storage/test/RebuildIndexTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class RebuildIndexTest : public ::testing::Test {
static void SetUpTestCase() {
LOG(INFO) << "SetUp RebuildIndexTest TestCase";
FLAGS_rebuild_index_locked_threshold = 1;
FLAGS_rebuild_index_process_interval = 0;
rootPath_ = std::make_unique<fs::TempDir>("/tmp/RebuildIndexTest.XXXXXX");
cluster_ = std::make_unique<nebula::mock::MockCluster>();
cluster_->initStorageKV(rootPath_->path());
Expand Down

0 comments on commit 2368c7a

Please sign in to comment.