change ObStorageObjectType to ObStorageObjectMetaType
This commit is contained in:
parent
6cfbcd52b2
commit
3e40d869ec
12
deps/oblib/src/lib/restore/ob_i_storage.h
vendored
12
deps/oblib/src/lib/restore/ob_i_storage.h
vendored
@ -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);
|
||||
|
||||
|
12
deps/oblib/src/lib/restore/ob_storage.cpp
vendored
12
deps/oblib/src/lib/restore/ob_storage.cpp
vendored
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
||||
|
@ -38,10 +38,6 @@
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace palf
|
||||
{
|
||||
class SCN;
|
||||
}
|
||||
|
||||
using namespace common;
|
||||
using namespace compaction;
|
||||
|
Loading…
x
Reference in New Issue
Block a user