This is an automated email from the ASF dual-hosted git repository.
gehafearless pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 4e76061a9 fix(partition_split): Fix the missing garbage partition
(#1936)
4e76061a9 is described below
commit 4e76061a910537e57d31610f8b8ebca15d39326e
Author: Yingchun Lai <[email protected]>
AuthorDate: Fri Mar 8 11:43:41 2024 +0800
fix(partition_split): Fix the missing garbage partition (#1936)
This patch fixes the bug of the garbage partition with pidx of N is missing
gargabed after partition split function aborted on the table which has N
partitions.
Also add a small convenient function bool empty() for class blo
---
src/replica/replica_stub.cpp | 5 ++++-
src/utils/blob.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp
index 68b91bb60..f146fc44b 100644
--- a/src/replica/replica_stub.cpp
+++ b/src/replica/replica_stub.cpp
@@ -1942,7 +1942,10 @@ bool replica_stub::validate_replica_dir(const
std::string &dir,
return false;
}
- if (ai.partition_count < pidx) {
+ // When the online partition split function aborted, the garbage
partitions are with pidx in
+ // the range of [ai.partition_count, 2 * ai.partition_count), which means
the partitions with
+ // pidx >= ai.partition_count are garbage partitions.
+ if (ai.partition_count <= pidx) {
hint_message = fmt::format(
"partition[{}], count={}, this replica may be partition split
garbage partition, "
"ignore it",
diff --git a/src/utils/blob.h b/src/utils/blob.h
index f05e33524..fea1a7a0e 100644
--- a/src/utils/blob.h
+++ b/src/utils/blob.h
@@ -113,6 +113,7 @@ public:
unsigned int length() const noexcept { return _length; }
unsigned int size() const noexcept { return _length; }
+ bool empty() const noexcept { return _length == 0; }
std::shared_ptr<char> buffer() const { return _holder; }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]