Skip to content

Commit

Permalink
Fix DBConfig used in builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Zexi Liu committed Oct 4, 2024
1 parent 71f9683 commit a929431
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions include/libjungle/jungle_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class Builder {
*/
std::string path;

/**
* DBConfig for the DB instance to be created.
*/
const DBConfig* dbConfig;

/**
* Detailed table info.
*/
Expand Down
8 changes: 4 additions & 4 deletions src/jungle_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ Status Builder::buildFromTableFiles(const BuildParams& params) {
Status s;

std::unique_ptr<FileOpsPosix> f_ops(new FileOpsPosix());
DBConfig db_config;

TableMgrOptions t_mgr_opt;
t_mgr_opt.path = params.path;
t_mgr_opt.fOps = f_ops.get();
t_mgr_opt.dbConfig = &db_config;
t_mgr_opt.dbConfig = params.dbConfig;

MutableTableMgr t_mgr(nullptr);
t_mgr.setOpt(t_mgr_opt);
Expand Down Expand Up @@ -82,7 +81,7 @@ Status Builder::buildFromTableFiles(const BuildParams& params) {
}

// Create and add empty L0 tables.
for (size_t ii = 0; ii < db_config.numL0Partitions; ++ii) {
for (size_t ii = 0; ii < params.dbConfig->numL0Partitions; ++ii) {
TableFile* t_file = new TableFile(&t_mgr);
uint64_t table_number = ++max_table_num;
std::string t_filename =
Expand All @@ -103,7 +102,7 @@ Status Builder::buildFromTableFiles(const BuildParams& params) {
LogMgrOptions l_opt;
l_opt.path = params.path;
l_opt.fOps = f_ops.get();
l_opt.dbConfig = &db_config;
l_opt.dbConfig = params.dbConfig;
l_opt.startSeqnum = max_seqnum + 1;
l_mgr.init(l_opt);
l_mgr.sync(false);
Expand All @@ -122,6 +121,7 @@ Status Builder::init(const std::string& path,
dbConfig = db_config;
fOps = new FileOpsPosix();
buildParams.path = path;
buildParams.dbConfig = &dbConfig;

if (!fOps->exist(dstPath)) {
// Create the directory.
Expand Down

0 comments on commit a929431

Please sign in to comment.