Skip to content

Commit

Permalink
Made some changes to comments and exception messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
lzydmxy committed Sep 29, 2024
1 parent 062ad45 commit 1a4f50a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Service/NuRaftLogSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ void KeeperSnapshotStore::parseBatchBodyV2(
break;
case SnapshotBatchType::SNAPSHOT_TYPE_UINTMAP:
LOG_DEBUG(log, "Parsing batch int_map from snapshot, element count {}", batch->size());
load_objects_count.reset();
parseBatchIntMapV2(store, load_objects_count, *batch, version_);
loaded_objects_count.reset();
parseBatchIntMapV2(store, loaded_objects_count, *batch, version_);
LOG_DEBUG(log, "Parsed zxid {}, session_id_counter {}", store.getZxid(), store.getSessionIDCounter());
break;
case SnapshotBatchType::SNAPSHOT_TYPE_CONFIG:
Expand All @@ -568,7 +568,7 @@ void KeeperSnapshotStore::loadLatestSnapshot(KeeperStore & store)
if (objects_path.begin()->first != 1 || objects_path.rbegin()->first != objects_cnt)
{
throw Exception(ErrorCodes::SNAPSHOT_OBJECT_INCOMPLETE,
"Load snapshot objects error, except 1 ~ {} objects, got {} ~ {} objects",
"Loading snapshot objects error, expecting 1 ~ {} objects, got {} ~ {} objects",
objects_cnt, objects_path.begin()->first, objects_path.rbegin()->first);
}

Expand Down Expand Up @@ -602,11 +602,11 @@ void KeeperSnapshotStore::loadLatestSnapshot(KeeperStore & store)
thread_pool.wait();
LOG_INFO(log, "Parsing snapshot objects costs {}ms", watch.elapsedMilliseconds());

if (load_objects_count && *load_objects_count != objects_path.size())
if (loaded_objects_count && *loaded_objects_count != objects_path.size())
{
throw Exception(ErrorCodes::SNAPSHOT_OBJECT_INCOMPLETE,
"Parsing snapshot objects error, except {} objects, got {} objects",
*load_objects_count, objects_path.size());
"Loading snapshot objects error, expecting {} objects, got {} objects",
*loaded_objects_count, objects_path.size());
}

LOG_INFO(log, "Building data tree from snapshot objects");
Expand Down
5 changes: 3 additions & 2 deletions src/Service/NuRaftLogSnapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,9 @@ class KeeperSnapshotStore

std::map<ulong, String> objects_path;

/// Except snapshot object counts, read from object1
std::optional<UInt32> load_objects_count;
/// Loaded snapshot object count which is read from object1
/// Added from RaftKeeper v2.2.0
std::optional<UInt32> loaded_objects_count;

std::vector<BucketEdges> all_objects_edges;
std::vector<BucketNodes> all_objects_nodes;
Expand Down

0 comments on commit 1a4f50a

Please sign in to comment.