chaoyli closed pull request #495: Fix wrong use of status
URL: https://github.com/apache/incubator-doris/pull/495
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/be/src/olap/olap_define.h b/be/src/olap/olap_define.h
index 49b5993f..c1e746a5 100644
--- a/be/src/olap/olap_define.h
+++ b/be/src/olap/olap_define.h
@@ -173,7 +173,7 @@ enum OLAPStatus {
// Tablet
// [-400, -500)
OLAP_ERR_TABLE_VERSION_DUPLICATE_ERROR = -400,
- OLAP_ERR_TABLE_VERSION_sNDEX_MISMATCH_ERROR = -401,
+ OLAP_ERR_TABLE_VERSION_INDEX_MISMATCH_ERROR = -401,
OLAP_ERR_TABLE_INDEX_VALIDATE_ERROR = -402,
OLAP_ERR_TABLE_INDEX_FIND_ERROR = -403,
OLAP_ERR_TABLE_CREATE_FROM_HEADER_ERROR = -404,
diff --git a/be/src/olap/rowset/rowset_meta_manager.cpp
b/be/src/olap/rowset/rowset_meta_manager.cpp
index 1fec296b..88fd0b64 100644
--- a/be/src/olap/rowset/rowset_meta_manager.cpp
+++ b/be/src/olap/rowset/rowset_meta_manager.cpp
@@ -33,16 +33,6 @@ namespace doris {
const std::string ROWSET_PREFIX = "rst_";
-OLAPStatus convert_meta_status(OLAPStatus status) {
- if (status == OLAP_SUCCESS) {
- return OLAP_SUCCESS;
- } else {
- std::string error_msg = "meta operation failed";
- LOG(WARNING) << error_msg;
- return OLAP_ERR_IO_ERROR;
- }
-}
-
OLAPStatus RowsetMetaManager::get_rowset_meta(OlapMeta* meta, int64_t
rowset_id, RowsetMeta* rowset_meta) {
std::string key = ROWSET_PREFIX + std::to_string(rowset_id);
std::string value;
@@ -88,7 +78,7 @@ OLAPStatus RowsetMetaManager::save(OlapMeta* meta, int64_t
rowset_id, RowsetMeta
return OLAP_ERR_SERIALIZE_PROTOBUF_ERROR;
}
OLAPStatus status = meta->put(META_COLUMN_FAMILY_INDEX, key, value);
- return convert_meta_status(status);
+ return status;
}
OLAPStatus RowsetMetaManager::remove(OlapMeta* meta, int64_t rowset_id) {
@@ -96,7 +86,7 @@ OLAPStatus RowsetMetaManager::remove(OlapMeta* meta, int64_t
rowset_id) {
LOG(INFO) << "start to remove rowset, key:" << key;
OLAPStatus status = meta->remove(META_COLUMN_FAMILY_INDEX, key);
LOG(INFO) << "remove rowset key:" << key << " finished";
- return convert_meta_status(status);
+ return status;
}
OLAPStatus RowsetMetaManager::traverse_rowset_metas(OlapMeta* meta,
@@ -113,7 +103,7 @@ OLAPStatus
RowsetMetaManager::traverse_rowset_metas(OlapMeta* meta,
return func(rowset_id, value);
};
OLAPStatus status = meta->iterate(META_COLUMN_FAMILY_INDEX, ROWSET_PREFIX,
traverse_rowset_meta_func);
- return convert_meta_status(status);
+ return status;
}
OLAPStatus RowsetMetaManager::load_json_rowset_meta(OlapMeta* meta, const
std::string& rowset_meta_path) {
diff --git a/be/src/olap/snapshot_manager.h b/be/src/olap/snapshot_manager.h
index 20dcb424..a4c16249 100644
--- a/be/src/olap/snapshot_manager.h
+++ b/be/src/olap/snapshot_manager.h
@@ -57,6 +57,7 @@ class SnapshotManager {
// @brief 释放snapshot
// @param snapshot_path [in] 要被释放的snapshot的路径,只包含到ID
OLAPStatus release_snapshot(const std::string& snapshot_path);
+
OLAPStatus storage_medium_migrate(
TTabletId tablet_id,
TSchemaHash schema_hash,
diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp
index 315104e4..9934da4b 100644
--- a/be/src/olap/tablet_manager.cpp
+++ b/be/src/olap/tablet_manager.cpp
@@ -681,21 +681,21 @@ TabletSharedPtr
TabletManager::find_best_tablet_to_compaction(CompactionType com
}
OLAPStatus TabletManager::load_tablet_from_header(DataDir* data_dir, TTabletId
tablet_id,
- TSchemaHash schema_hash, const std::string& header) {
+ TSchemaHash schema_hash, const std::string& meta_binary) {
std::unique_ptr<TabletMeta> tablet_meta(new TabletMeta());
- bool parsed = tablet_meta->deserialize(header);
+ bool parsed = tablet_meta->deserialize(meta_binary);
if (!parsed) {
- LOG(WARNING) << "parse header string failed for tablet_id:" <<
tablet_id << " schema_hash:" << schema_hash;
+ LOG(WARNING) << "parse meta_binary string failed for tablet_id:" <<
tablet_id << " schema_hash:" << schema_hash;
return OLAP_ERR_HEADER_PB_PARSE_FAILED;
}
// init must be called
OLAPStatus res = tablet_meta->init();
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to init header, tablet_id:" << tablet_id << ",
schema_hash:" << schema_hash;
+ LOG(WARNING) << "fail to init tablet_meta. tablet_id:" << tablet_id <<
", schema_hash:" << schema_hash;
res = TabletMetaManager::remove(data_dir, tablet_id, schema_hash);
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "remove header failed. tablet_id:" << tablet_id
+ LOG(WARNING) << "remove tablet_meta failed. tablet_id:" <<
tablet_id
<< "schema_hash:" << schema_hash
<< "store path:" << path();
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]