chaoyli closed pull request #427: Remove check tablet code path
URL: https://github.com/apache/incubator-doris/pull/427
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/column_data.cpp b/be/src/olap/column_data.cpp
index 08e03720..ae23a33a 100644
--- a/be/src/olap/column_data.cpp
+++ b/be/src/olap/column_data.cpp
@@ -64,7 +64,7 @@ OLAPStatus ColumnData::init() {
auto res = _short_key_cursor.init(_segment_group->short_key_fields());
if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "key cursor init failed, tablet:" << _tablet->id()
+ LOG(WARNING) << "key cursor init failed, tablet:" <<
_tablet->tablet_id()
<< ", res:" << res;
return res;
}
diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp
index efb61d13..313b40ec 100644
--- a/be/src/olap/storage_engine.cpp
+++ b/be/src/olap/storage_engine.cpp
@@ -266,116 +266,6 @@ OLAPStatus StorageEngine::load_one_tablet(
return OLAP_SUCCESS;
}
-void StorageEngine::check_none_row_oriented_tablet(const
std::vector<OlapStore*>& stores) {
- for (auto store : stores) {
- auto res = _check_none_row_oriented_tablet_in_store(store);
- if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "io error when init load tables. res=" << res
- << ", store=" << store->path();
- }
- }
-}
-
-OLAPStatus StorageEngine::_check_none_row_oriented_tablet_in_store(OlapStore*
store) {
- std::string store_path = store->path();
- LOG(INFO) <<"start to load tablets from store_path:" << store_path;
-
- bool is_header_converted = false;
- OLAPStatus res = TabletMetaManager::get_header_converted(store,
is_header_converted);
- if (res != OLAP_SUCCESS) {
- LOG(WARNING) << "get convert flag from meta failed";
- return res;
- }
- if (is_header_converted) {
- OLAPStatus s = store->check_none_row_oriented_tablet_in_store(this);
- if (s != OLAP_SUCCESS) {
- LOG(WARNING) << "there is failure when loading tablet headers,
path:" << store_path;
- return s;
- } else {
- return OLAP_SUCCESS;
- }
- }
-
- // compatible for old header load method
- // walk all directory to load header file
- LOG(INFO) << "check has none row-oriented tablet from header files";
-
- // get all shards
- set<string> shards;
- if (dir_walk(store_path + DATA_PREFIX, &shards, NULL) != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to walk dir. [root=" << store_path << "]";
- return OLAP_ERR_INIT_FAILED;
- }
-
- for (const auto& shard : shards) {
- // get all tablets
- set<string> tablets;
- string one_shard_path = store_path + DATA_PREFIX + '/' + shard;
- if (dir_walk(one_shard_path, &tablets, NULL) != OLAP_SUCCESS) {
- LOG(WARNING) << "fail to walk dir. [root=" << one_shard_path <<
"]";
- continue;
- }
-
- for (const auto& tablet : tablets) {
- // 遍历table目录寻找此table的所有indexedRollupTable,注意不是SegmentGroup,而是Tablet
- set<string> schema_hashes;
- string one_tablet_path = one_shard_path + '/' + tablet;
- if (dir_walk(one_tablet_path, &schema_hashes, NULL) !=
OLAP_SUCCESS) {
- LOG(WARNING) << "fail to walk dir. [root=" << one_tablet_path
<< "]";
- continue;
- }
-
- for (const auto& schema_hash : schema_hashes) {
- TTabletId tablet_id = strtoul(tablet.c_str(), NULL, 10);
- TSchemaHash tablet_schema_hash = strtoul(schema_hash.c_str(),
NULL, 10);
-
- // 遍历schema_hash目录寻找此index的所有schema
- // 加载失败依然加载下一个Table
- if (check_none_row_oriented_tablet_in_path(
- store,
- tablet_id,
- tablet_schema_hash,
- one_tablet_path + '/' + schema_hash) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load one tablet, but continue.
[path='%s']",
- (one_tablet_path + '/' +
schema_hash).c_str());
- }
- }
- }
- }
- return res;
-}
-
-OLAPStatus StorageEngine::check_none_row_oriented_tablet_in_path(
- OlapStore* store, TTabletId tablet_id,
- SchemaHash schema_hash, const string& schema_hash_path) {
- stringstream header_name_stream;
- header_name_stream << schema_hash_path << "/" << tablet_id << ".hdr";
- string header_path = header_name_stream.str();
- path boost_schema_hash_path(schema_hash_path);
-
- if (access(header_path.c_str(), F_OK) != 0) {
- LOG(WARNING) << "fail to find header file. [header_path=" <<
header_path << "]";
- move_to_trash(boost_schema_hash_path, boost_schema_hash_path);
- return OLAP_ERR_FILE_NOT_EXIST;
- }
-
- auto tablet = Tablet::create_from_header_file_for_check(
- tablet_id, schema_hash, header_path);
- if (tablet == NULL) {
- LOG(WARNING) << "fail to load tablet. [header_path=" << header_path <<
"]";
- move_to_trash(boost_schema_hash_path, boost_schema_hash_path);
- return OLAP_ERR_ENGINE_LOAD_INDEX_TABLE_ERROR;
- }
-
- LOG(INFO) << "data_file_type:" << tablet->data_file_type();
- if (tablet->data_file_type() == OLAP_DATA_FILE) {
- LOG(FATAL) << "Not support row-oriented tablet any more. Please
convert it to column-oriented tablet."
- << "tablet=" << tablet->full_name();
- }
-
- return OLAP_SUCCESS;
-}
-
void StorageEngine::load_stores(const std::vector<OlapStore*>& stores) {
std::vector<std::thread> threads;
for (auto store : stores) {
@@ -437,7 +327,6 @@ OLAPStatus StorageEngine::open() {
_max_base_compaction_task_per_disk = (base_compaction_num_threads +
file_system_num - 1) / file_system_num;
auto stores = get_stores();
- check_none_row_oriented_tablet(stores);
load_stores(stores);
// 取消未完成的SchemaChange任务
_cancel_unfinished_schema_change();
diff --git a/be/src/olap/storage_engine.h b/be/src/olap/storage_engine.h
index 38217ed7..d87db2a2 100644
--- a/be/src/olap/storage_engine.h
+++ b/be/src/olap/storage_engine.h
@@ -185,12 +185,6 @@ class StorageEngine {
// 获取cache的使用情况信息
void get_cache_status(rapidjson::Document* document) const;
- void check_none_row_oriented_tablet(const std::vector<OlapStore*>& stores);
- OLAPStatus check_none_row_oriented_tablet_in_path(
- OlapStore* store, TTabletId tablet_id,
- SchemaHash schema_hash, const std::string&
schema_hash_path);
- OLAPStatus _check_none_row_oriented_tablet_in_store(OlapStore* store);
-
// Note: 这里只能reload原先已经存在的root path,即re-load启动时就登记的root path
// 是允许的,但re-load全新的path是不允许的,因为此处没有彻底更新ce调度器信息
void load_stores(const std::vector<OlapStore*>& stores);
diff --git a/be/src/olap/store.cpp b/be/src/olap/store.cpp
index 2e6833c9..97953cd9 100755
--- a/be/src/olap/store.cpp
+++ b/be/src/olap/store.cpp
@@ -484,18 +484,9 @@ OLAPStatus
OlapStore::_load_tablet_from_header(StorageEngine* engine, TTabletId
LOG(WARNING) << "parse header string failed for tablet_id:" <<
tablet_id << " schema_hash:" << schema_hash;
return OLAP_ERR_HEADER_PB_PARSE_FAILED;
}
- OLAPStatus res = OLAP_SUCCESS;
- if (tablet_meta->file_version_size() != 0) {
- tablet_meta->change_file_version_to_delta();
- res = TabletMetaManager::save(this, tablet_id, schema_hash,
tablet_meta.get());
- }
- if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "fail to save header, tablet_id:" << tablet_id
- << ", schema_hash:" << schema_hash << " to path:" << path();
- return OLAP_ERR_HEADER_PUT;
- }
+
// init must be called
- res = tablet_meta->init();
+ OLAPStatus res = tablet_meta->init();
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "fail to init header, tablet_id:" << tablet_id << ",
schema_hash:" << schema_hash;
res = TabletMetaManager::remove(this, tablet_id, schema_hash);
@@ -562,38 +553,4 @@ OLAPStatus OlapStore::load_tables(StorageEngine* engine) {
return status;
}
-OLAPStatus OlapStore::check_none_row_oriented_tablet_in_store(StorageEngine*
engine) {
- auto load_tablet_func = [this, engine](long tablet_id,
- long schema_hash, const std::string& value) -> bool {
- OLAPStatus status = _check_none_row_oriented_tablet_in_store(engine,
tablet_id, schema_hash, value);
- if (status != OLAP_SUCCESS) {
- LOG(WARNING) << "load tablet from header failed. status:" << status
- << "tablet=" << tablet_id << "." << schema_hash;
- };
- return true;
- };
- OLAPStatus status = TabletMetaManager::traverse_headers(_meta,
load_tablet_func);
- return status;
-}
-
-OLAPStatus OlapStore::_check_none_row_oriented_tablet_in_store(
- StorageEngine* engine, TTabletId tablet_id,
- TSchemaHash schema_hash, const std::string& header) {
- std::unique_ptr<TabletMeta> tablet_meta(new TabletMeta());
- bool parsed = tablet_meta->ParseFromString(header);
- if (!parsed) {
- LOG(WARNING) << "parse header string failed for tablet_id:" <<
tablet_id << " schema_hash:" << schema_hash;
- return OLAP_ERR_HEADER_PB_PARSE_FAILED;
- }
- // init must be called
- RETURN_NOT_OK(tablet_meta->init());
- LOG(INFO) << "data_file_type:" << tablet_meta->data_file_type();
- if (tablet_meta->data_file_type() == OLAP_DATA_FILE) {
- LOG(FATAL) << "Not support row-oriented tablet any more. Please
convert it to column-oriented tablet."
- << "tablet=" << tablet_id << "." << schema_hash;
- }
-
- return OLAP_SUCCESS;
-}
-
} // namespace doris
diff --git a/be/src/olap/store.h b/be/src/olap/store.h
index d2454266..5efbc85f 100644
--- a/be/src/olap/store.h
+++ b/be/src/olap/store.h
@@ -80,11 +80,6 @@ class OlapStore {
static std::string get_root_path_from_schema_hash_path_in_trash(const
std::string& schema_hash_dir_in_trash);
OLAPStatus load_tables(StorageEngine* engine);
- OLAPStatus check_none_row_oriented_tablet_in_store(StorageEngine* engine);
- OLAPStatus _check_none_row_oriented_tablet_in_store(
- StorageEngine* engine, TTabletId tablet_id,
- TSchemaHash schema_hash, const std::string& header);
-
private:
std::string _cluster_id_path() const { return _path + CLUSTER_ID_PREFIX; }
Status _init_cluster_id();
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 1f77bfea..8e707cc4 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -89,44 +89,6 @@ TabletSharedPtr Tablet::create_from_header_file(
return create_from_header(tablet_meta, store);
}
-TabletSharedPtr Tablet::create_from_header_file_for_check(
- TTabletId tablet_id, TSchemaHash schema_hash, const string&
header_file) {
- TabletMeta* tablet_meta = NULL;
-
- tablet_meta = new(nothrow) TabletMeta(header_file);
- if (tablet_meta == NULL) {
- OLAP_LOG_WARNING("fail to malloc TabletMeta.");
- return NULL;
- }
-
- if (tablet_meta->load_for_check() != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to load tablet_meta. [header_file=%s]",
header_file.c_str());
- delete tablet_meta;
- return NULL;
- }
-
- TabletSharedPtr tablet = std::make_shared<Tablet>(tablet_meta);
- if (tablet == NULL) {
- OLAP_LOG_WARNING("fail to validate tablet. [header_file=%s]",
header_file.c_str());
- delete tablet_meta;
- return NULL;
- }
- tablet->_tablet_id = tablet_id;
- tablet->_schema_hash = schema_hash;
- tablet->_full_name = std::to_string(tablet_id) + "." +
std::to_string(schema_hash);
- return tablet;
-}
-
-Tablet::Tablet(TabletMeta* tablet_meta)
- : _tablet_meta(tablet_meta) {
- if (tablet_meta->has_tablet_id()) {
- _tablet_id = tablet_meta->tablet_id();
- _schema_hash = tablet_meta->schema_hash();
- _full_name = std::to_string(tablet_meta->tablet_id()) + "." +
std::to_string(tablet_meta->schema_hash());
- }
- _tablet_for_check = true;
-}
-
TabletSharedPtr Tablet::create_from_header(
TabletMeta* tablet_meta,
OlapStore* store) {
@@ -145,7 +107,6 @@ Tablet::Tablet(TabletMeta* tablet_meta, OlapStore* store) :
_num_fields(0),
_num_null_fields(0),
_num_key_fields(0),
- _id(0),
_store(store),
_is_loaded(false) {
if (tablet_meta == NULL) {
@@ -233,14 +194,9 @@ Tablet::Tablet(TabletMeta* tablet_meta, OlapStore* store) :
_tablet_path = tablet_path_stream.str();
_storage_root_path = store->path();
_full_name = std::to_string(tablet_meta->tablet_id()) + "." +
std::to_string(tablet_meta->schema_hash());
- _tablet_for_check = false;
}
Tablet::~Tablet() {
- if (_tablet_for_check) {
- return;
- }
-
if (_tablet_meta == NULL) {
return; // for convenience of mock test.
}
@@ -2016,42 +1972,6 @@ int32_t Tablet::get_field_index(const string&
field_name) const {
return res_iterator->second;
}
-size_t Tablet::get_field_size(const string& field_name) const {
- field_index_map_t::const_iterator res_iterator =
_field_index_map.find(field_name);
- if (res_iterator == _field_index_map.end()) {
- LOG(WARNING) << "invalid field name. [name='" << field_name << "']";
- return 0;
- }
-
- if (static_cast<size_t>(res_iterator->second) >= _field_sizes.size()) {
- LOG(WARNING) << "invalid field segment_group. [name='" << field_name
<< "']";
- return 0;
- }
-
- return _field_sizes[res_iterator->second];
-}
-
-size_t Tablet::get_return_column_size(const string& field_name) const {
- field_index_map_t::const_iterator res_iterator =
_field_index_map.find(field_name);
- if (res_iterator == _field_index_map.end()) {
- LOG(WARNING) << "invalid field name. [name='" << field_name << "']";
- return 0;
- }
-
- if (static_cast<size_t>(res_iterator->second) >= _field_sizes.size()) {
- LOG(WARNING) << "invalid field segment_group. [name='" << field_name
<< "']";
- return 0;
- }
-
- if (_tablet_schema[res_iterator->second].type == OLAP_FIELD_TYPE_VARCHAR ||
- _tablet_schema[res_iterator->second].type == OLAP_FIELD_TYPE_HLL) {
- return 0;
- }
-
- return _field_sizes[res_iterator->second];
-}
-
-
size_t Tablet::get_row_size() const {
size_t size = 0u;
vector<int32_t>::const_iterator it;
@@ -2204,15 +2124,6 @@ VersionEntity
Tablet::get_version_entity_by_version(const Version& version) {
return version_entity;
}
-size_t Tablet::get_version_index_size(const Version& version) {
- std::vector<SegmentGroup*>& index_vec = _data_sources[version];
- size_t index_size = 0;
- for (SegmentGroup* segment_group : index_vec) {
- index_size += segment_group->index_size();
- }
- return index_size;
-}
-
size_t Tablet::get_version_data_size(const Version& version) {
std::vector<SegmentGroup*>& index_vec = _data_sources[version];
size_t data_size = 0;
diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h
index bad25cf5..8d422a61 100644
--- a/be/src/olap/tablet.h
+++ b/be/src/olap/tablet.h
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-#ifndef DORIS_BE_SRC_OLAP_OLAP_TABLE_H
-#define DORIS_BE_SRC_OLAP_OLAP_TABLE_H
+#ifndef DORIS_BE_SRC_OLAP_TABLET_H
+#define DORIS_BE_SRC_OLAP_TABLET_H
#include <functional>
#include <memory>
@@ -46,44 +46,6 @@ class OlapStore;
// Define Tablet's shared_ptr. It is used for
typedef std::shared_ptr<Tablet> TabletSharedPtr;
-enum BaseCompactionStage {
- BASE_COMPACTION_WAITING = 0,
- BASE_COMPACTION_RUNNING = 1,
-};
-
-struct BaseCompactionStatus {
- BaseCompactionStatus() : status(BASE_COMPACTION_WAITING), version(-1) {}
-
- BaseCompactionStage status;
- int32_t version;
-};
-
-enum PushStage {
- PUSH_WAITING = 0,
- PUSH_RUNNING = 1,
-};
-
-struct PushStatus {
- PushStatus() : status(PUSH_WAITING), version(-1) {}
-
- PushStage status;
- int32_t version;
-};
-
-enum SyncStage {
- SYNC_WAITING = 0,
- SYNC_RUNNING = 1,
- SYNC_DONE = 2,
- SYNC_FAILED = 3,
-};
-
-struct SyncStatus {
- SyncStatus() : status(SYNC_WAITING), version(-1) {}
-
- SyncStage status;
- int32_t version;
-};
-
struct SchemaChangeStatus {
SchemaChangeStatus() : status(ALTER_TABLE_WAITING), schema_hash(0),
version(-1) {}
@@ -99,17 +61,11 @@ class Tablet : public std::enable_shared_from_this<Tablet> {
TSchemaHash schema_hash,
const std::string& header_file,
OlapStore* store = nullptr);
- static TabletSharedPtr create_from_header_file_for_check(
- TTabletId tablet_id,
- TSchemaHash schema_hash,
- const std::string& header_file);
-
static TabletSharedPtr create_from_header(
TabletMeta* header,
OlapStore* store = nullptr);
explicit Tablet(TabletMeta* header, OlapStore* store);
- explicit Tablet(TabletMeta* header);
virtual ~Tablet();
@@ -348,18 +304,11 @@ class Tablet : public
std::enable_shared_from_this<Tablet> {
// Return -1 if field name is invalid, else return field index in schema.
int32_t get_field_index(const std::string& field_name) const;
- // Return 0 if file_name is invalid, else return field size in schema.
- size_t get_field_size(const std::string& field_name) const;
-
- size_t get_return_column_size(const std::string& field_name) const;
-
// One row in a specified Tablet comprises of fixed number of columns
// with fixed length.
size_t get_row_size() const;
// Get tablet statistics for SHOW STATUS
- size_t get_index_size() const;
-
int64_t get_data_size() const;
int64_t get_num_rows() const;
@@ -370,10 +319,6 @@ class Tablet : public std::enable_shared_from_this<Tablet>
{
return _full_name;
}
- void set_full_name(std::string full_name) {
- _full_name = full_name;
- }
-
std::vector<FieldInfo>& tablet_schema() {
return _tablet_schema;
}
@@ -407,10 +352,6 @@ class Tablet : public std::enable_shared_from_this<Tablet>
{
return _tablet_id;
}
- void set_tablet_id(TTabletId tablet_id) {
- _tablet_id = tablet_id;
- }
-
size_t num_short_key_fields() const {
return _tablet_meta->num_short_key_fields();
}
@@ -472,10 +413,6 @@ class Tablet : public std::enable_shared_from_this<Tablet>
{
return _tablet_meta->delete_version(version);
}
- const OLAPStatus version_creation_time(const Version& version, int64_t*
creation_time) {
- return _tablet_meta->version_creation_time(version, creation_time);
- }
-
DataFileType data_file_type() const {
return _tablet_meta->data_file_type();
}
@@ -658,13 +595,8 @@ class Tablet : public std::enable_shared_from_this<Tablet>
{
OLAPStatus test_version(const Version& version);
VersionEntity get_version_entity_by_version(const Version& version);
- size_t get_version_index_size(const Version& version);
size_t get_version_data_size(const Version& version);
- bool is_dropped() {
- return _is_dropped;
- }
-
OLAPStatus recover_tablet_until_specfic_version(const int64_t&
until_version,
const int64_t&
version_hash);
private:
@@ -744,11 +676,10 @@ class Tablet : public
std::enable_shared_from_this<Tablet> {
Mutex _load_lock;
std::string _tablet_path;
- bool _tablet_for_check;
-
DISALLOW_COPY_AND_ASSIGN(Tablet);
};
+
} // namespace doris
-#endif // DORIS_BE_SRC_OLAP_OLAP_TABLE_H
+#endif // DORIS_BE_SRC_OLAP_TABLET_H
diff --git a/be/src/olap/tablet_meta.cpp b/be/src/olap/tablet_meta.cpp
index 32afd298..9700b4c0 100644
--- a/be/src/olap/tablet_meta.cpp
+++ b/be/src/olap/tablet_meta.cpp
@@ -79,18 +79,6 @@ TabletMeta::~TabletMeta() {
Clear();
}
-void TabletMeta::change_file_version_to_delta() {
- // convert FileVersionMessage to PDelta and PSegmentGroup in
initialization.
- // FileVersionMessage is used in previous code, and PDelta and
PSegmentGroup
- // is used in streaming load branch.
- for (int i = 0; i < file_version_size(); ++i) {
- PDelta* delta = add_delta();
- _convert_file_version_to_delta(file_version(i), delta);
- }
-
- clear_file_version();
-}
-
OLAPStatus TabletMeta::init() {
clear_version_graph(&_version_graph, &_vertex_helper_map);
if (construct_version_graph(delta(),
@@ -135,47 +123,9 @@ OLAPStatus TabletMeta::load_and_init() {
return OLAP_ERR_PARSE_PROTOBUF_ERROR;
}
- if (file_version_size() != 0) {
- // convert FileVersionMessage to PDelta and PSegmentGroup in
initialization.
- for (int i = 0; i < file_version_size(); ++i) {
- PDelta* delta = add_delta();
- _convert_file_version_to_delta(file_version(i), delta);
- }
-
- clear_file_version();
- OLAPStatus res = save();
- if (res != OLAP_SUCCESS) {
- LOG(FATAL) << "failed to remove file version in initialization";
- }
- }
return init();
}
-OLAPStatus TabletMeta::load_for_check() {
- FileHeader<OLAPHeaderMessage> file_header;
- FileHandler file_handler;
-
- if (file_handler.open(_file_name.c_str(), O_RDONLY) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to open index file. [file='%s']",
_file_name.c_str());
- return OLAP_ERR_IO_ERROR;
- }
-
- // In file_header.unserialize(), it validates file length, signature,
checksum of protobuf.
- if (file_header.unserialize(&file_handler) != OLAP_SUCCESS) {
- OLAP_LOG_WARNING("fail to unserialize header. [path='%s']",
_file_name.c_str());
- return OLAP_ERR_PARSE_PROTOBUF_ERROR;
- }
-
- try {
- CopyFrom(file_header.message());
- } catch (...) {
- OLAP_LOG_WARNING("fail to copy protocol buffer object. [path='%s']",
_file_name.c_str());
- return OLAP_ERR_PARSE_PROTOBUF_ERROR;
- }
-
- return OLAP_SUCCESS;
-}
-
OLAPStatus TabletMeta::save() {
return save(_file_name);
}
@@ -613,18 +563,6 @@ OLAPStatus TabletMeta::select_versions_to_span(const
Version& target_version,
int start_vertex_index = -1;
// -1 is valid vertex index.
int end_vertex_index = -1;
- // Sometimes, the version path can not have reverse version even you set
- // _support_reverse_version to be true.
- bool can_support_reverse = _support_reverse_version;
-
- // Check schema to see if we can support reverse version in the version
- // path. If the aggregation type of any value column is SUM, then we can
- // not support reverse version.
- for (int i = 0; can_support_reverse && i < column_size(); ++i) {
- if (column(i).is_key() == false &&
column(i).aggregation().compare("SUM") != 0) {
- can_support_reverse = false;
- }
- }
for (size_t i = 0; i < _version_graph.size(); ++i) {
if (_version_graph[i].value == start_vertex_value) {
@@ -663,8 +601,7 @@ OLAPStatus TabletMeta::select_versions_to_span(const
Version& target_version,
if (visited[*it] == false) {
// If we don't support reverse version in the path, and start
vertex
// value is larger than the end vertex value, we skip this
edge.
- if (can_support_reverse == false
- && _version_graph[top_vertex_index].value >
_version_graph[*it].value) {
+ if (_version_graph[top_vertex_index].value >
_version_graph[*it].value) {
continue;
}
@@ -771,27 +708,6 @@ const PDelta* TabletMeta::get_delta(int index) const {
return &delta(index);
}
-void TabletMeta::_convert_file_version_to_delta(const FileVersionMessage&
version,
- PDelta* delta) {
- delta->set_start_version(version.start_version());
- delta->set_end_version(version.end_version());
- delta->set_version_hash(version.version_hash());
- delta->set_creation_time(version.creation_time());
-
- PSegmentGroup* segment_group = delta->add_segment_group();
- segment_group->set_segment_group_id(-1);
- segment_group->set_num_segments(version.num_segments());
- segment_group->set_index_size(version.index_size());
- segment_group->set_data_size(version.data_size());
- segment_group->set_num_rows(version.num_rows());
- if (version.has_delta_pruning()) {
- for (int i = 0; i < version.delta_pruning().column_pruning_size();
++i) {
- ColumnPruning* column_pruning =
segment_group->add_column_pruning();
- *column_pruning = version.delta_pruning().column_pruning(i);
- }
- }
-}
-
const uint32_t TabletMeta::get_cumulative_compaction_score() const{
uint32_t score = 0;
bool base_version_exists = false;
@@ -828,23 +744,6 @@ const uint32_t TabletMeta::get_base_compaction_score()
const{
return base_version_exists ? score : 0;
}
-const OLAPStatus TabletMeta::version_creation_time(const Version& version,
- int64_t* creation_time)
const {
- if (delta_size() == 0) {
- return OLAP_ERR_VERSION_NOT_EXIST;
- }
-
- for (int i = delta_size() - 1; i >= 0; --i) {
- const PDelta& temp = delta(i);
- if (temp.start_version() == version.first && temp.end_version() ==
version.second) {
- *creation_time = temp.creation_time();
- return OLAP_SUCCESS;
- }
- }
-
- return OLAP_ERR_VERSION_NOT_EXIST;
-}
-
// Related static functions about version graph.
#define CHECK_GRAPH_PARAMS(param1, param2) \
@@ -962,8 +861,7 @@ static OLAPStatus add_version_to_graph(const Version&
version,
list<int>* edges = (*version_graph)[start_vertex_index].edges;
edges->insert(edges->begin(), end_vertex_index);
- // We add reverse edge(from end_version to start_version) to graph in spite
- // that _support_reverse_version is false.
+ // We add reverse edge(from end_version to start_version) to graph
list<int>* r_edges = (*version_graph)[end_vertex_index].edges;
r_edges->insert(r_edges->begin(), start_vertex_index);
diff --git a/be/src/olap/tablet_meta.h b/be/src/olap/tablet_meta.h
index 27ac584a..e3e4b39d 100644
--- a/be/src/olap/tablet_meta.h
+++ b/be/src/olap/tablet_meta.h
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-#ifndef DORIS_BE_SRC_OLAP_OLAP_HEADER_H
-#define DORIS_BE_SRC_OLAP_OLAP_HEADER_H
+#ifndef DORIS_BE_SRC_OLAP_TABLET_META_H
+#define DORIS_BE_SRC_OLAP_TABLET_META_H
#include <list>
#include <string>
@@ -32,13 +32,11 @@ namespace doris {
// Class for managing tablet header.
class TabletMeta : public OLAPHeaderMessage {
public:
- explicit TabletMeta() :
- _support_reverse_version(false) {}
+ explicit TabletMeta() {}
// for compatible header file
explicit TabletMeta(const std::string& file_name) :
- _file_name(file_name),
- _support_reverse_version(false) {}
+ _file_name(file_name) {}
virtual ~TabletMeta();
@@ -46,7 +44,6 @@ class TabletMeta : public OLAPHeaderMessage {
// In load_and_init(), we will validate olap header file, which mainly
include
// tablet schema, delta version and so on.
OLAPStatus load_and_init();
- OLAPStatus load_for_check();
// Saves the header to disk, returning true on success.
OLAPStatus save();
@@ -96,13 +93,6 @@ class TabletMeta : public OLAPHeaderMessage {
return std::string(basename(_file_name.c_str()));
}
- // In order to prevent reverse version to appear in the shortest version
- // path, you can call set_reverse_version(false) although schema can
- // support reverse version in the path.
- void set_reverse_version(bool support_reverse_version) {
- _support_reverse_version = support_reverse_version;
- }
-
// Try to select the least number of data files that can span the
// target_version and append these data versions to the span_versions.
// Return false if the target_version cannot be spanned.
@@ -116,28 +106,13 @@ class TabletMeta : public OLAPHeaderMessage {
const PDelta* get_base_version() const;
const uint32_t get_cumulative_compaction_score() const;
const uint32_t get_base_compaction_score() const;
- const OLAPStatus version_creation_time(const Version& version, int64_t*
creation_time) const;
-
int file_delta_size() const {
return delta_size();
}
- void change_file_version_to_delta();
private:
- // Compute schema hash(all fields name and type, index name and its field
- // names) using lzo_adler32 function.
- OLAPStatus _compute_schema_hash(SchemaHash* schema_hash);
- void _convert_file_version_to_delta(const FileVersionMessage& version,
PDelta* delta);
-
// full path of olap header file
std::string _file_name;
- // If the aggregation types of all value columns in the schema are SUM,
- // select_versions_to_span can return reverse version in the shortest
- // version path. one can set _support_reverse_version to be false in
- // order to prevent reverse version to appear in the shortest version path.
- // Its default value is false.
- bool _support_reverse_version;
-
// OLAP version contains two parts, [start_version, end_version]. In order
// to construct graph, the OLAP version has two corresponding vertex, one
// vertex's value is version.start_version, the other is
@@ -148,10 +123,10 @@ class TabletMeta : public OLAPHeaderMessage {
// vertex value --> vertex_index of _version_graph
// It is easy to find vertex index according to vertex value.
std::unordered_map<int, int> _vertex_helper_map;
-
+
DISALLOW_COPY_AND_ASSIGN(TabletMeta);
};
} // namespace doris
-#endif // DORIS_BE_SRC_OLAP_OLAP_HEADER_H
+#endif // DORIS_BE_SRC_OLAP_OLAP_TABLET_META_H
diff --git a/be/src/olap/tablet_meta_manager.h
b/be/src/olap/tablet_meta_manager.h
index 5154fb91..045d4e0b 100644
--- a/be/src/olap/tablet_meta_manager.h
+++ b/be/src/olap/tablet_meta_manager.h
@@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.
-#ifndef DORIS_BE_SRC_OLAP_OLAP_HEADER_MANAGER_H
-#define DORIS_BE_SRC_OLAP_OLAP_HEADER_MANAGER_H
+#ifndef DORIS_BE_SRC_OLAP_TABLET_META_MANAGER_H
+#define DORIS_BE_SRC_OLAP_TABLET_META_MANAGER_H
#include <string>
@@ -53,4 +53,4 @@ class TabletMetaManager {
}
-#endif // DORIS_BE_SRC_OLAP_OLAP_HEADER_MANAGER_H
+#endif // DORIS_BE_SRC_OLAP_TABLET_META_MANAGER_H
----------------------------------------------------------------
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]