Skip to content

Commit

Permalink
Fix wal
Browse files Browse the repository at this point in the history
Signed-off-by: Jin Hai <[email protected]>
  • Loading branch information
JinHai-CN committed Oct 16, 2024
1 parent b820b29 commit fb1e1cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions conf/infinity_conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ connection_pool_size = 128
[log]
log_filename = "infinity.log"
log_dir = "/var/infinity/log"
log_to_stdout = false
log_to_stdout = true
log_file_max_size = "10GB"
log_file_rotate_count = 10

# trace/debug/info/warning/error/critical 6 log levels, default: info
log_level = "info"
log_level = "trace"

[storage]
persistence_dir = "/var/infinity/persistence"
Expand Down
2 changes: 1 addition & 1 deletion src/storage/meta/catalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void Catalog::SaveFullCatalog(TxnTimeStamp max_commit_ts, String &full_catalog_p
// FIXME: Temp implementation, will be replaced by async task.
auto [catalog_file_handle, status] = VirtualStore::Open(catalog_tmp_path, FileAccessMode::kWrite);
if (!status.ok()) {
UnrecoverableError(status.message());
UnrecoverableError(fmt::format("{}: {}", catalog_tmp_path, status.message()));
}

status = catalog_file_handle->Append(catalog_str.data(), catalog_str.size());
Expand Down
2 changes: 1 addition & 1 deletion src/storage/wal/wal_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ SharedPtr<WalCmd> WalCmd::ReadAdv(const char *&ptr, i32 max_bytes) {
String db_name = ReadBufAdv<String>(ptr);
String db_dir_tail = ReadBufAdv<String>(ptr);
String db_comment = ReadBufAdv<String>(ptr);
cmd = MakeShared<WalCmdCreateDatabase>(std::move(db_name), std::move(db_comment), std::move(db_dir_tail));
cmd = MakeShared<WalCmdCreateDatabase>(std::move(db_name), std::move(db_dir_tail), std::move(db_comment));
break;
}
case WalCommandType::DROP_DATABASE: {
Expand Down
9 changes: 4 additions & 5 deletions src/storage/wal/wal_entry.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -177,25 +177,24 @@ export struct WalCmd {
};

export struct WalCmdCreateDatabase final : public WalCmd {
explicit WalCmdCreateDatabase(String db_name, String db_comment, String db_dir_tail)
: db_name_(std::move(db_name)), db_comment_(std::move(db_comment)), db_dir_tail_(std::move(db_dir_tail)) {
explicit WalCmdCreateDatabase(String db_name, String db_dir_tail, String db_comment)
: db_name_(std::move(db_name)), db_dir_tail_(std::move(db_dir_tail)), db_comment_(std::move(db_comment)) {
assert(!std::filesystem::path(db_dir_tail_).is_absolute());
}

WalCommandType GetType() const final { return WalCommandType::CREATE_DATABASE; }
bool operator==(const WalCmd &other) const final {
const auto *other_cmd = dynamic_cast<const WalCmdCreateDatabase *>(&other);
return other_cmd != nullptr && IsEqual(db_name_, other_cmd->db_name_) && IsEqual(db_comment_, other_cmd->db_comment_) &&
IsEqual(db_dir_tail_, other_cmd->db_dir_tail_);
return other_cmd != nullptr && IsEqual(db_name_, other_cmd->db_name_) && IsEqual(db_dir_tail_, other_cmd->db_dir_tail_);
}
[[nodiscard]] i32 GetSizeInBytes() const final;
void WriteAdv(char *&buf) const final;
String ToString() const final;
String CompactInfo() const final;

String db_name_{};
String db_comment_{};
String db_dir_tail_{};
String db_comment_{};
};

export struct WalCmdDropDatabase final : public WalCmd {
Expand Down

0 comments on commit fb1e1cd

Please sign in to comment.