From 9bc0f9e704845593c07581349dae5c61501b7e04 Mon Sep 17 00:00:00 2001 From: obdev Date: Thu, 8 Feb 2024 07:52:08 +0000 Subject: [PATCH] change ObStorageObjectType to ObStorageObjectMetaType --- deps/oblib/src/lib/restore/ob_i_storage.h | 12 ++++++------ deps/oblib/src/lib/restore/ob_storage.cpp | 12 ++++++------ deps/oblib/src/lib/restore/ob_storage_file.cpp | 4 ++-- .../unittest/lib/restore/test_object_storage.cpp | 4 ++-- .../blocksstable/ob_index_block_data_prepare.h | 4 ---- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/deps/oblib/src/lib/restore/ob_i_storage.h b/deps/oblib/src/lib/restore/ob_i_storage.h index 256a9b491..271d02394 100644 --- a/deps/oblib/src/lib/restore/ob_i_storage.h +++ b/deps/oblib/src/lib/restore/ob_i_storage.h @@ -43,7 +43,7 @@ enum ObStorageCRCAlgorithm OB_CRC32_ALGO = 1, }; -enum ObStorageObjectType +enum ObStorageObjectMetaType { OB_OBJ_INVALID = 0, OB_OBJ_NORMAL = 1, @@ -70,7 +70,7 @@ struct ObStorageObjectMetaBase { OB_UNIS_VERSION_V(1); public: - ObStorageObjectMetaBase() : type_(ObStorageObjectType::OB_OBJ_INVALID) { reset(); } + ObStorageObjectMetaBase() : type_(ObStorageObjectMetaType::OB_OBJ_INVALID) { reset(); } ~ObStorageObjectMetaBase() { reset(); } void reset() { is_exist_ = false; length_ = -1; } @@ -79,7 +79,7 @@ public: bool is_exist_; int64_t length_; - ObStorageObjectType type_; + ObStorageObjectMetaType type_; }; // Each fragment meta corresponds to a normal object in a 'dir'. @@ -144,10 +144,10 @@ public: bool is_object_file_type() const { - return (type_ == ObStorageObjectType::OB_OBJ_NORMAL) || - (type_ == ObStorageObjectType::OB_FS_FILE); + return (type_ == ObStorageObjectMetaType::OB_OBJ_NORMAL) || + (type_ == ObStorageObjectMetaType::OB_FS_FILE); } - bool is_simulate_append_type() const { return type_ == ObStorageObjectType::OB_OBJ_SIMULATE_APPEND; } + bool is_simulate_append_type() const { return type_ == ObStorageObjectMetaType::OB_OBJ_SIMULATE_APPEND; } static bool fragment_meta_cmp_func(const ObAppendableFragmentMeta &left, const ObAppendableFragmentMeta &right); diff --git a/deps/oblib/src/lib/restore/ob_storage.cpp b/deps/oblib/src/lib/restore/ob_storage.cpp index 8182e1329..6baf3b133 100644 --- a/deps/oblib/src/lib/restore/ob_storage.cpp +++ b/deps/oblib/src/lib/restore/ob_storage.cpp @@ -177,7 +177,7 @@ int ListAppendableObjectFragmentOp::gen_object_meta(ObStorageObjectMeta &obj_met int64_t i = 0; int64_t last_end_offset = 0; obj_meta.reset(); - obj_meta.type_ = ObStorageObjectType::OB_OBJ_SIMULATE_APPEND; + obj_meta.type_ = ObStorageObjectMetaType::OB_OBJ_SIMULATE_APPEND; std::sort(meta_arr_.begin(), meta_arr_.end(), ObStorageObjectMeta::fragment_meta_cmp_func); while (OB_SUCC(ret) && i < meta_arr_.size()) { ObAppendableFragmentMeta &tmp_meta = meta_arr_[i]; @@ -400,10 +400,10 @@ int ObStorageUtil::detect_storage_obj_meta( } else if (OB_FAIL(util_->head_object_meta(uri, obj_meta))) { STORAGE_LOG(WARN, "fail to head object meta", K(ret), K(uri)); } else if (obj_meta.is_exist_) { - if (ObStorageObjectType::OB_FS_DIR != obj_meta.type_) { + if (ObStorageObjectMetaType::OB_FS_DIR != obj_meta.type_) { // just return directly need_detect_appendable = false; - obj_meta.type_ = ObStorageObjectType::OB_OBJ_NORMAL; + obj_meta.type_ = ObStorageObjectMetaType::OB_OBJ_NORMAL; } } @@ -432,9 +432,9 @@ int ObStorageUtil::detect_storage_obj_meta( } else if (OB_FAIL(util_->head_object_meta(format_meta_uri, obj_meta))) { STORAGE_LOG(WARN, "fail to head object meta", K(ret), K(format_meta_uri)); } else if (obj_meta.is_exist_) { - obj_meta.type_ = ObStorageObjectType::OB_OBJ_SIMULATE_APPEND; + obj_meta.type_ = ObStorageObjectMetaType::OB_OBJ_SIMULATE_APPEND; } else { - if (ObStorageObjectType::OB_FS_DIR == obj_meta.type_) { + if (ObStorageObjectMetaType::OB_FS_DIR == obj_meta.type_) { ret = OB_INVALID_ARGUMENT; OB_LOG(WARN, "please set is_adaptive as false when want to check a common dir exist or not", K(ret), K(uri), K(is_adaptive)); @@ -518,7 +518,7 @@ int ObStorageUtil::list_appendable_file_fragments( ret = OB_BACKUP_FILE_NOT_EXIST; OB_LOG(WARN, "not exist valid appendable file, cuz lack of format_meta", K(ret), K(uri)); } else if (FALSE_IT(obj_meta.is_exist_ = true)) { - } else if (FALSE_IT(obj_meta.type_ = ObStorageObjectType::OB_OBJ_SIMULATE_APPEND)) { + } else if (FALSE_IT(obj_meta.type_ = ObStorageObjectMetaType::OB_OBJ_SIMULATE_APPEND)) { } else if (OB_FAIL(op.gen_object_meta(obj_meta))) { OB_LOG(WARN, "fail to gen object meta based on the listed meta info", K(ret), K(uri)); } diff --git a/deps/oblib/src/lib/restore/ob_storage_file.cpp b/deps/oblib/src/lib/restore/ob_storage_file.cpp index 04de692c3..2e10ad6e6 100644 --- a/deps/oblib/src/lib/restore/ob_storage_file.cpp +++ b/deps/oblib/src/lib/restore/ob_storage_file.cpp @@ -191,11 +191,11 @@ int ObStorageFileUtil::head_object_meta(const common::ObString &uri, ObStorageOb } else if (S_ISDIR(file_info.st_mode)) { obj_meta.is_exist_ = true; obj_meta.length_ = -1; - obj_meta.type_ = ObStorageObjectType::OB_FS_DIR; + obj_meta.type_ = ObStorageObjectMetaType::OB_FS_DIR; } else { obj_meta.is_exist_ = true; obj_meta.length_ = file_info.st_size; - obj_meta.type_ = ObStorageObjectType::OB_FS_FILE; + obj_meta.type_ = ObStorageObjectMetaType::OB_FS_FILE; } return ret; diff --git a/deps/oblib/unittest/lib/restore/test_object_storage.cpp b/deps/oblib/unittest/lib/restore/test_object_storage.cpp index 51dcf90d4..d3312a32d 100644 --- a/deps/oblib/unittest/lib/restore/test_object_storage.cpp +++ b/deps/oblib/unittest/lib/restore/test_object_storage.cpp @@ -165,7 +165,7 @@ int test_gen_object_meta( if (OB_FAIL(ret)) { } else if (OB_FAIL(op.gen_object_meta(appendable_obj_meta))) { OB_LOG(WARN, "fail to gen object meta", K(ret), K(appendable_obj_meta)); - } else if (ObStorageObjectType::OB_OBJ_SIMULATE_APPEND != appendable_obj_meta.type_) { + } else if (ObStorageObjectMetaType::OB_OBJ_SIMULATE_APPEND != appendable_obj_meta.type_) { ret = OB_ERR_UNEXPECTED; OB_LOG(WARN, "not expected value", K(ret), K(appendable_obj_meta.type_)); } else if (expected_file_length != appendable_obj_meta.length_) { @@ -355,7 +355,7 @@ TEST_F(TestObjectStorage, test_appendable_object_util) int64_t n_remained_fragments = sizeof(expected_start) / sizeof(int64_t); int64_t expected_file_length = 1234567; ObStorageObjectMeta appendable_obj_meta; - // (ObStorageObjectType::OB_OBJ_SIMULATE_APPEND); + // (ObStorageObjectMetaType::OB_OBJ_SIMULATE_APPEND); ASSERT_EQ(OB_SUCCESS, test_gen_object_meta(valid_fragments, n_fragments, n_remained_fragments, expected_start, expected_end, expected_file_length, appendable_obj_meta)); diff --git a/mittest/mtlenv/storage/blocksstable/ob_index_block_data_prepare.h b/mittest/mtlenv/storage/blocksstable/ob_index_block_data_prepare.h index 2af73e3e7..adf303c2f 100644 --- a/mittest/mtlenv/storage/blocksstable/ob_index_block_data_prepare.h +++ b/mittest/mtlenv/storage/blocksstable/ob_index_block_data_prepare.h @@ -38,10 +38,6 @@ namespace oceanbase { -namespace palf -{ -class SCN; -} using namespace common; using namespace compaction;