Skip to content

Commit

Permalink
add recover_max_pararelism configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ban-nobuhiro committed Jun 22, 2023
1 parent c756acc commit 28577f8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions include/limestone/api/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@ class configuration {
*/
configuration(const std::vector<boost::filesystem::path>&& data_locations, boost::filesystem::path metadata_location) noexcept;

/**
* @brief setter for recover_max_pararelism
* @param recover_max_pararelism the number of recover_max_pararelism
*/
void set_recover_max_pararelism(int recover_max_pararelism) {
recover_max_pararelism_ = recover_max_pararelism;
}

private:
std::vector<boost::filesystem::path> data_locations_{};

boost::filesystem::path metadata_location_{};

int recover_max_pararelism_{8};

friend class datastore;
};

Expand Down
2 changes: 2 additions & 0 deletions include/limestone/api/datastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ class datastore {

std::mutex mtx_files_{};

int recover_max_pararelism_{};

std::mutex mtx_epoch_file_{};

state state_{};
Expand Down
4 changes: 3 additions & 1 deletion src/limestone/datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ datastore::datastore(configuration const& conf) {
strm.close();
add_file(epoch_file_path_);
}


recover_max_pararelism_ = conf.recover_max_pararelism_;

VLOG_LP(log_debug) << "datastore is created, location = " << location_.string();
}

Expand Down
2 changes: 1 addition & 1 deletion src/limestone/datastore_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void datastore::create_snapshot() noexcept {
}
};

int num_worker = 8; // TODO: read from config recover_max_pararelism
int num_worker = recover_max_pararelism_;
if (!works_with_multi_thread && num_worker > 1) {
LOG_LP(ERROR) << "this sort method does not work correctly with multi-thread, so force num_worker = 1";
num_worker = 1;
Expand Down

0 comments on commit 28577f8

Please sign in to comment.