Skip to content

Commit

Permalink
Fix for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Zexi Liu committed Oct 9, 2024
1 parent 4483127 commit c6ab600
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/libjungle/jungle_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Builder {
/**
* DBConfig for the DB instance to be created.
*/
const DBConfig* dbConfig;
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 @@ -31,7 +31,7 @@ Status Builder::buildFromTableFiles(const BuildParams& params) {
TableMgrOptions t_mgr_opt;
t_mgr_opt.path = params.path;
t_mgr_opt.fOps = f_ops.get();
t_mgr_opt.dbConfig = params.dbConfig;
t_mgr_opt.dbConfig = &params.dbConfig;

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

// Create and add empty L0 tables.
for (size_t ii = 0; ii < params.dbConfig->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 @@ -102,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 = params.dbConfig;
l_opt.dbConfig = &params.dbConfig;
l_opt.startSeqnum = max_seqnum + 1;
l_mgr.init(l_opt);
l_mgr.sync(false);
Expand All @@ -121,7 +121,7 @@ Status Builder::init(const std::string& path,
dbConfig = db_config;
fOps = new FileOpsPosix();
buildParams.path = path;
buildParams.dbConfig = &dbConfig;
buildParams.dbConfig = dbConfig;

if (!fOps->exist(dstPath)) {
// Create the directory.
Expand Down
3 changes: 1 addition & 2 deletions tests/jungle/builder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int build_from_table_files_test() {
// Build from table files.
jungle::builder::Builder::BuildParams params;
params.path = path;
params.dbConfig = &d_conf;
params.dbConfig = d_conf;
for (size_t ii = 0; ii < 4; ++ii) {
jungle::builder::Builder::BuildParams::TableData td;
td.tableNumber = ii;
Expand Down Expand Up @@ -200,7 +200,6 @@ int build_an_empty_db_test() {
// Build from table files.
jungle::builder::Builder::BuildParams params;
params.path = path;
params.dbConfig = &d_conf;
CHK_Z( jungle::builder::Builder::buildFromTableFiles(params) );

// Open it via Jungle API.
Expand Down

0 comments on commit c6ab600

Please sign in to comment.