This is an automated email from the ASF dual-hosted git repository.
w41ter pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6f21ae42659 [fix](cloud) Add predecessor instance id (#62276)
6f21ae42659 is described below
commit 6f21ae42659a86e15418ca84a88967bdbf4248d8
Author: walter <[email protected]>
AuthorDate: Fri Apr 10 15:10:15 2026 +0800
[fix](cloud) Add predecessor instance id (#62276)
When a rollback exists, the predecessor instance is not the same as the
source instance. This change separates the two semantics into distinct
fields for clarity.
---
cloud/src/resource-manager/resource_manager.cpp | 15 ++++++++-------
gensrc/proto/cloud.proto | 7 ++++++-
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/cloud/src/resource-manager/resource_manager.cpp
b/cloud/src/resource-manager/resource_manager.cpp
index 82abc09f86a..fd634fdcff2 100644
--- a/cloud/src/resource-manager/resource_manager.cpp
+++ b/cloud/src/resource-manager/resource_manager.cpp
@@ -1414,18 +1414,19 @@ std::pair<MetaServiceCode, std::string>
ResourceManager::refresh_instance(
void ResourceManager::refresh_instance(const std::string& instance_id,
const InstanceInfoPB& instance) {
bool is_successor_instance = instance.has_original_instance_id();
- std::string source_instance_id = is_successor_instance ?
instance.source_instance_id() : "";
+ std::string predecessor_instance_id =
+ is_successor_instance ? instance.predecessor_instance_id() : "";
std::lock_guard l(mtx_);
for (auto i = node_info_.begin(); i != node_info_.end();) {
- // erase all nodes not belong to this instance_id
- if (i->second.instance_id != instance_id &&
- // ... or, if is_successor_instance, erase nodes belong to
source_instance_id
- (!is_successor_instance || i->second.instance_id !=
source_instance_id)) {
+ // erase all nodes belong to this instance_id
+ if (i->second.instance_id == instance_id ||
+ // ... or, if is_successor_instance, erase nodes belong to
predecessor_instance_id
+ (is_successor_instance && i->second.instance_id ==
predecessor_instance_id)) {
+ i = node_info_.erase(i);
+ } else {
++i;
- continue;
}
- i = node_info_.erase(i);
}
// If successor_instance_id is set, it means this instance has a successor
instance,
diff --git a/gensrc/proto/cloud.proto b/gensrc/proto/cloud.proto
index 6e2c46672cd..6e0d268f14a 100644
--- a/gensrc/proto/cloud.proto
+++ b/gensrc/proto/cloud.proto
@@ -129,7 +129,7 @@ message InstanceInfoPB {
// For snapshot
optional MultiVersionStatus multi_version_status = 110;
optional SnapshotSwitchStatus snapshot_switch_status = 111;
- optional string source_instance_id = 112; // The instance cloned from.
+ optional string source_instance_id = 112; // The instance cloned from
(the snapshot instance id).
optional string source_snapshot_id = 113; // The snapshot cloned from.
// Inherited from which instance (only used during rollback, the earliest
instance id).
@@ -147,6 +147,11 @@ message InstanceInfoPB {
optional int64 snapshot_retained_data_size = 121;
optional int64 snapshot_billable_data_size = 122;
optional SnapshotCompactStatus snapshot_compact_status = 123;
+
+ // The instance that is being rolled back, only used during rollback.
+ // It is not always same as source_instance_id, because the source
instance may inherit from another
+ // instance during rollback, and the predecessor instance is the real
instance which to execute the rollback.
+ optional string predecessor_instance_id = 124;
}
message StagePB {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]