diff --git a/src/storage/ob_partition_group.cpp b/src/storage/ob_partition_group.cpp index 9d2e0ad482370d588fb61dc371ab34b06637e6ae..c66add423eec32c4787289c65dab4d2bc5fac91e 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 58e784b210d083a211822a0b2dee69aa854d0933..56131dc1c53dbd745b7f07d845aa2e5f19897411 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; }