Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiaoshuai123 committed Apr 16, 2024
1 parent 851d5b6 commit 5622aa9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/db.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ void DB::DoBgSave(const std::string& path, int i) {
}

void DB::CreateCheckpoint(const std::string& path) {
if (0 != pstd::CreatePath(path + '/' + std::to_string(db_index_))) {
WARN("Create dir {} fail !", path + '/' + std::to_string(db_index_));
auto tmp_path = path + '/' + std::to_string(db_index_);
if (0 != pstd::CreatePath(tmp_path)) {
WARN("Create dir {} fail !", tmp_path);
return;
}
checkpoint_manager_->CreateCheckpoint(path);
Expand Down
3 changes: 2 additions & 1 deletion src/praft/praft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ void PRaft::AppendLog(const Binlog& log, std::promise<rocksdb::Status>&& promise
}

void PRaft::add_all_files(const std::filesystem::path& dir, braft::SnapshotWriter* writer, const std::string& path) {
assert(writer);
for (const auto& entry : std::filesystem::directory_iterator(dir)) {
if (entry.is_directory()) {
if (entry.path() != "." && entry.path() != "..") {
Expand All @@ -390,7 +391,7 @@ void PRaft::add_all_files(const std::filesystem::path& dir, braft::SnapshotWrite

void PRaft::recursive_copy(const std::filesystem::path& source, const std::filesystem::path& destination) {
if (std::filesystem::is_regular_file(source)) {
if (source.filename() == "__raft_snapshot_meta") {
if (source.filename() == PBRAFT_SNAPSHOT_META_FILE) {
return;
} else if (source.extension() == ".sst") {
// Create a hard link
Expand Down
1 change: 1 addition & 0 deletions src/praft/praft.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace pikiwidb {

#define RAFT_DBID_LEN 32
#define PBRAFT_SNAPSHOT_META_FILE "__raft_snapshot_meta"

#define PRAFT PRaft::Instance()

Expand Down

0 comments on commit 5622aa9

Please sign in to comment.