This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push: new aea3e4e [refactor] Remove version hash from BE and related test in BE (#8027) aea3e4e is described below commit aea3e4e59bbaa7a2a610ac1ea9b41f7bed3ee0ca Author: yiguolei <676222...@qq.com> AuthorDate: Mon Feb 14 09:29:27 2022 +0800 [refactor] Remove version hash from BE and related test in BE (#8027) --- be/src/agent/task_worker_pool.cpp | 10 +- be/src/exec/olap_scan_node.cpp | 1 - be/src/http/action/checksum_action.cpp | 20 +- be/src/http/action/checksum_action.h | 2 +- be/src/olap/compaction.cpp | 2 - be/src/olap/compaction.h | 1 - be/src/olap/olap_common.h | 1 - be/src/olap/olap_define.h | 1 - be/src/olap/rowset/alpha_rowset.cpp | 10 +- be/src/olap/rowset/alpha_rowset.h | 2 +- be/src/olap/rowset/alpha_rowset_reader.cpp | 4 - be/src/olap/rowset/alpha_rowset_reader.h | 2 - be/src/olap/rowset/alpha_rowset_writer.cpp | 3 +- be/src/olap/rowset/beta_rowset_reader.h | 2 - be/src/olap/rowset/beta_rowset_writer.cpp | 1 - be/src/olap/rowset/column_data.h | 1 - be/src/olap/rowset/rowset.cpp | 5 +- be/src/olap/rowset/rowset.h | 5 +- be/src/olap/rowset/rowset_converter.cpp | 1 - be/src/olap/rowset/rowset_meta.h | 6 - be/src/olap/rowset/rowset_reader.h | 2 - be/src/olap/rowset/rowset_writer_context.h | 2 - be/src/olap/rowset/segment_group.cpp | 19 +- be/src/olap/rowset/segment_group.h | 5 +- be/src/olap/schema_change.cpp | 19 +- be/src/olap/schema_change.h | 2 +- be/src/olap/snapshot_manager.cpp | 1 - be/src/olap/tablet.cpp | 40 +- be/src/olap/tablet.h | 7 +- be/src/olap/tablet_manager.cpp | 1 - be/src/olap/task/engine_checksum_task.cpp | 4 +- be/src/olap/task/engine_checksum_task.h | 3 +- be/src/olap/task/engine_publish_version_task.cpp | 5 +- be/src/olap/txn_manager.cpp | 10 +- be/src/olap/txn_manager.h | 5 +- be/src/runtime/fragment_mgr.cpp | 3 +- be/src/runtime/snapshot_loader.cpp | 19 - be/src/runtime/snapshot_loader.h | 5 - be/test/exec/new_olap_scan_node_test.cpp | 3 + be/test/exec/olap_common_test.cpp | 1 + be/test/exec/olap_scan_node_test.cpp | 1 + be/test/exec/olap_scanner_test.cpp | 1 + be/test/olap/cumulative_compaction_policy_test.cpp | 2 - be/test/olap/delete_handler_test.cpp | 2 - be/test/olap/delta_writer_test.cpp | 14 +- be/test/olap/rowset/rowset_converter_test.cpp | 1 - be/test/olap/tablet_meta_manager_test.cpp | 1 - be/test/olap/tablet_mgr_test.cpp | 3 - be/test/olap/tablet_test.cpp | 1 - .../data/0/15007/368169781/olap_header.json | 676 --------------------- be/test/olap/test_data/header.txt | 197 ------ be/test/olap/test_data/header_without_inc_rs.txt | 2 - be/test/olap/test_data/rowset.json | 1 - be/test/olap/test_data/rowset_meta.json | 1 - be/test/olap/timestamped_version_tracker_test.cpp | 1 - be/test/olap/txn_manager_test.cpp | 6 +- be/test/runtime/snapshot_loader_test.cpp | 7 - .../operation/be-olap-error-code.md | 1 - .../operation/be-olap-error-code.md | 1 - gensrc/thrift/MetaStoreService.thrift | 157 ----- 60 files changed, 73 insertions(+), 1239 deletions(-) diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index 777c20d..a0eaf57 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -383,7 +383,8 @@ void TaskWorkerPool::_create_tablet_worker_thread_callback() { tablet_info.tablet_id = tablet->table_id(); tablet_info.schema_hash = tablet->schema_hash(); tablet_info.version = create_tablet_req.version; - tablet_info.version_hash = create_tablet_req.version_hash; + // Useless but it is a required field in TTabletInfo + tablet_info.version_hash = 0; tablet_info.row_count = 0; tablet_info.data_size = 0; tablet_info.__set_path_hash(tablet->data_dir()->path_hash()); @@ -662,7 +663,6 @@ void TaskWorkerPool::_push_worker_thread_callback() { finish_task_request.__set_signature(agent_task_req.signature); if (push_req.push_type == TPushType::DELETE) { finish_task_request.__set_request_version(push_req.version); - finish_task_request.__set_request_version_hash(push_req.version_hash); } if (status == DORIS_SUCCESS) { @@ -1074,7 +1074,7 @@ void TaskWorkerPool::_check_consistency_worker_thread_callback() { uint32_t checksum = 0; EngineChecksumTask engine_task( check_consistency_req.tablet_id, check_consistency_req.schema_hash, - check_consistency_req.version, check_consistency_req.version_hash, &checksum); + check_consistency_req.version, &checksum); OLAPStatus res = _env->storage_engine()->execute_task(&engine_task); if (res != OLAP_SUCCESS) { LOG(WARNING) << "check consistency failed. status: " << res @@ -1095,7 +1095,6 @@ void TaskWorkerPool::_check_consistency_worker_thread_callback() { finish_task_request.__set_task_status(task_status); finish_task_request.__set_tablet_checksum(static_cast<int64_t>(checksum)); finish_task_request.__set_request_version(check_consistency_req.version); - finish_task_request.__set_request_version_hash(check_consistency_req.version_hash); _finish_task(finish_task_request); _remove_task_info(agent_task_req.task_type, agent_task_req.signature); @@ -1404,7 +1403,6 @@ void TaskWorkerPool::_make_snapshot_thread_callback() { LOG(WARNING) << "make_snapshot failed. tablet_id:" << snapshot_request.tablet_id << ", schema_hash:" << snapshot_request.schema_hash << ", version:" << snapshot_request.version - << ", version_hash:" << snapshot_request.version_hash << ", status: " << make_snapshot_status; error_msgs.push_back("make_snapshot failed. status: " + boost::lexical_cast<string>(make_snapshot_status)); @@ -1412,7 +1410,6 @@ void TaskWorkerPool::_make_snapshot_thread_callback() { LOG(INFO) << "make_snapshot success. tablet_id:" << snapshot_request.tablet_id << ", schema_hash:" << snapshot_request.schema_hash << ", version:" << snapshot_request.version - << ", version_hash:" << snapshot_request.version_hash << ", snapshot_path:" << snapshot_path; if (snapshot_request.__isset.list_files) { // list and save all snapshot files @@ -1427,7 +1424,6 @@ void TaskWorkerPool::_make_snapshot_thread_callback() { LOG(WARNING) << "make_snapshot failed. tablet_id:" << snapshot_request.tablet_id << ", schema_hash:" << snapshot_request.schema_hash << ", version:" << snapshot_request.version - << ", version_hash:" << snapshot_request.version_hash << ",list file failed: " << st.get_error_msg(); error_msgs.push_back("make_snapshot failed. list file failed: " + st.get_error_msg()); diff --git a/be/src/exec/olap_scan_node.cpp b/be/src/exec/olap_scan_node.cpp index 48f0ab0..4b1f775 100644 --- a/be/src/exec/olap_scan_node.cpp +++ b/be/src/exec/olap_scan_node.cpp @@ -425,7 +425,6 @@ Status OlapScanNode::close(RuntimeState* state) { // 1: required list<Types.TNetworkAddress> hosts // 2: required string schema_hash // 3: required string version -// 4: required string version_hash // 5: required Types.TTabletId tablet_id // 6: required string db_name // 7: optional list<TKeyRange> partition_column_ranges diff --git a/be/src/http/action/checksum_action.cpp b/be/src/http/action/checksum_action.cpp index f65a86a..d1757d8 100644 --- a/be/src/http/action/checksum_action.cpp +++ b/be/src/http/action/checksum_action.cpp @@ -39,7 +39,6 @@ const std::string TABLET_ID = "tablet_id"; // do not use name "VERSION", // or will be conflict with "VERSION" in thrift/config.h const std::string TABLET_VERSION = "version"; -const std::string VERSION_HASH = "version_hash"; const std::string SCHEMA_HASH = "schema_hash"; ChecksumAction::ChecksumAction(ExecEnv* exec_env) : _exec_env(exec_env) {} @@ -67,14 +66,6 @@ void ChecksumAction::handle(HttpRequest* req) { return; } - // Get version hash - const std::string& version_hash_str = req->param(VERSION_HASH); - if (version_hash_str.empty()) { - std::string error_msg = std::string("parameter " + VERSION_HASH + " not specified in url."); - HttpChannel::send_reply(req, HttpStatus::BAD_REQUEST, error_msg); - return; - } - // Get schema hash const std::string& schema_hash_str = req->param(SCHEMA_HASH); if (schema_hash_str.empty()) { @@ -86,12 +77,10 @@ void ChecksumAction::handle(HttpRequest* req) { // valid str format int64_t tablet_id; int64_t version; - int64_t version_hash; int32_t schema_hash; try { tablet_id = boost::lexical_cast<int64_t>(tablet_id_str); version = boost::lexical_cast<int64_t>(version_str); - version_hash = boost::lexical_cast<int64_t>(version_hash_str); schema_hash = boost::lexical_cast<int64_t>(schema_hash_str); } catch (boost::bad_lexical_cast& e) { std::string error_msg = std::string("param format is invalid: ") + std::string(e.what()); @@ -99,10 +88,9 @@ void ChecksumAction::handle(HttpRequest* req) { return; } - VLOG_ROW << "get checksum tablet info: " << tablet_id << "-" << version << "-" << version_hash - << "-" << schema_hash; + VLOG_ROW << "get checksum tablet info: " << tablet_id << "-" << version << "-" << schema_hash; - int64_t checksum = do_checksum(tablet_id, version, version_hash, schema_hash, req); + int64_t checksum = do_checksum(tablet_id, version, schema_hash, req); if (checksum == -1L) { std::string error_msg = std::string("checksum failed"); HttpChannel::send_reply(req, HttpStatus::INTERNAL_SERVER_ERROR, error_msg); @@ -117,11 +105,11 @@ void ChecksumAction::handle(HttpRequest* req) { LOG(INFO) << "deal with checksum request finished! tablet id: " << tablet_id; } -int64_t ChecksumAction::do_checksum(int64_t tablet_id, int64_t version, int64_t version_hash, +int64_t ChecksumAction::do_checksum(int64_t tablet_id, int64_t version, int32_t schema_hash, HttpRequest* req) { OLAPStatus res = OLAP_SUCCESS; uint32_t checksum; - EngineChecksumTask engine_task(tablet_id, schema_hash, version, version_hash, &checksum); + EngineChecksumTask engine_task(tablet_id, schema_hash, version, &checksum); res = engine_task.execute(); if (res != OLAP_SUCCESS) { LOG(WARNING) << "checksum failed. status: " << res << ", signature: " << tablet_id; diff --git a/be/src/http/action/checksum_action.h b/be/src/http/action/checksum_action.h index 302a83b..9b85429 100644 --- a/be/src/http/action/checksum_action.h +++ b/be/src/http/action/checksum_action.h @@ -35,7 +35,7 @@ public: void handle(HttpRequest* req) override; private: - int64_t do_checksum(int64_t tablet_id, int64_t version, int64_t version_hash, + int64_t do_checksum(int64_t tablet_id, int64_t version, int32_t schema_hash, HttpRequest* req); ExecEnv* _exec_env; diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp index d6fc2e9..8576292 100644 --- a/be/src/olap/compaction.cpp +++ b/be/src/olap/compaction.cpp @@ -80,7 +80,6 @@ OLAPStatus Compaction::do_compaction_impl(int64_t permits) { _output_version = Version(_input_rowsets.front()->start_version(), _input_rowsets.back()->end_version()); - _tablet->compute_version_hash_from_rowsets(_input_rowsets, &_output_version_hash); LOG(INFO) << "start " << compaction_name() << ". tablet=" << _tablet->full_name() << ", output_version=" << _output_version << ", permits: " << permits; @@ -163,7 +162,6 @@ OLAPStatus Compaction::construct_output_rowset_writer() { context.tablet_schema = &(_tablet->tablet_schema()); context.rowset_state = VISIBLE; context.version = _output_version; - context.version_hash = _output_version_hash; context.segments_overlap = NONOVERLAPPING; context.parent_mem_tracker = _writer_tracker; // The test results show that one rs writer is low-memory-footprint, there is no need to tracker its mem pool diff --git a/be/src/olap/compaction.h b/be/src/olap/compaction.h index f27944f..6e7985a 100644 --- a/be/src/olap/compaction.h +++ b/be/src/olap/compaction.h @@ -103,7 +103,6 @@ protected: CompactionState _state; Version _output_version; - VersionHash _output_version_hash; DISALLOW_COPY_AND_ASSIGN(Compaction); }; diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h index 623528d..470efee 100644 --- a/be/src/olap/olap_common.h +++ b/be/src/olap/olap_common.h @@ -44,7 +44,6 @@ namespace doris { static const int64_t MAX_ROWSET_ID = 1L << 56; typedef int32_t SchemaHash; -typedef int64_t VersionHash; typedef __int128 int128_t; typedef unsigned __int128 uint128_t; diff --git a/be/src/olap/olap_define.h b/be/src/olap/olap_define.h index c720177..6a3f4d6 100644 --- a/be/src/olap/olap_define.h +++ b/be/src/olap/olap_define.h @@ -240,7 +240,6 @@ enum OLAPStatus { OLAP_ERR_BE_VERSION_NOT_MATCH = -800, OLAP_ERR_BE_REPLACE_VERSIONS_ERROR = -801, OLAP_ERR_BE_MERGE_ERROR = -802, - OLAP_ERR_BE_COMPUTE_VERSION_HASH_ERROR = -803, OLAP_ERR_CAPTURE_ROWSET_ERROR = -804, OLAP_ERR_BE_SAVE_HEADER_ERROR = -805, OLAP_ERR_BE_INIT_OLAP_DATA = -806, diff --git a/be/src/olap/rowset/alpha_rowset.cpp b/be/src/olap/rowset/alpha_rowset.cpp index 62ae5c9..53c695f 100644 --- a/be/src/olap/rowset/alpha_rowset.cpp +++ b/be/src/olap/rowset/alpha_rowset.cpp @@ -35,15 +35,14 @@ OLAPStatus AlphaRowset::do_load(bool use_cache) { // validate segment group if (segment_group->validate() != OLAP_SUCCESS) { LOG(WARNING) << "fail to validate segment_group. [version=" << start_version() << "-" - << end_version() << " version_hash=" << version_hash(); + << end_version(); // if load segment group failed, rowset init failed return OLAP_ERR_TABLE_INDEX_VALIDATE_ERROR; } OLAPStatus res = segment_group->load(use_cache); if (res != OLAP_SUCCESS) { LOG(WARNING) << "fail to load segment_group. res=" << res << ", " - << "version=" << start_version() << "-" << end_version() << ", " - << "version_hash=" << version_hash(); + << "version=" << start_version() << "-" << end_version(); return res; } } @@ -79,7 +78,7 @@ OLAPStatus AlphaRowset::remove() { return OLAP_SUCCESS; } -void AlphaRowset::make_visible_extra(Version version, VersionHash version_hash) { +void AlphaRowset::make_visible_extra(Version version) { AlphaRowsetMetaSharedPtr alpha_rowset_meta = std::dynamic_pointer_cast<AlphaRowsetMeta>(_rowset_meta); std::vector<SegmentGroupPB> published_segment_groups; @@ -87,7 +86,6 @@ void AlphaRowset::make_visible_extra(Version version, VersionHash version_hash) int32_t segment_group_idx = 0; for (auto& segment_group : _segment_groups) { segment_group->set_version(version); - segment_group->set_version_hash(version_hash); segment_group->set_pending_finished(); published_segment_groups.at(segment_group_idx).clear_load_id(); ++segment_group_idx; @@ -322,7 +320,7 @@ OLAPStatus AlphaRowset::init() { } else { segment_group.reset(new SegmentGroup( _rowset_meta->tablet_id(), _rowset_meta->rowset_id(), _schema, _rowset_path_desc.filepath, - _rowset_meta->version(), _rowset_meta->version_hash(), false, + _rowset_meta->version(), false, segment_group_meta.segment_group_id(), segment_group_meta.num_segments())); } if (segment_group == nullptr) { diff --git a/be/src/olap/rowset/alpha_rowset.h b/be/src/olap/rowset/alpha_rowset.h index 78ad5f1..364d59d 100644 --- a/be/src/olap/rowset/alpha_rowset.h +++ b/be/src/olap/rowset/alpha_rowset.h @@ -80,7 +80,7 @@ protected: void do_close() override {} // add custom logic when rowset is published - void make_visible_extra(Version version, VersionHash version_hash) override; + void make_visible_extra(Version version) override; private: std::shared_ptr<SegmentGroup> _segment_group_with_largest_size(); diff --git a/be/src/olap/rowset/alpha_rowset_reader.cpp b/be/src/olap/rowset/alpha_rowset_reader.cpp index b86cefa..b22bfa1 100644 --- a/be/src/olap/rowset/alpha_rowset_reader.cpp +++ b/be/src/olap/rowset/alpha_rowset_reader.cpp @@ -120,10 +120,6 @@ Version AlphaRowsetReader::version() { return _alpha_rowset_meta->version(); } -VersionHash AlphaRowsetReader::version_hash() { - return _alpha_rowset_meta->version_hash(); -} - int64_t AlphaRowsetReader::filtered_rows() { return _stats->rows_del_filtered; } diff --git a/be/src/olap/rowset/alpha_rowset_reader.h b/be/src/olap/rowset/alpha_rowset_reader.h index 26e8d46..e76bb94 100644 --- a/be/src/olap/rowset/alpha_rowset_reader.h +++ b/be/src/olap/rowset/alpha_rowset_reader.h @@ -73,8 +73,6 @@ public: Version version() override; - VersionHash version_hash() override; - RowsetSharedPtr rowset() override; int64_t filtered_rows() override; diff --git a/be/src/olap/rowset/alpha_rowset_writer.cpp b/be/src/olap/rowset/alpha_rowset_writer.cpp index 58630a8..d3d087b 100644 --- a/be/src/olap/rowset/alpha_rowset_writer.cpp +++ b/be/src/olap/rowset/alpha_rowset_writer.cpp @@ -68,7 +68,6 @@ OLAPStatus AlphaRowsetWriter::init(const RowsetWriterContext& rowset_writer_cont _current_rowset_meta->set_load_id(_rowset_writer_context.load_id); } else { _current_rowset_meta->set_version(_rowset_writer_context.version); - _current_rowset_meta->set_version_hash(_rowset_writer_context.version_hash); } RETURN_NOT_OK(_init()); return OLAP_SUCCESS; @@ -259,7 +258,7 @@ OLAPStatus AlphaRowsetWriter::_init() { _cur_segment_group = new (std::nothrow) SegmentGroup( _rowset_writer_context.tablet_id, _rowset_writer_context.rowset_id, _rowset_writer_context.tablet_schema, _rowset_writer_context.path_desc.filepath, - _rowset_writer_context.version, _rowset_writer_context.version_hash, false, + _rowset_writer_context.version, false, _segment_group_id, 0); } DCHECK(_cur_segment_group != nullptr) << "failed to malloc SegmentGroup"; diff --git a/be/src/olap/rowset/beta_rowset_reader.h b/be/src/olap/rowset/beta_rowset_reader.h index 997ab12..55a8938 100644 --- a/be/src/olap/rowset/beta_rowset_reader.h +++ b/be/src/olap/rowset/beta_rowset_reader.h @@ -46,8 +46,6 @@ public: Version version() override { return _rowset->version(); } - VersionHash version_hash() override { return _rowset->version_hash(); } - RowsetSharedPtr rowset() override { return std::dynamic_pointer_cast<Rowset>(_rowset); } // Return the total number of filtered rows, will be used for validation of schema change diff --git a/be/src/olap/rowset/beta_rowset_writer.cpp b/be/src/olap/rowset/beta_rowset_writer.cpp index d2d317f..be87131 100644 --- a/be/src/olap/rowset/beta_rowset_writer.cpp +++ b/be/src/olap/rowset/beta_rowset_writer.cpp @@ -82,7 +82,6 @@ OLAPStatus BetaRowsetWriter::init(const RowsetWriterContext& rowset_writer_conte _rowset_meta->set_load_id(_context.load_id); } else { _rowset_meta->set_version(_context.version); - _rowset_meta->set_version_hash(_context.version_hash); } _rowset_meta->set_tablet_uid(_context.tablet_uid); diff --git a/be/src/olap/rowset/column_data.h b/be/src/olap/rowset/column_data.h index 93351a2..e2565b4 100644 --- a/be/src/olap/rowset/column_data.h +++ b/be/src/olap/rowset/column_data.h @@ -47,7 +47,6 @@ public: // 为了与之前兼容, 暴露部分index的接口 Version version() const { return _segment_group->version(); } - VersionHash version_hash() const { return _segment_group->version_hash(); } bool delete_flag() const { return _segment_group->delete_flag(); } uint32_t num_segments() const { return _segment_group->num_segments(); } diff --git a/be/src/olap/rowset/rowset.cpp b/be/src/olap/rowset/rowset.cpp index 79f7371..1e2dea0 100644 --- a/be/src/olap/rowset/rowset.cpp +++ b/be/src/olap/rowset/rowset.cpp @@ -59,10 +59,9 @@ OLAPStatus Rowset::load(bool use_cache) { return OLAP_SUCCESS; } -void Rowset::make_visible(Version version, VersionHash version_hash) { +void Rowset::make_visible(Version version) { _is_pending = false; _rowset_meta->set_version(version); - _rowset_meta->set_version_hash(version_hash); _rowset_meta->set_rowset_state(VISIBLE); // update create time to the visible time, // it's used to skip recently published version during compaction @@ -72,7 +71,7 @@ void Rowset::make_visible(Version version, VersionHash version_hash) { _rowset_meta->mutable_delete_predicate()->set_version(version.first); return; } - make_visible_extra(version, version_hash); + make_visible_extra(version); } } // namespace doris diff --git a/be/src/olap/rowset/rowset.h b/be/src/olap/rowset/rowset.h index 1983a36..8e952d4 100644 --- a/be/src/olap/rowset/rowset.h +++ b/be/src/olap/rowset/rowset.h @@ -140,12 +140,11 @@ public: bool is_pending() const { return _is_pending; } // publish rowset to make it visible to read - void make_visible(Version version, VersionHash version_hash); + void make_visible(Version version); // helper class to access RowsetMeta int64_t start_version() const { return rowset_meta()->version().first; } int64_t end_version() const { return rowset_meta()->version().second; } - VersionHash version_hash() const { return rowset_meta()->version_hash(); } size_t index_disk_size() const { return rowset_meta()->index_disk_size(); } size_t data_disk_size() const { return rowset_meta()->total_disk_size(); } bool empty() const { return rowset_meta()->empty(); } @@ -269,7 +268,7 @@ protected: virtual void do_close() = 0; // allow subclass to add custom logic when rowset is being published - virtual void make_visible_extra(Version version, VersionHash version_hash) {} + virtual void make_visible_extra(Version version) {} const TabletSchema* _schema; FilePathDesc _rowset_path_desc; diff --git a/be/src/olap/rowset/rowset_converter.cpp b/be/src/olap/rowset/rowset_converter.cpp index d6d3a56..a8bae5e 100644 --- a/be/src/olap/rowset/rowset_converter.cpp +++ b/be/src/olap/rowset/rowset_converter.cpp @@ -52,7 +52,6 @@ OLAPStatus RowsetConverter::_convert_rowset(const RowsetMetaSharedPtr& src_rowse context.segments_overlap = src_rowset_meta->segments_overlap(); if (context.rowset_state == VISIBLE) { context.version = src_rowset_meta->version(); - context.version_hash = src_rowset_meta->version_hash(); } else { context.txn_id = src_rowset_meta->txn_id(); context.load_id = src_rowset_meta->load_id(); diff --git a/be/src/olap/rowset/rowset_meta.h b/be/src/olap/rowset/rowset_meta.h index a31f14e2..b55fc94 100644 --- a/be/src/olap/rowset/rowset_meta.h +++ b/be/src/olap/rowset/rowset_meta.h @@ -133,12 +133,6 @@ public: void set_end_version(int64_t end_version) { _rowset_meta_pb.set_end_version(end_version); } - VersionHash version_hash() const { return _rowset_meta_pb.version_hash(); } - - void set_version_hash(VersionHash version_hash) { - _rowset_meta_pb.set_version_hash(version_hash); - } - int64_t num_rows() const { return _rowset_meta_pb.num_rows(); } void set_num_rows(int64_t num_rows) { _rowset_meta_pb.set_num_rows(num_rows); } diff --git a/be/src/olap/rowset/rowset_reader.h b/be/src/olap/rowset/rowset_reader.h index d0c0bf2..542e705 100644 --- a/be/src/olap/rowset/rowset_reader.h +++ b/be/src/olap/rowset/rowset_reader.h @@ -56,8 +56,6 @@ public: virtual Version version() = 0; - virtual VersionHash version_hash() = 0; - virtual RowsetSharedPtr rowset() = 0; virtual int64_t filtered_rows() = 0; diff --git a/be/src/olap/rowset/rowset_writer_context.h b/be/src/olap/rowset/rowset_writer_context.h index a0ad273..8c314f5 100644 --- a/be/src/olap/rowset/rowset_writer_context.h +++ b/be/src/olap/rowset/rowset_writer_context.h @@ -36,7 +36,6 @@ struct RowsetWriterContext { tablet_schema(nullptr), rowset_state(PREPARED), version(Version(0, 0)), - version_hash(0), txn_id(0), tablet_uid(0, 0), segments_overlap(OVERLAP_UNKNOWN) { @@ -55,7 +54,6 @@ struct RowsetWriterContext { RowsetStatePB rowset_state; // properties for non-pending rowset Version version; - VersionHash version_hash; // properties for pending rowset int64_t txn_id; diff --git a/be/src/olap/rowset/segment_group.cpp b/be/src/olap/rowset/segment_group.cpp index d0e3588..0dc2f51 100644 --- a/be/src/olap/rowset/segment_group.cpp +++ b/be/src/olap/rowset/segment_group.cpp @@ -68,14 +68,13 @@ namespace doris { SegmentGroup::SegmentGroup(int64_t tablet_id, const RowsetId& rowset_id, const TabletSchema* schema, const std::string& rowset_path_prefix, Version version, - VersionHash version_hash, bool delete_flag, int32_t segment_group_id, + bool delete_flag, int32_t segment_group_id, int32_t num_segments) : _tablet_id(tablet_id), _rowset_id(rowset_id), _schema(schema), _rowset_path_prefix(rowset_path_prefix), _version(version), - _version_hash(version_hash), _delete_flag(delete_flag), _segment_group_id(segment_group_id), _num_segments(num_segments) { @@ -118,7 +117,6 @@ SegmentGroup::SegmentGroup(int64_t tablet_id, const RowsetId& rowset_id, const T _partition_id(partition_id), _txn_id(transaction_id) { _version = {-1, -1}; - _version_hash = 0; _load_id.set_hi(0); _load_id.set_lo(0); _index_loaded = false; @@ -584,7 +582,8 @@ OLAPStatus SegmentGroup::add_segment() { index_header = _file_header.mutable_message(); index_header->set_start_version(_version.first); index_header->set_end_version(_version.second); - index_header->set_cumulative_version_hash(_version_hash); + // Version hash is useless but it is a required field in header message pb + index_header->set_cumulative_version_hash(0); index_header->set_segment(_num_segments - 1); index_header->set_num_rows_per_block(_schema->num_rows_per_row_block()); index_header->set_delete_flag(_delete_flag); @@ -1007,12 +1006,12 @@ std::string SegmentGroup::_construct_old_file_path(const std::string& path_prefi const std::string& suffix) const { char file_path[OLAP_MAX_PATH_LEN]; if (_segment_group_id == -1) { - snprintf(file_path, sizeof(file_path), "%s/%ld_%ld_%ld_%ld_%d%s", path_prefix.c_str(), - _tablet_id, _version.first, _version.second, _version_hash, segment_id, + snprintf(file_path, sizeof(file_path), "%s/%ld_%ld_%ld_%d%s", path_prefix.c_str(), + _tablet_id, _version.first, _version.second, segment_id, suffix.c_str()); } else { - snprintf(file_path, sizeof(file_path), "%s/%ld_%ld_%ld_%ld_%d_%d%s", path_prefix.c_str(), - _tablet_id, _version.first, _version.second, _version_hash, _segment_group_id, + snprintf(file_path, sizeof(file_path), "%s/%ld_%ld_%ld_%d_%d%s", path_prefix.c_str(), + _tablet_id, _version.first, _version.second, _segment_group_id, segment_id, suffix.c_str()); } @@ -1024,8 +1023,8 @@ std::string SegmentGroup::_construct_err_sg_file_path(const std::string& path_pr int32_t segment_id, const std::string& suffix) const { char file_path[OLAP_MAX_PATH_LEN]; - snprintf(file_path, sizeof(file_path), "%s/%ld_%ld_%ld_%ld_%d%s", path_prefix.c_str(), - _tablet_id, _version.first, _version.second, _version_hash, segment_id, + snprintf(file_path, sizeof(file_path), "%s/%ld_%ld_%ld_%d%s", path_prefix.c_str(), + _tablet_id, _version.first, _version.second, segment_id, suffix.c_str()); return file_path; diff --git a/be/src/olap/rowset/segment_group.h b/be/src/olap/rowset/segment_group.h index e5a033f..09302fe 100644 --- a/be/src/olap/rowset/segment_group.h +++ b/be/src/olap/rowset/segment_group.h @@ -49,7 +49,7 @@ class SegmentGroup { public: SegmentGroup(int64_t tablet_id, const RowsetId& rowset_id, const TabletSchema* tablet_schema, - const std::string& rowset_path_prefix, Version version, VersionHash version_hash, + const std::string& rowset_path_prefix, Version version, bool delete_flag, int segment_group_id, int32_t num_segments); SegmentGroup(int64_t tablet_id, const RowsetId& rowset_id, const TabletSchema* tablet_schema, @@ -142,8 +142,6 @@ public: inline Version version() const { return _version; } inline void set_version(Version version) { _version = version; } - inline VersionHash version_hash() const { return _version_hash; } - inline void set_version_hash(VersionHash version_hash) { _version_hash = version_hash; } inline bool is_pending() const { return _is_pending; } inline void set_pending_finished() { _is_pending = false; } @@ -271,7 +269,6 @@ private: const TabletSchema* _schema; std::string _rowset_path_prefix; // path of rowset Version _version; // version of associated data file - VersionHash _version_hash; // version hash for this segment group bool _delete_flag; int32_t _segment_group_id; // segment group id of segment group PUniqueId _load_id; // load id for segment group diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp index f8a6af2..e3c7d8b 100644 --- a/be/src/olap/schema_change.cpp +++ b/be/src/olap/schema_change.cpp @@ -1123,9 +1123,7 @@ SchemaChangeWithSorting::SchemaChangeWithSorting(const RowBlockChanger& row_bloc _memory_limitation(memory_limitation), _row_block_allocator(nullptr) { // Every time SchemaChange is used for external rowing, some temporary versions (such as 999, 1000, 1001) will be written, in order to avoid Cache conflicts, temporary - // The version performs 2 processes: - // 1. Random value as VersionHash - // 2. The version number takes a BIG NUMBER plus the version number of the current SchemaChange + // The version number takes a BIG NUMBER plus the version number of the current SchemaChange _temp_delta_versions.first = (1 << 28); _temp_delta_versions.second = (1 << 28); // TODO(zyh): remove the magic number @@ -1238,7 +1236,7 @@ OLAPStatus SchemaChangeWithSorting::process(RowsetReaderSharedPtr rowset_reader, if (!_internal_sorting( row_block_arr, Version(_temp_delta_versions.second, _temp_delta_versions.second), - rowset_reader->version_hash(), new_tablet, new_rowset_type, + new_tablet, new_rowset_type, segments_overlap, &rowset)) { LOG(WARNING) << "failed to sorting internally."; return OLAP_ERR_ALTER_STATUS_ERR; @@ -1294,7 +1292,7 @@ OLAPStatus SchemaChangeWithSorting::process(RowsetReaderSharedPtr rowset_reader, } if (!_internal_sorting(row_block_arr, Version(_temp_delta_versions.second, _temp_delta_versions.second), - rowset_reader->version_hash(), new_tablet, new_rowset_type, + new_tablet, new_rowset_type, segments_overlap, &rowset)) { LOG(WARNING) << "failed to sorting internally."; return OLAP_ERR_ALTER_STATUS_ERR; @@ -1350,7 +1348,7 @@ OLAPStatus SchemaChangeWithSorting::process(RowsetReaderSharedPtr rowset_reader, } bool SchemaChangeWithSorting::_internal_sorting(const std::vector<RowBlock*>& row_block_arr, - const Version& version, VersionHash version_hash, + const Version& version, TabletSharedPtr new_tablet, RowsetTypePB new_rowset_type, SegmentsOverlapPB segments_overlap, @@ -1369,7 +1367,6 @@ bool SchemaChangeWithSorting::_internal_sorting(const std::vector<RowBlock*>& ro context.tablet_schema = &(new_tablet->tablet_schema()); context.rowset_state = VISIBLE; context.version = version; - context.version_hash = version_hash; context.segments_overlap = segments_overlap; context.parent_mem_tracker = _mem_tracker; @@ -1437,8 +1434,7 @@ OLAPStatus SchemaChangeHandler::process_alter_tablet_v2(const TAlterTabletReqV2& << ", base_schema_hash=" << request.base_schema_hash << ", new_tablet_id=" << request.new_tablet_id << ", new_schema_hash=" << request.new_schema_hash - << ", alter_version=" << request.alter_version - << ", alter_version_hash=" << request.alter_version_hash; + << ", alter_version=" << request.alter_version; // Lock schema_change_lock util schema change info is stored in tablet header if (!StorageEngine::instance()->tablet_manager()->try_schema_change_lock( @@ -1922,7 +1918,6 @@ OLAPStatus SchemaChangeHandler::_convert_historical_rowsets(const SchemaChangePa writer_context.tablet_schema = &(new_tablet->tablet_schema()); writer_context.rowset_state = VISIBLE; writer_context.version = rs_reader->version(); - writer_context.version_hash = rs_reader->version_hash(); writer_context.segments_overlap = rs_reader->rowset()->rowset_meta()->segments_overlap(); writer_context.parent_mem_tracker = _mem_tracker; @@ -2197,9 +2192,7 @@ OLAPStatus SchemaChangeHandler::_init_column_mapping(ColumnMapping* column_mappi OLAPStatus SchemaChangeHandler::_validate_alter_result(TabletSharedPtr new_tablet, const TAlterTabletReqV2& request) { Version max_continuous_version = {-1, 0}; - VersionHash max_continuous_version_hash = 0; - new_tablet->max_continuous_version_from_beginning(&max_continuous_version, - &max_continuous_version_hash); + new_tablet->max_continuous_version_from_beginning(&max_continuous_version); LOG(INFO) << "find max continuous version of tablet=" << new_tablet->full_name() << ", start_version=" << max_continuous_version.first << ", end_version=" << max_continuous_version.second; diff --git a/be/src/olap/schema_change.h b/be/src/olap/schema_change.h index e0d42e8..53aa349 100644 --- a/be/src/olap/schema_change.h +++ b/be/src/olap/schema_change.h @@ -166,7 +166,7 @@ public: private: bool _internal_sorting(const std::vector<RowBlock*>& row_block_arr, - const Version& temp_delta_versions, const VersionHash version_hash, + const Version& temp_delta_versions, TabletSharedPtr new_tablet, RowsetTypePB new_rowset_type, SegmentsOverlapPB segments_overlap, RowsetSharedPtr* rowset); diff --git a/be/src/olap/snapshot_manager.cpp b/be/src/olap/snapshot_manager.cpp index 52836f7..80816d7 100644 --- a/be/src/olap/snapshot_manager.cpp +++ b/be/src/olap/snapshot_manager.cpp @@ -219,7 +219,6 @@ OLAPStatus SnapshotManager::_rename_rowset_id(const RowsetMetaPB& rs_meta_pb, context.tablet_schema = &tablet_schema; context.rowset_state = org_rowset_meta->rowset_state(); context.version = org_rowset_meta->version(); - context.version_hash = org_rowset_meta->version_hash(); // keep segments_overlap same as origin rowset context.segments_overlap = alpha_rowset_meta->segments_overlap(); diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index 6508b19..b96290d 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -395,7 +395,6 @@ void Tablet::_delete_stale_rowset_by_version(const Version& version) { void Tablet::delete_expired_stale_rowset() { int64_t now = UnixSeconds(); - std::vector<pair<Version, VersionHash>> expired_versions; WriteLock wrlock(&_meta_lock); // Compute the end time to delete rowsets, when a expired rowset createtime less then this time, it will be deleted. double expired_stale_sweep_endtime = @@ -767,17 +766,6 @@ const uint32_t Tablet::_calc_base_compaction_score() const { return base_rowset_exist ? score : 0; } -void Tablet::compute_version_hash_from_rowsets(const std::vector<RowsetSharedPtr>& rowsets, - VersionHash* version_hash) { - DCHECK(version_hash != nullptr) << "invalid parameter, version_hash is nullptr"; - int64_t v_hash = 0; - // version hash is useless since Doris version 0.11 - // but for compatibility, we set version hash as the last rowset's version hash. - // this can also enable us to do the compaction for last one rowset. - v_hash = rowsets.back()->version_hash(); - *version_hash = v_hash; -} - void Tablet::calc_missed_versions(int64_t spec_version, std::vector<Version>* missed_versions) { ReadLock rdlock(&_meta_lock); calc_missed_versions_unlocked(spec_version, missed_versions); @@ -818,36 +806,32 @@ void Tablet::calc_missed_versions_unlocked(int64_t spec_version, } } -void Tablet::max_continuous_version_from_beginning(Version* version, VersionHash* v_hash) { +void Tablet::max_continuous_version_from_beginning(Version* version) { ReadLock rdlock(&_meta_lock); - _max_continuous_version_from_beginning_unlocked(version, v_hash); + _max_continuous_version_from_beginning_unlocked(version); } -void Tablet::_max_continuous_version_from_beginning_unlocked(Version* version, - VersionHash* v_hash) const { - std::vector<pair<Version, VersionHash>> existing_versions; +void Tablet::_max_continuous_version_from_beginning_unlocked(Version* version) const { + std::vector<Version> existing_versions; for (auto& rs : _tablet_meta->all_rs_metas()) { - existing_versions.emplace_back(rs->version(), rs->version_hash()); + existing_versions.emplace_back(rs->version()); } // sort the existing versions in ascending order std::sort(existing_versions.begin(), existing_versions.end(), - [](const pair<Version, VersionHash>& left, const pair<Version, VersionHash>& right) { + [](const Version& left, const Version& right) { // simple because 2 versions are certainly not overlapping - return left.first.first < right.first.first; + return left.first < right.first; }); Version max_continuous_version = {-1, 0}; - VersionHash max_continuous_version_hash = 0; for (int i = 0; i < existing_versions.size(); ++i) { - if (existing_versions[i].first.first > max_continuous_version.second + 1) { + if (existing_versions[i].first > max_continuous_version.second + 1) { break; } - max_continuous_version = existing_versions[i].first; - max_continuous_version_hash = existing_versions[i].second; + max_continuous_version = existing_versions[i]; } *version = max_continuous_version; - *v_hash = max_continuous_version_hash; } void Tablet::calculate_cumulative_point() { @@ -1264,8 +1248,7 @@ void Tablet::build_tablet_report_info(TTabletInfo* tablet_info) { tablet_info->row_count = _tablet_meta->num_rows(); tablet_info->data_size = _tablet_meta->tablet_footprint(); Version version = {-1, 0}; - VersionHash v_hash = 0; - _max_continuous_version_from_beginning_unlocked(&version, &v_hash); + _max_continuous_version_from_beginning_unlocked(&version); auto max_rowset = rowset_with_max_version(); if (max_rowset != nullptr) { if (max_rowset->version() != version) { @@ -1284,7 +1267,8 @@ void Tablet::build_tablet_report_info(TTabletInfo* tablet_info) { // and perform state modification operations. } tablet_info->version = version.second; - tablet_info->version_hash = v_hash; + // Useless but it is a required filed in TTabletInfo + tablet_info->version_hash = 0; tablet_info->__set_partition_id(_tablet_meta->partition_id()); tablet_info->__set_storage_medium(_data_dir->storage_medium()); tablet_info->__set_version_count(_tablet_meta->version_count()); diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h index 42e703a..03a86f8 100644 --- a/be/src/olap/tablet.h +++ b/be/src/olap/tablet.h @@ -164,8 +164,6 @@ public: uint32_t calc_compaction_score( CompactionType compaction_type, std::shared_ptr<CumulativeCompactionPolicy> cumulative_compaction_policy); - static void compute_version_hash_from_rowsets(const std::vector<RowsetSharedPtr>& rowsets, - VersionHash* version_hash); // operation for clone void calc_missed_versions(int64_t spec_version, std::vector<Version>* missed_versions); @@ -174,7 +172,7 @@ public: // This function to find max continuous version from the beginning. // For example: If there are 1, 2, 3, 5, 6, 7 versions belongs tablet, then 3 is target. - void max_continuous_version_from_beginning(Version* version, VersionHash* v_hash); + void max_continuous_version_from_beginning(Version* version); // operation for query OLAPStatus split_range(const OlapTuple& start_key_strings, const OlapTuple& end_key_strings, @@ -269,8 +267,7 @@ private: // Returns: // version: the max continuous version from beginning - void _max_continuous_version_from_beginning_unlocked(Version* version, - VersionHash* v_hash) const; + void _max_continuous_version_from_beginning_unlocked(Version* version) const; RowsetSharedPtr _rowset_with_largest_size(); /// Delete stale rowset by version. This method not only delete the version in expired rowset map, /// but also delete the version in rowset meta vector. diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp index 3cb0859..2e7cd8a 100644 --- a/be/src/olap/tablet_manager.cpp +++ b/be/src/olap/tablet_manager.cpp @@ -1243,7 +1243,6 @@ OLAPStatus TabletManager::_create_initial_rowset_unlocked(const TCreateTabletReq context.tablet_schema = &(tablet->tablet_schema()); context.rowset_state = VISIBLE; context.version = version; - context.version_hash = request.version_hash; // there is no data in init rowset, so overlapping info is unknown. context.segments_overlap = OVERLAP_UNKNOWN; diff --git a/be/src/olap/task/engine_checksum_task.cpp b/be/src/olap/task/engine_checksum_task.cpp index a5c6091..b795efb 100644 --- a/be/src/olap/task/engine_checksum_task.cpp +++ b/be/src/olap/task/engine_checksum_task.cpp @@ -23,12 +23,10 @@ namespace doris { EngineChecksumTask::EngineChecksumTask(TTabletId tablet_id, TSchemaHash schema_hash, - TVersion version, TVersionHash version_hash, - uint32_t* checksum) + TVersion version, uint32_t* checksum) : _tablet_id(tablet_id), _schema_hash(schema_hash), _version(version), - _version_hash(version_hash), _checksum(checksum) {} OLAPStatus EngineChecksumTask::execute() { diff --git a/be/src/olap/task/engine_checksum_task.h b/be/src/olap/task/engine_checksum_task.h index 5fb0d1c..7f0cdb6 100644 --- a/be/src/olap/task/engine_checksum_task.h +++ b/be/src/olap/task/engine_checksum_task.h @@ -32,7 +32,7 @@ public: public: EngineChecksumTask(TTabletId tablet_id, TSchemaHash schema_hash, TVersion version, - TVersionHash version_hash, uint32_t* checksum); + uint32_t* checksum); ~EngineChecksumTask() {} @@ -43,7 +43,6 @@ private: TTabletId _tablet_id; TSchemaHash _schema_hash; TVersion _version; - TVersionHash _version_hash; uint32_t* _checksum; }; // EngineTask diff --git a/be/src/olap/task/engine_publish_version_task.cpp b/be/src/olap/task/engine_publish_version_task.cpp index 51ad517c..fead3f0 100644 --- a/be/src/olap/task/engine_publish_version_task.cpp +++ b/be/src/olap/task/engine_publish_version_task.cpp @@ -54,7 +54,6 @@ OLAPStatus EnginePublishVersionTask::finish() { transaction_id, partition_id, &tablet_related_rs); Version version(par_ver_info.version, par_ver_info.version); - VersionHash version_hash = par_ver_info.version_hash; // each tablet for (auto& tablet_rs : tablet_related_rs) { @@ -64,7 +63,7 @@ OLAPStatus EnginePublishVersionTask::finish() { VLOG_CRITICAL << "begin to publish version on tablet. " << "tablet_id=" << tablet_info.tablet_id << ", schema_hash=" << tablet_info.schema_hash - << ", version=" << version.first << ", version_hash=" << version_hash + << ", version=" << version.first << ", transaction_id=" << transaction_id; // if rowset is null, it means this be received write task, but failed during write // and receive fe's publish version task @@ -87,7 +86,7 @@ OLAPStatus EnginePublishVersionTask::finish() { } publish_status = StorageEngine::instance()->txn_manager()->publish_txn( - partition_id, tablet, transaction_id, version, version_hash); + partition_id, tablet, transaction_id, version); if (publish_status != OLAP_SUCCESS) { LOG(WARNING) << "failed to publish version. rowset_id=" << rowset->rowset_id() << ", tablet_id=" << tablet_info.tablet_id diff --git a/be/src/olap/txn_manager.cpp b/be/src/olap/txn_manager.cpp index 11437e2..1825eda 100644 --- a/be/src/olap/txn_manager.cpp +++ b/be/src/olap/txn_manager.cpp @@ -97,11 +97,9 @@ OLAPStatus TxnManager::commit_txn(TPartitionId partition_id, const TabletSharedP } OLAPStatus TxnManager::publish_txn(TPartitionId partition_id, const TabletSharedPtr& tablet, - TTransactionId transaction_id, const Version& version, - VersionHash version_hash) { + TTransactionId transaction_id, const Version& version) { return publish_txn(tablet->data_dir()->get_meta(), partition_id, transaction_id, - tablet->tablet_id(), tablet->schema_hash(), tablet->tablet_uid(), version, - version_hash); + tablet->tablet_id(), tablet->schema_hash(), tablet->tablet_uid(), version); } // delete the txn from manager if it is not committed(not have a valid rowset) @@ -259,7 +257,7 @@ OLAPStatus TxnManager::commit_txn(OlapMeta* meta, TPartitionId partition_id, OLAPStatus TxnManager::publish_txn(OlapMeta* meta, TPartitionId partition_id, TTransactionId transaction_id, TTabletId tablet_id, SchemaHash schema_hash, TabletUid tablet_uid, - const Version& version, VersionHash version_hash) { + const Version& version) { pair<int64_t, int64_t> key(partition_id, transaction_id); TabletInfo tablet_info(tablet_id, schema_hash, tablet_uid); RowsetSharedPtr rowset_ptr = nullptr; @@ -283,7 +281,7 @@ OLAPStatus TxnManager::publish_txn(OlapMeta* meta, TPartitionId partition_id, if (rowset_ptr != nullptr) { // TODO(ygl): rowset is already set version here, memory is changed, if save failed // it maybe a fatal error - rowset_ptr->make_visible(version, version_hash); + rowset_ptr->make_visible(version); OLAPStatus save_status = RowsetMetaManager::save(meta, tablet_uid, rowset_ptr->rowset_id(), rowset_ptr->rowset_meta()->get_rowset_pb()); diff --git a/be/src/olap/txn_manager.h b/be/src/olap/txn_manager.h index 2c3c3f3..a4050d8 100644 --- a/be/src/olap/txn_manager.h +++ b/be/src/olap/txn_manager.h @@ -80,8 +80,7 @@ public: const RowsetSharedPtr& rowset_ptr, bool is_recovery); OLAPStatus publish_txn(TPartitionId partition_id, const TabletSharedPtr& tablet, - TTransactionId transaction_id, const Version& version, - VersionHash version_hash); + TTransactionId transaction_id, const Version& version); // delete the txn from manager if it is not committed(not have a valid rowset) OLAPStatus rollback_txn(TPartitionId partition_id, const TabletSharedPtr& tablet, @@ -105,7 +104,7 @@ public: // not persist rowset meta because OLAPStatus publish_txn(OlapMeta* meta, TPartitionId partition_id, TTransactionId transaction_id, TTabletId tablet_id, SchemaHash schema_hash, TabletUid tablet_uid, - const Version& version, VersionHash version_hash); + const Version& version); // delete the txn from manager if it is not committed(not have a valid rowset) OLAPStatus rollback_txn(TPartitionId partition_id, TTransactionId transaction_id, diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index b70f5d6..dcff85c 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -790,7 +790,8 @@ Status FragmentMgr::exec_external_plan_fragment(const TScanOpenParams& params, TTabletVersionInfo info = iter->second; scan_range.tablet_id = tablet_id; scan_range.version = std::to_string(info.version); - scan_range.version_hash = std::to_string(info.version_hash); + // Useless but it is required field in TPaloScanRange + scan_range.version_hash = "0"; scan_range.schema_hash = std::to_string(info.schema_hash); scan_range.hosts.push_back(address); } else { diff --git a/be/src/runtime/snapshot_loader.cpp b/be/src/runtime/snapshot_loader.cpp index 2309352..eea8b39 100644 --- a/be/src/runtime/snapshot_loader.cpp +++ b/be/src/runtime/snapshot_loader.cpp @@ -556,25 +556,6 @@ Status SnapshotLoader::_get_existing_files_from_local(const std::string& local_p return Status::OK(); } -void SnapshotLoader::_assemble_file_name(const std::string& snapshot_path, - const std::string& tablet_path, int64_t tablet_id, - int64_t start_version, int64_t end_version, - int64_t vesion_hash, int32_t seg_num, - const std::string suffix, std::string* snapshot_file, - std::string* tablet_file) { - std::stringstream ss1; - ss1 << snapshot_path << "/" << tablet_id << "_" << start_version << "_" << end_version << "_" - << vesion_hash << "_" << seg_num << suffix; - *snapshot_file = ss1.str(); - - std::stringstream ss2; - ss2 << tablet_path << "/" << tablet_id << "_" << start_version << "_" << end_version << "_" - << vesion_hash << "_" << seg_num << suffix; - *tablet_file = ss2.str(); - - VLOG_CRITICAL << "assemble file name: " << *snapshot_file << ", " << *tablet_file; -} - Status SnapshotLoader::_replace_tablet_id(const std::string& file_name, int64_t tablet_id, std::string* new_file_name) { // eg: diff --git a/be/src/runtime/snapshot_loader.h b/be/src/runtime/snapshot_loader.h index 12acc66..0d2386b 100644 --- a/be/src/runtime/snapshot_loader.h +++ b/be/src/runtime/snapshot_loader.h @@ -86,11 +86,6 @@ private: bool _end_with(const std::string& str, const std::string& match); - void _assemble_file_name(const std::string& snapshot_path, const std::string& tablet_path, - int64_t tablet_id, int64_t start_version, int64_t end_version, - int64_t version_hash, int32_t seg_num, const std::string suffix, - std::string* snapshot_file, std::string* tablet_file); - Status _replace_tablet_id(const std::string& file_name, int64_t tablet_id, std::string* new_file_name); diff --git a/be/test/exec/new_olap_scan_node_test.cpp b/be/test/exec/new_olap_scan_node_test.cpp index 1309620..d52f3e6 100644 --- a/be/test/exec/new_olap_scan_node_test.cpp +++ b/be/test/exec/new_olap_scan_node_test.cpp @@ -228,6 +228,7 @@ public: doris_scan_range.hosts.push_back(host); doris_scan_range.__set_schema_hash("1709394"); doris_scan_range.__set_version("0"); + // Useless but it is required in TPaloScanRange doris_scan_range.__set_version_hash("0"); config::olap_index_name = "userid_type_planid_unitid_winfoid"; doris_scan_range.engine_table_name.push_back("clickuserid_online"); @@ -306,6 +307,7 @@ TEST_F(TestOlapScanNode, SimpleTest) { TEST_F(TestOlapScanNode, MultiColumnSingleVersionTest) { _scan_ranges[0].scan_range.doris_scan_range.__set_version("0"); + // Useless but it is required in TPaloScanRange _scan_ranges[0].scan_range.doris_scan_range.__set_version_hash("0"); std::vector<string> data; read_data(0, &data); @@ -344,6 +346,7 @@ TEST_F(TestOlapScanNode, MultiColumnSingleVersionTest) { TEST_F(TestOlapScanNode, MultiColumnMultiVersionTest) { _scan_ranges[0].scan_range.doris_scan_range.__set_version("9"); + // Useless but it is required in TPaloScanRange _scan_ranges[0].scan_range.doris_scan_range.__set_version_hash("0"); std::vector<string> data; read_data(9, &data); diff --git a/be/test/exec/olap_common_test.cpp b/be/test/exec/olap_common_test.cpp index c06d3e3..3ba0a03 100644 --- a/be/test/exec/olap_common_test.cpp +++ b/be/test/exec/olap_common_test.cpp @@ -42,6 +42,7 @@ void construct_scan_range(TPaloScanRange* doris_scan_range) { doris_scan_range->hosts.push_back(host); doris_scan_range->__set_schema_hash("216424022"); doris_scan_range->__set_version("0"); + // Useless but it is required in TPaloScanRange doris_scan_range->__set_version_hash("0"); // doris_scan_range->engine_table_name.push_back("ShowQStats"); doris_scan_range->__set_db_name("olap"); diff --git a/be/test/exec/olap_scan_node_test.cpp b/be/test/exec/olap_scan_node_test.cpp index ac729e9..ff61315 100644 --- a/be/test/exec/olap_scan_node_test.cpp +++ b/be/test/exec/olap_scan_node_test.cpp @@ -176,6 +176,7 @@ public: doris_scan_range.hosts.push_back(host); doris_scan_range.__set_schema_hash("462300563"); doris_scan_range.__set_version("94"); + // Useless but it is required in TPaloScanRange doris_scan_range.__set_version_hash("0"); doris_scan_range.engine_table_name.push_back("DorisTestStats"); doris_scan_range.__set_db_name("olap"); diff --git a/be/test/exec/olap_scanner_test.cpp b/be/test/exec/olap_scanner_test.cpp index d6d7544..82111a3 100644 --- a/be/test/exec/olap_scanner_test.cpp +++ b/be/test/exec/olap_scanner_test.cpp @@ -44,6 +44,7 @@ std::shared_ptr<DorisScanRange> construct_scan_ranges() { doris_scan_range.hosts.push_back(host); doris_scan_range.__set_schema_hash("462300563"); doris_scan_range.__set_version("94"); + // Useless but it is required in TPaloScanRange doris_scan_range.__set_version_hash("0"); doris_scan_range.engine_table_name.push_back("DorisTestStats"); doris_scan_range.__set_db_name("olap"); diff --git a/be/test/olap/cumulative_compaction_policy_test.cpp b/be/test/olap/cumulative_compaction_policy_test.cpp index 0d9803b..950fcbf 100644 --- a/be/test/olap/cumulative_compaction_policy_test.cpp +++ b/be/test/olap/cumulative_compaction_policy_test.cpp @@ -44,7 +44,6 @@ public: "rowset_state": "VISIBLE", "start_version": 2, "end_version": 2, - "version_hash": 8391828013814912580, "num_rows": 3929, "total_disk_size": 84699, "data_disk_size": 84464, @@ -334,7 +333,6 @@ public: "rowset_state": "VISIBLE", "start_version": 2, "end_version": 2, - "version_hash": 8391828013814912580, "num_rows": 3929, "total_disk_size": 41, "data_disk_size": 41, diff --git a/be/test/olap/delete_handler_test.cpp b/be/test/olap/delete_handler_test.cpp index f050fb6..09d4ad1 100644 --- a/be/test/olap/delete_handler_test.cpp +++ b/be/test/olap/delete_handler_test.cpp @@ -76,7 +76,6 @@ void tear_down() { void set_default_create_tablet_request(TCreateTabletReq* request) { request->tablet_id = 10003; request->__set_version(1); - request->__set_version_hash(0); request->tablet_schema.schema_hash = 270068375; request->tablet_schema.short_key_column_count = 2; request->tablet_schema.keys_type = TKeysType::AGG_KEYS; @@ -157,7 +156,6 @@ void set_default_create_tablet_request(TCreateTabletReq* request) { void set_create_duplicate_tablet_request(TCreateTabletReq* request) { request->tablet_id = 10009; request->__set_version(1); - request->__set_version_hash(0); request->tablet_schema.schema_hash = 270068376; request->tablet_schema.short_key_column_count = 2; request->tablet_schema.keys_type = TKeysType::DUP_KEYS; diff --git a/be/test/olap/delta_writer_test.cpp b/be/test/olap/delta_writer_test.cpp index 159e9e7..3e02726 100644 --- a/be/test/olap/delta_writer_test.cpp +++ b/be/test/olap/delta_writer_test.cpp @@ -83,7 +83,6 @@ void tear_down() { void create_tablet_request(int64_t tablet_id, int32_t schema_hash, TCreateTabletReq* request) { request->tablet_id = tablet_id; request->__set_version(1); - request->__set_version_hash(0); request->tablet_schema.schema_hash = schema_hash; request->tablet_schema.short_key_column_count = 6; request->tablet_schema.keys_type = TKeysType::AGG_KEYS; @@ -232,7 +231,6 @@ void create_tablet_request_with_sequence_col(int64_t tablet_id, int32_t schema_h TCreateTabletReq* request) { request->tablet_id = tablet_id; request->__set_version(1); - request->__set_version_hash(0); request->tablet_schema.schema_hash = schema_hash; request->tablet_schema.short_key_column_count = 2; request->tablet_schema.keys_type = TKeysType::UNIQUE_KEYS; @@ -488,7 +486,6 @@ TEST_F(TestDeltaWriter, write) { version.second = tablet->rowset_with_max_version()->end_version() + 1; std::cout << "start to add rowset version:" << version.first << "-" << version.second << std::endl; - VersionHash version_hash = 2; std::map<TabletInfo, RowsetSharedPtr> tablet_related_rs; StorageEngine::instance()->txn_manager()->get_txn_related_tablets( write_req.txn_id, write_req.partition_id, &tablet_related_rs); @@ -497,12 +494,11 @@ TEST_F(TestDeltaWriter, write) { RowsetSharedPtr rowset = tablet_rs.second; res = k_engine->txn_manager()->publish_txn( meta, write_req.partition_id, write_req.txn_id, write_req.tablet_id, - write_req.schema_hash, tablet_rs.first.tablet_uid, version, version_hash); + write_req.schema_hash, tablet_rs.first.tablet_uid, version); ASSERT_EQ(OLAP_SUCCESS, res); std::cout << "start to add inc rowset:" << rowset->rowset_id() << ", num rows:" << rowset->num_rows() << ", version:" << rowset->version().first - << "-" << rowset->version().second << ", version_hash:" << rowset->version_hash() - << std::endl; + << "-" << rowset->version().second << std::endl; res = tablet->add_inc_rowset(rowset); ASSERT_EQ(OLAP_SUCCESS, res); } @@ -568,7 +564,6 @@ TEST_F(TestDeltaWriter, sequence_col) { version.second = tablet->rowset_with_max_version()->end_version() + 1; std::cout << "start to add rowset version:" << version.first << "-" << version.second << std::endl; - VersionHash version_hash = 2; std::map<TabletInfo, RowsetSharedPtr> tablet_related_rs; StorageEngine::instance()->txn_manager()->get_txn_related_tablets( write_req.txn_id, write_req.partition_id, &tablet_related_rs); @@ -577,12 +572,11 @@ TEST_F(TestDeltaWriter, sequence_col) { RowsetSharedPtr rowset = tablet_rs.second; res = k_engine->txn_manager()->publish_txn( meta, write_req.partition_id, write_req.txn_id, write_req.tablet_id, - write_req.schema_hash, tablet_rs.first.tablet_uid, version, version_hash); + write_req.schema_hash, tablet_rs.first.tablet_uid, version); ASSERT_EQ(OLAP_SUCCESS, res); std::cout << "start to add inc rowset:" << rowset->rowset_id() << ", num rows:" << rowset->num_rows() << ", version:" << rowset->version().first - << "-" << rowset->version().second << ", version_hash:" << rowset->version_hash() - << std::endl; + << "-" << rowset->version().second << std::endl; res = tablet->add_inc_rowset(rowset); ASSERT_EQ(OLAP_SUCCESS, res); } diff --git a/be/test/olap/rowset/rowset_converter_test.cpp b/be/test/olap/rowset/rowset_converter_test.cpp index 281afc6..0d991b3 100644 --- a/be/test/olap/rowset/rowset_converter_test.cpp +++ b/be/test/olap/rowset/rowset_converter_test.cpp @@ -66,7 +66,6 @@ void create_rowset_writer_context(TabletSchema* tablet_schema, RowsetTypePB dst_ rowset_writer_context->tablet_schema = tablet_schema; rowset_writer_context->version.first = 0; rowset_writer_context->version.second = 1; - rowset_writer_context->version_hash = 110; } void create_rowset_reader_context(TabletSchema* tablet_schema, diff --git a/be/test/olap/tablet_meta_manager_test.cpp b/be/test/olap/tablet_meta_manager_test.cpp index 2cb7604..ccbff66 100644 --- a/be/test/olap/tablet_meta_manager_test.cpp +++ b/be/test/olap/tablet_meta_manager_test.cpp @@ -36,7 +36,6 @@ using std::string; namespace doris { -// const std::string meta_path = "./be/test/olap/test_data/header.txt"; const std::string meta_path = "./be/test/olap/test_data/header_without_inc_rs.txt"; class TabletMetaManagerTest : public testing::Test { diff --git a/be/test/olap/tablet_mgr_test.cpp b/be/test/olap/tablet_mgr_test.cpp index 30d418f..246e82e 100644 --- a/be/test/olap/tablet_mgr_test.cpp +++ b/be/test/olap/tablet_mgr_test.cpp @@ -100,7 +100,6 @@ TEST_F(TabletMgrTest, CreateTablet) { create_tablet_req.__set_tablet_schema(tablet_schema); create_tablet_req.__set_tablet_id(111); create_tablet_req.__set_version(2); - create_tablet_req.__set_version_hash(3333); std::vector<DataDir*> data_dirs; data_dirs.push_back(_data_dir); OLAPStatus create_st = _tablet_mgr->create_tablet(create_tablet_req, data_dirs); @@ -165,7 +164,6 @@ TEST_F(TabletMgrTest, CreateTabletWithSequence) { create_tablet_req.__set_tablet_schema(tablet_schema); create_tablet_req.__set_tablet_id(111); create_tablet_req.__set_version(2); - create_tablet_req.__set_version_hash(3333); std::vector<DataDir*> data_dirs; data_dirs.push_back(_data_dir); OLAPStatus create_st = _tablet_mgr->create_tablet(create_tablet_req, data_dirs); @@ -207,7 +205,6 @@ TEST_F(TabletMgrTest, DropTablet) { create_tablet_req.__set_tablet_schema(tablet_schema); create_tablet_req.__set_tablet_id(111); create_tablet_req.__set_version(2); - create_tablet_req.__set_version_hash(3333); std::vector<DataDir*> data_dirs; data_dirs.push_back(_data_dir); OLAPStatus create_st = _tablet_mgr->create_tablet(create_tablet_req, data_dirs); diff --git a/be/test/olap/tablet_test.cpp b/be/test/olap/tablet_test.cpp index 01aac86..a3776d5 100644 --- a/be/test/olap/tablet_test.cpp +++ b/be/test/olap/tablet_test.cpp @@ -47,7 +47,6 @@ public: "rowset_state": "VISIBLE", "start_version": 2, "end_version": 2, - "version_hash": 8391828013814912580, "num_rows": 3929, "total_disk_size": 84699, "data_disk_size": 84464, diff --git a/be/test/olap/test_data/converter_test_data/data/0/15007/368169781/olap_header.json b/be/test/olap/test_data/converter_test_data/data/0/15007/368169781/olap_header.json deleted file mode 100644 index fa6c58f..0000000 --- a/be/test/olap/test_data/converter_test_data/data/0/15007/368169781/olap_header.json +++ /dev/null @@ -1,676 +0,0 @@ -{ - "num_rows_per_data_block": 1024, - "cumulative_layer_point": 2, - "num_short_key_fields": 5, - "column": [ - { - "name": "k1", - "type": "INT", - "aggregation": "NONE", - "length": 4, - "is_key": true, - "index_length": 4, - "is_allow_null": true, - "unique_id": 0, - "is_root_column": true - }, - { - "name": "k2", - "type": "SMALLINT", - "aggregation": "NONE", - "length": 2, - "is_key": true, - "index_length": 2, - "is_allow_null": true, - "unique_id": 1, - "is_root_column": true - }, - { - "name": "k3", - "type": "TINYINT", - "aggregation": "NONE", - "length": 1, - "is_key": true, - "index_length": 1, - "is_allow_null": true, - "unique_id": 2, - "is_root_column": true - }, - { - "name": "k4", - "type": "BIGINT", - "aggregation": "NONE", - "length": 8, - "is_key": true, - "index_length": 8, - "is_allow_null": true, - "unique_id": 3, - "is_root_column": true - }, - { - "name": "k5", - "type": "DECIMAL", - "aggregation": "NONE", - "length": 12, - "is_key": true, - "index_length": 12, - "precision": 9, - "frac": 3, - "is_allow_null": true, - "unique_id": 4, - "is_root_column": true - }, - { - "name": "k6", - "type": "CHAR", - "aggregation": "NONE", - "length": 5, - "is_key": true, - "index_length": 5, - "is_allow_null": true, - "unique_id": 5, - "is_root_column": true - }, - { - "name": "k10", - "type": "DATE", - "aggregation": "NONE", - "length": 3, - "is_key": true, - "index_length": 3, - "is_allow_null": true, - "unique_id": 6, - "is_root_column": true - }, - { - "name": "k11", - "type": "DATETIME", - "aggregation": "NONE", - "length": 8, - "is_key": true, - "index_length": 8, - "is_allow_null": true, - "unique_id": 7, - "is_root_column": true - }, - { - "name": "k7", - "type": "VARCHAR", - "aggregation": "NONE", - "length": 22, - "is_key": true, - "index_length": 20, - "is_allow_null": true, - "unique_id": 8, - "is_root_column": true - }, - { - "name": "k8", - "type": "DOUBLE", - "aggregation": "MAX", - "length": 8, - "is_key": false, - "index_length": 8, - "is_allow_null": true, - "unique_id": 9, - "is_root_column": true - }, - { - "name": "k9", - "type": "FLOAT", - "aggregation": "SUM", - "length": 4, - "is_key": false, - "index_length": 4, - "is_allow_null": true, - "unique_id": 10, - "is_root_column": true - } - ], - "creation_time": 1553152125, - "selectivity": [ - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1 - ], - "data_file_type": "COLUMN_ORIENTED_FILE", - "next_column_unique_id": 11, - "compress_kind": "COMPRESS_LZ4", - "segment_size": 268435456, - "keys_type": "AGG_KEYS", - "delta": [ - { - "start_version": 0, - "end_version": 1, - "version_hash": 0, - "creation_time": 1553152125, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 0, - "index_size": 0, - "data_size": 0, - "num_rows": 0, - "empty": true - } - ] - }, - { - "start_version": 2, - "end_version": 2, - "version_hash": 6029593056193292005, - "creation_time": 1553152255, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 229, - "data_size": 4186, - "num_rows": 3315, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - }, - { - "start_version": 3, - "end_version": 3, - "version_hash": 7368336314652758588, - "creation_time": 1553152260, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 229, - "data_size": 4186, - "num_rows": 3315, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - }, - { - "start_version": 4, - "end_version": 4, - "version_hash": 9172793704282665912, - "creation_time": 1553152268, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 229, - "data_size": 4186, - "num_rows": 3315, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - } - ], - "pending_delta": [ - { - "partition_id": 15005, - "transaction_id": 10007, - "creation_time": 1553152325, - "pending_segment_group": [ - { - "pending_segment_group_id": 0, - "num_segments": 1, - "load_id": { - "hi": -6248051641982818523, - "lo": -4026637950854708082 - }, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - }, - { - "partition_id": 15005, - "transaction_id": 10008, - "creation_time": 1553152332, - "pending_segment_group": [ - { - "pending_segment_group_id": 0, - "num_segments": 1, - "load_id": { - "hi": 8955644356935812351, - "lo": 5235253922991912895 - }, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - } - ], - "incremental_delta": [ - { - "start_version": 2, - "end_version": 2, - "version_hash": 6029593056193292005, - "creation_time": 1553152255, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 229, - "data_size": 4186, - "num_rows": 3315, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - }, - { - "start_version": 3, - "end_version": 3, - "version_hash": 7368336314652758588, - "creation_time": 1553152260, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 229, - "data_size": 4186, - "num_rows": 3315, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - }, - { - "start_version": 4, - "end_version": 4, - "version_hash": 9172793704282665912, - "creation_time": 1553152268, - "segment_group": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 229, - "data_size": 4186, - "num_rows": 3315, - "column_pruning": [ - { - "min": "LTEyOA==", - "max": "MTI2", - "null_flag": false - }, - { - "min": "MTk4OQ==", - "max": "MjAxMg==", - "null_flag": false - }, - { - "min": "MA==", - "max": "MA==", - "null_flag": true - }, - { - "min": "MTEwMTE4OTI=", - "max": "MTEwMTE5MDI=", - "null_flag": false - }, - { - "min": "MTIzLjEyMzAwMDAwMA==", - "max": "MTIzLjEyMzAwMDAwMA==", - "null_flag": false - }, - { - "min": "ZmFsc2U=", - "max": "dHJ1ZQA=", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMQ==", - "max": "MTk4OS0wMy0yMQ==", - "null_flag": false - }, - { - "min": "MTk4OS0wMy0yMSAxMzowMDowMA==", - "max": "MTk4OS0wMy0yMSAxNDowMDowMA==", - "null_flag": false - }, - { - "min": "d2FuZ2ppbmcwNA==", - "max": "d3VsaW4wNA==", - "null_flag": false - } - ], - "empty": false - } - ] - } - ], - "tablet_id": 15007, - "schema_hash": 368169781, - "shard": 0 -} \ No newline at end of file diff --git a/be/test/olap/test_data/header.txt b/be/test/olap/test_data/header.txt deleted file mode 100644 index 851cae2..0000000 --- a/be/test/olap/test_data/header.txt +++ /dev/null @@ -1,197 +0,0 @@ -{ - "table_id": 15670, - "partition_id": 15671, - "tablet_id": 15672, - "schema_hash": 567997577, - "shard_id": 34, - "creation_time": 1553765664, - "cumulative_layer_point": 2, - "tablet_state": "PB_NOTREADY", - "schema": { - "keys_type": "AGG_KEYS", - "column": [ - { - "unique_id": 0, - "name": "k1", - "type": "BIGINT", - "is_key": true, - "aggregation": "NONE", - "is_nullable": false, - "length": 8, - "index_length": 8, - "visible": true - }, - { - "unique_id": 1, - "name": "v1", - "type": "HLL", - "is_key": false, - "aggregation": "HLL_UNION", - "is_nullable": false, - "default_value": "MA==", - "length": 16387, - "index_length": 16, - "visible": true - }, - { - "unique_id": 2, - "name": "v2", - "type": "INT", - "is_key": false, - "aggregation": "SUM", - "is_nullable": false, - "length": 4, - "index_length": 4, - "visible": true - } - ], - "num_short_key_columns": 1, - "num_rows_per_row_block": 1024, - "compress_kind": "COMPRESS_LZ4", - "next_column_unique_id": 3, - "is_in_memory": false, - "delete_sign_idx": -1, - "sequence_col_idx": -1 - }, - "rs_metas": [ - { - "rowset_id": 540072, - "tablet_id": 15673, - "tablet_schema_hash": 567997577, - "rowset_type": "ALPHA_ROWSET", - "rowset_state": "VISIBLE", - "start_version": 0, - "end_version": 1, - "version_hash": 0, - "num_rows": 0, - "total_disk_size": 0, - "data_disk_size": 0, - "index_disk_size": 0, - "empty": true, - "creation_time": 1553765664, - "num_segments": 0, - "alpha_rowset_extra_meta_pb": { - "segment_groups": [ - { - "segment_group_id": 0, - "num_segments": 0, - "index_size": 0, - "data_size": 0, - "num_rows": 0, - "empty": true - } - ] - } - }, - { - "rowset_id": 540081, - "tablet_id": 15673, - "txn_id": 4042, - "tablet_schema_hash": 567997577, - "rowset_type": "ALPHA_ROWSET", - "rowset_state": "VISIBLE", - "start_version": 2, - "end_version": 2, - "version_hash": 8391828013814912580, - "num_rows": 3929, - "total_disk_size": 84699, - "data_disk_size": 84464, - "index_disk_size": 235, - "empty": false, - "load_id": { - "hi": -5350970832824939812, - "lo": -6717994719194512122 - }, - "creation_time": 1553765670, - "num_segments": 1, - "alpha_rowset_extra_meta_pb": { - "segment_groups": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 132, - "data_size": 576, - "num_rows": 5, - "zone_maps": [ - { - "min": "MQ==", - "max": "NQ==", - "null_flag": false - }, - { - "min": "MQ==", - "max": "Mw==", - "null_flag": false - }, - { - "min": "J2J1c2gn", - "max": "J3RvbSc=", - "null_flag": false - } - ], - "empty": false - } - ] - } - } - ], - "inc_rs_metas": [ - { - "rowset_id": 540081, - "tablet_id": 15673, - "txn_id": 4042, - "tablet_schema_hash": 567997577, - "rowset_type": "ALPHA_ROWSET", - "rowset_state": "VISIBLE", - "start_version": 2, - "end_version": 2, - "version_hash": 8391828013814912580, - "num_rows": 3929, - "total_disk_size": 84699, - "data_disk_size": 84464, - "index_disk_size": 235, - "empty": false, - "load_id": { - "hi": -5350970832824939812, - "lo": -6717994719194512122 - }, - "creation_time": 1553765670, - "num_segments": 1, - "alpha_rowset_extra_meta_pb": { - "segment_groups": [ - { - "segment_group_id": 0, - "num_segments": 1, - "index_size": 132, - "data_size": 576, - "num_rows": 5, - "zone_maps": [ - { - "min": "MQ==", - "max": "NQ==", - "null_flag": false - }, - { - "min": "MQ==", - "max": "Mw==", - "null_flag": false - }, - { - "min": "J2J1c2gn", - "max": "J3RvbSc=", - "null_flag": false - } - ], - "empty": false - } - ] - } - } - ], - "in_restore_mode": false, - "tablet_uid": { - "hi": 10, - "lo": 10 - }, - "tablet_type": "TABLET_TYPE_DISK" -} diff --git a/be/test/olap/test_data/header_without_inc_rs.txt b/be/test/olap/test_data/header_without_inc_rs.txt index 11139bb..997abdb 100644 --- a/be/test/olap/test_data/header_without_inc_rs.txt +++ b/be/test/olap/test_data/header_without_inc_rs.txt @@ -64,7 +64,6 @@ "rowset_state": "VISIBLE", "start_version": 0, "end_version": 1, - "version_hash": 0, "num_rows": 0, "total_disk_size": 0, "data_disk_size": 0, @@ -94,7 +93,6 @@ "rowset_state": "VISIBLE", "start_version": 2, "end_version": 2, - "version_hash": 8391828013814912580, "num_rows": 3929, "total_disk_size": 84699, "data_disk_size": 84464, diff --git a/be/test/olap/test_data/rowset.json b/be/test/olap/test_data/rowset.json index d45ac1f..025cd00 100644 --- a/be/test/olap/test_data/rowset.json +++ b/be/test/olap/test_data/rowset.json @@ -7,7 +7,6 @@ "rowset_state": "VISIBLE", "start_version": 2, "end_version": 2, - "version_hash": 8391828013814912580, "num_rows": 3929, "total_disk_size": 84699, "data_disk_size": 84464, diff --git a/be/test/olap/test_data/rowset_meta.json b/be/test/olap/test_data/rowset_meta.json index 9da37e7..1fdb9cf 100644 --- a/be/test/olap/test_data/rowset_meta.json +++ b/be/test/olap/test_data/rowset_meta.json @@ -6,7 +6,6 @@ "rowset_state": "VISIBLE", "start_version": 0, "end_version": 1, - "version_hash": 0, "num_rows": 0, "total_disk_size": 0, "data_disk_size": 0, diff --git a/be/test/olap/timestamped_version_tracker_test.cpp b/be/test/olap/timestamped_version_tracker_test.cpp index 995bfc3..97a546b 100644 --- a/be/test/olap/timestamped_version_tracker_test.cpp +++ b/be/test/olap/timestamped_version_tracker_test.cpp @@ -45,7 +45,6 @@ public: "rowset_state": "VISIBLE", "start_version": 2, "end_version": 2, - "version_hash": 8391828013814912580, "num_rows": 3929, "total_disk_size": 84699, "data_disk_size": 84464, diff --git a/be/test/olap/txn_manager_test.cpp b/be/test/olap/txn_manager_test.cpp index f32a64a..e396b61 100644 --- a/be/test/olap/txn_manager_test.cpp +++ b/be/test/olap/txn_manager_test.cpp @@ -284,9 +284,8 @@ TEST_F(TxnManagerTest, PublishVersionSuccessful) { _tablet_uid, load_id, _alpha_rowset, false); ASSERT_TRUE(status == OLAP_SUCCESS); Version new_version(10, 11); - VersionHash new_versionhash = 123; status = _txn_mgr->publish_txn(_meta, partition_id, transaction_id, tablet_id, schema_hash, - _tablet_uid, new_version, new_versionhash); + _tablet_uid, new_version); ASSERT_TRUE(status == OLAP_SUCCESS); RowsetMetaSharedPtr rowset_meta(new AlphaRowsetMeta()); @@ -301,10 +300,9 @@ TEST_F(TxnManagerTest, PublishVersionSuccessful) { // 1. publish version failed if not found related txn and rowset TEST_F(TxnManagerTest, PublishNotExistedTxn) { Version new_version(10, 11); - VersionHash new_versionhash = 123; OLAPStatus status = _txn_mgr->publish_txn(_meta, partition_id, transaction_id, tablet_id, schema_hash, - _tablet_uid, new_version, new_versionhash); + _tablet_uid, new_version); ASSERT_TRUE(status != OLAP_SUCCESS); } diff --git a/be/test/runtime/snapshot_loader_test.cpp b/be/test/runtime/snapshot_loader_test.cpp index 7808efe..1342a00 100644 --- a/be/test/runtime/snapshot_loader_test.cpp +++ b/be/test/runtime/snapshot_loader_test.cpp @@ -76,13 +76,6 @@ TEST_F(SnapshotLoaderTest, NormalCase) { ASSERT_EQ(0, files.size()); std::filesystem::remove_all("./ss_test/"); - std::string snapshot_file; - std::string tablet_file; - loader._assemble_file_name("/snapshot/path", "/tablet/path", 1234, 2, 5, 12345, 1, ".dat", - &snapshot_file, &tablet_file); - ASSERT_EQ("/snapshot/path/1234_2_5_12345_1.dat", snapshot_file); - ASSERT_EQ("/tablet/path/1234_2_5_12345_1.dat", tablet_file); - std::string new_name; st = loader._replace_tablet_id("12345.hdr", 5678, &new_name); ASSERT_TRUE(st.ok()); diff --git a/docs/en/administrator-guide/operation/be-olap-error-code.md b/docs/en/administrator-guide/operation/be-olap-error-code.md index 600e142..7b6736a 100644 --- a/docs/en/administrator-guide/operation/be-olap-error-code.md +++ b/docs/en/administrator-guide/operation/be-olap-error-code.md @@ -131,7 +131,6 @@ under the License. | OLAP_ERR_BE_VERSION_NOT_MATCH | -800 | BE Compaction version mismatch error | | OLAP_ERR_BE_REPLACE_VERSIONS_ERROR | -801 | BE Compaction replacement version error | | OLAP_ERR_BE_MERGE_ERROR | -802 | BE Compaction merge error | -| OLAP_ERR_BE_COMPUTE_VERSION_HASH_ERROR | -803 | BE Compaction calculation version hash error | | OLAP_ERR_CAPTURE_ROWSET_ERROR | -804 | Cannot find the version corresponding to Rowset | | OLAP_ERR_BE_SAVE_HEADER_ERROR | -805 | BE Compaction save header error | | OLAP_ERR_BE_INIT_OLAP_DATA | -806 | BE Compaction initialized OLAP data error | diff --git a/docs/zh-CN/administrator-guide/operation/be-olap-error-code.md b/docs/zh-CN/administrator-guide/operation/be-olap-error-code.md index 850ab6c..18ea2dc 100644 --- a/docs/zh-CN/administrator-guide/operation/be-olap-error-code.md +++ b/docs/zh-CN/administrator-guide/operation/be-olap-error-code.md @@ -140,7 +140,6 @@ under the License. | OLAP_ERR_BE_VERSION_NOT_MATCH | -800 | BE Compaction 版本不匹配错误 | | OLAP_ERR_BE_REPLACE_VERSIONS_ERROR | -801 | BE Compaction 替换版本错误 | | OLAP_ERR_BE_MERGE_ERROR | -802 | BE Compaction合并错误 | -| OLAP_ERR_BE_COMPUTE_VERSION_HASH_ERROR | -803 | BE Compaction 计算版本哈希错误 | | OLAP_ERR_CAPTURE_ROWSET_ERROR | -804 | 找不到Rowset对应的版本 | | OLAP_ERR_BE_SAVE_HEADER_ERROR | -805 | BE Compaction保存Header错误 | | OLAP_ERR_BE_INIT_OLAP_DATA | -806 | BE Compaction 初始化OLAP数据错误 | diff --git a/gensrc/thrift/MetaStoreService.thrift b/gensrc/thrift/MetaStoreService.thrift deleted file mode 100644 index 58ddda3..0000000 --- a/gensrc/thrift/MetaStoreService.thrift +++ /dev/null @@ -1,157 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -namespace cpp doris -namespace java org.apache.doris.thrift - -include "AgentService.thrift" -include "PaloInternalService.thrift" -include "Status.thrift" -include "Types.thrift" - -// Two or more BEs will try to modify tablet meta or rowset meta -// snowflake using a transaction mechanism to avoid concurrency or conflict -// but our meta store service may not have transaction. We only assume that the meta store -// service has CAS mechanism. It depends on CAS mechanism to solve concurrency problem. -// Only tablet meta has CAS mechanism, rowset meta does not have it. If rowset meta related request has expected version -// it means the service should check tablet meta's expect version. -// -// Meta store service should provide batch interface to allow BEs getting or saving meta batch by batch -// since batch is more efficient. -// -// Every response has a status field to indicate whether the request is successful or failed - -struct SaveTabletMetaReq { - // the tablet id that the rowset belongs to - 1: optional Types.TTabletId tablet_id - // tablet's schema hash - 2: optional Types.TSchemaHash schema_hash - 3: optional binary meta_binary - // if expected modify version is set then the service should check - // if current version == exp version. it indicates the service should use - // CAS mechanism - 4: optional i64 expected_modify_version - 5: optional i64 new_modify_version -} - -struct BatchSaveTabletMetaReq { - 1: optional list<SaveTabletMetaReq> reqs -} - -struct GetTabletMetaReq { - // the tablet id that the rowset belongs to - 1: optional Types.TTabletId tablet_id - // tablet's schema hash - 2: optional Types.TSchemaHash schema_hash - // indicate whether to get the increment rowsets - 3: optional bool include_rowsets -} - -struct BatchGetTabletMetaReq { - 1: list<GetTabletMetaReq> reqs -} - -struct SaveRowsetMetaReq { - // the tablet id that the rowset belongs to - 1: optional Types.TTabletId tablet_id - // tablet's schema hash - 2: optional Types.TSchemaHash schema_hash - // rowset's start version - 3: optional Types.TVersion start_version - // rowset's end version - 4: optional Types.TVersion end_version - // rowset's version hash - 5: optional Types.TVersionHash version_hash - 6: optional i64 rowset_id - // the txn that the rowset belongs to, it maybe 0 because the rowset maybe generated during compaction - 7: optional i64 txn_id - 8: optional binary meta_binary - // if expected modify version is set, then the service should check tablet meta's current version == expected version - // if the expected version is not set, then the service will not check it - 9: optional i64 expected_modify_version - 10: optional i64 new_modify_version -} - -struct BatchSaveRowsetMetaReq { - 1: optional list<SaveRowsetMetaReq> reqs -} - -// could use txn id to query rowset or using version to query rowset -struct GetRowsetMetaReq { - // the tablet id that the rowset belongs to - 1: optional Types.TTabletId tablet_id - // tablet's schema hash - 2: optional Types.TSchemaHash schema_hash - // rowset's start version - 3: optional Types.TVersion start_version - // rowset's end version - 4: optional Types.TVersion end_version - 5: optional Types.TVersionHash version_hash - // rowset related txn id - 6: optional i64 txn_id -} - -struct BatchGetRowsetMetaReq { - 1: optional list<GetRowsetMetaReq> reqs -} - -struct SaveTabletMetaResponse { - 1: optional Status.TStatus status -} - -struct BatchSaveTabletMetaResponse { - 1: optional list<SaveTabletMetaResponse> resps -} - -struct GetTabletMetaResponse { - 1: optional Status.TStatus status - 2: optional binary tablet_meta - 3: optional list<binary> rowset_metas - 4: optional i64 modify_version -} - -struct BatchGetTabletMetaResponse { - 1: optional list<GetTabletMetaResponse> resps -} - -struct SaveRowsetMetaResponse { - 1: optional Status.TStatus status -} - -struct BatchSaveRowsetMetaResponse { - 1: optional list<SaveRowsetMetaResponse> resps -} - -struct GetRowsetMetaResponse { - 1: optional Status.TStatus status - 2: optional list<binary> rowset_metas -} - -struct BatchGetRowsetMetaResponse { - 1: optional list<GetRowsetMetaResponse> resps -} - -// currently there are only batch interfaces -service MetaStoreService { - BatchSaveTabletMetaResponse save_tablet_meta(1: BatchSaveTabletMetaReq save_tablet_meta_req) - - BatchGetTabletMetaResponse get_tablet_meta(1: BatchGetTabletMetaReq get_tablet_meta_req) - - BatchSaveRowsetMetaResponse save_rowset_meta(1: BatchSaveRowsetMetaReq save_rowset_meta_req) - - BatchGetRowsetMetaResponse get_rowset_meta(1: BatchGetRowsetMetaReq get_rowset_meta_req) -} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org