From 25b3b3fff8b1ce85e338cfb637d96af5439fbb86 Mon Sep 17 00:00:00 2001 From: JiahuaChen Date: Mon, 25 Apr 2022 14:20:31 +0800 Subject: [PATCH] [CP] Fix batch create partitions rollback core --- src/storage/ob_partition_group.cpp | 2 +- src/storage/ob_pg_storage.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/storage/ob_partition_group.cpp b/src/storage/ob_partition_group.cpp index 9d2e0ad482..c66add423e 100644 --- a/src/storage/ob_partition_group.cpp +++ b/src/storage/ob_partition_group.cpp @@ -3148,7 +3148,7 @@ int ObPartitionGroup::check_can_do_merge(bool& can_merge, bool& need_merge) ObReplicaType ObPartitionGroup::get_replica_type() const { int tmp_ret = OB_SUCCESS; - ObReplicaType replica_type; + ObReplicaType replica_type = ObReplicaType::REPLICA_TYPE_MAX; if (OB_SUCCESS != (tmp_ret = pg_storage_.get_replica_type(replica_type))) { STORAGE_LOG(WARN, "get replica_type error", K(tmp_ret), K_(pkey), K(replica_type)); diff --git a/src/storage/ob_pg_storage.cpp b/src/storage/ob_pg_storage.cpp index 58e784b210..56131dc1c5 100644 --- a/src/storage/ob_pg_storage.cpp +++ b/src/storage/ob_pg_storage.cpp @@ -2249,8 +2249,13 @@ ObReplicaType ObPGStorage::get_replica_type_() const int ObPGStorage::get_replica_type(common::ObReplicaType& replica_type) const { int ret = OB_SUCCESS; - TCRLockGuard lock_guard(lock_); - replica_type = meta_->replica_type_; + if (!is_inited_) { + ret = OB_NOT_INIT; + STORAGE_LOG(WARN, "partition is not initialized", K_(pkey), K(ret)); + } else { + TCRLockGuard lock_guard(lock_); + replica_type = meta_->replica_type_; + } return ret; } -- GitLab