From fde3941185d428d9295eea3134659045a35bbf2b Mon Sep 17 00:00:00 2001 From: ZHAO Chun Date: Wed, 24 Jul 2019 14:48:01 +0800 Subject: [PATCH] Remove unused code (#1537) --- be/src/olap/rowset/alpha_rowset.cpp | 81 ----------------------------- be/src/olap/rowset/alpha_rowset.h | 42 --------------- be/src/olap/rowset/rowset.h | 60 +++++++-------------- 3 files changed, 19 insertions(+), 164 deletions(-) diff --git a/be/src/olap/rowset/alpha_rowset.cpp b/be/src/olap/rowset/alpha_rowset.cpp index 2fd36df9e1..a1122360c5 100644 --- a/be/src/olap/rowset/alpha_rowset.cpp +++ b/be/src/olap/rowset/alpha_rowset.cpp @@ -43,7 +43,6 @@ AlphaRowset::AlphaRowset(const TabletSchema* schema, _is_cumulative_rowset = true; } } - _ref_count = 0; } OLAPStatus AlphaRowset::init() { @@ -116,38 +115,10 @@ OLAPStatus AlphaRowset::remove() { return OLAP_SUCCESS; } -void AlphaRowset::to_rowset_pb(RowsetMetaPB* rs_meta) { - return _rowset_meta->to_rowset_pb(rs_meta); -} - RowsetMetaSharedPtr AlphaRowset::rowset_meta() const { return _rowset_meta; } -size_t AlphaRowset::data_disk_size() const { - return _rowset_meta->total_disk_size(); -} - -size_t AlphaRowset::index_disk_size() const { - return _rowset_meta->index_disk_size(); -} - -bool AlphaRowset::empty() const { - return _rowset_meta->empty(); -} - -bool AlphaRowset::zero_num_rows() const { - return _rowset_meta->num_rows() == 0; -} - -size_t AlphaRowset::num_rows() const { - return _rowset_meta->num_rows(); -} - -Version AlphaRowset::version() const { - return _rowset_meta->version(); -} - void AlphaRowset::set_version_and_version_hash(Version version, VersionHash version_hash) { _rowset_meta->set_version(version); _rowset_meta->set_version_hash(version_hash); @@ -179,34 +150,6 @@ void AlphaRowset::set_version_and_version_hash(Version version, VersionHash ver _is_pending_rowset = false; } -int64_t AlphaRowset::start_version() const { - return _rowset_meta->version().first; -} - -int64_t AlphaRowset::end_version() const { - return _rowset_meta->version().second; -} - -VersionHash AlphaRowset::version_hash() const { - return _rowset_meta->version_hash(); -} - -bool AlphaRowset::in_use() const { - return _ref_count > 0; -} - -void AlphaRowset::acquire() { - atomic_inc(&_ref_count); -} - -void AlphaRowset::release() { - atomic_dec(&_ref_count); -} - -int64_t AlphaRowset::ref_count() const { - return _ref_count; -} - OLAPStatus AlphaRowset::make_snapshot(const std::string& snapshot_path, std::vector* success_links) { for (auto& segment_group : _segment_groups) { @@ -272,34 +215,10 @@ OLAPStatus AlphaRowset::remove_old_files(std::vector* files_to_remo return OLAP_SUCCESS; } -RowsetId AlphaRowset::rowset_id() const { - return _rowset_meta->rowset_id(); -} - -int64_t AlphaRowset::creation_time() { - return _rowset_meta->creation_time(); -} - bool AlphaRowset::is_pending() const { return _is_pending_rowset; } -PUniqueId AlphaRowset::load_id() const { - return _rowset_meta->load_id(); -} - -int64_t AlphaRowset::txn_id() const { - return _rowset_meta->txn_id(); -} - -int64_t AlphaRowset::partition_id() const { - return _rowset_meta->partition_id(); -} - -bool AlphaRowset::delete_flag() { - return _rowset_meta->delete_flag(); -} - OLAPStatus AlphaRowset::split_range( const RowCursor& start_key, const RowCursor& end_key, diff --git a/be/src/olap/rowset/alpha_rowset.h b/be/src/olap/rowset/alpha_rowset.h index e39a85e96a..beaa8e8b15 100644 --- a/be/src/olap/rowset/alpha_rowset.h +++ b/be/src/olap/rowset/alpha_rowset.h @@ -52,38 +52,10 @@ public: OLAPStatus remove() override; - void to_rowset_pb(RowsetMetaPB* rs_meta) override; - RowsetMetaSharedPtr rowset_meta() const override; - size_t data_disk_size() const override; - - size_t index_disk_size() const override; - - bool empty() const override; - - bool zero_num_rows() const override; - - size_t num_rows() const override; - - Version version() const override; - void set_version_and_version_hash(Version version, VersionHash version_hash) override; - int64_t end_version() const override; - - int64_t start_version() const override; - - VersionHash version_hash() const override; - - bool in_use() const override; - - void acquire() override; - - void release() override; - - int64_t ref_count() const override; - OLAPStatus make_snapshot(const std::string& snapshot_path, std::vector* success_links) override; OLAPStatus copy_files_to_path(const std::string& dest_path, @@ -97,21 +69,8 @@ public: OLAPStatus remove_old_files(std::vector* files_to_remove) override; - RowsetId rowset_id() const override; - - int64_t creation_time() override; - bool is_pending() const override; - PUniqueId load_id() const override; - - int64_t txn_id() const override; - - int64_t partition_id() const override; - - // flag for push delete rowset - bool delete_flag() override; - OLAPStatus split_range( const RowCursor& start_key, const RowCursor& end_key, @@ -145,7 +104,6 @@ private: std::vector> _segment_groups; bool _is_cumulative_rowset; bool _is_pending_rowset; - atomic_t _ref_count; }; } // namespace doris diff --git a/be/src/olap/rowset/rowset.h b/be/src/olap/rowset/rowset.h index 87075b6447..07eac354ef 100644 --- a/be/src/olap/rowset/rowset.h +++ b/be/src/olap/rowset/rowset.h @@ -58,6 +58,25 @@ public: _is_loaded= loaded; } + // 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(); } + bool zero_num_rows() const { return rowset_meta()->num_rows() == 0; } + size_t num_rows() const { return rowset_meta()->num_rows(); } + Version version() const { return rowset_meta()->version(); } + RowsetId rowset_id() const { return rowset_meta()->rowset_id(); } + int64_t creation_time() { return rowset_meta()->creation_time(); } + PUniqueId load_id() const { return rowset_meta()->load_id(); } + int64_t txn_id() const { return rowset_meta()->txn_id(); } + int64_t partition_id() const { return rowset_meta()->partition_id(); } + // flag for push delete rowset + bool delete_flag() const { return rowset_meta()->delete_flag(); } + void to_rowset_pb(RowsetMetaPB* rs_meta) { return rowset_meta()->to_rowset_pb(rs_meta); } + // this api is for lazy loading data // always means that there are some io virtual OLAPStatus load(bool use_cache = true) = 0; @@ -66,38 +85,10 @@ public: virtual OLAPStatus remove() = 0; - virtual void to_rowset_pb(RowsetMetaPB* rs_meta) = 0; - virtual RowsetMetaSharedPtr rowset_meta() const = 0; - virtual size_t data_disk_size() const = 0; - - virtual size_t index_disk_size() const = 0; - - virtual bool empty() const = 0; - - virtual bool zero_num_rows() const = 0; - - virtual size_t num_rows() const = 0; - - virtual Version version() const = 0; - virtual void set_version_and_version_hash(Version version, VersionHash version_hash) = 0; - virtual int64_t end_version() const = 0; - - virtual int64_t start_version() const = 0; - - virtual VersionHash version_hash() const = 0; - - virtual bool in_use() const = 0; - - virtual void acquire() = 0; - - virtual void release() = 0; - - virtual int64_t ref_count() const = 0; - virtual OLAPStatus make_snapshot(const std::string& snapshot_path, std::vector* success_links) = 0; virtual OLAPStatus copy_files_to_path(const std::string& dest_path, @@ -105,21 +96,8 @@ public: virtual OLAPStatus remove_old_files(std::vector* files_to_remove) = 0; - virtual RowsetId rowset_id() const = 0; - - virtual int64_t creation_time() = 0; - virtual bool is_pending() const = 0; - virtual PUniqueId load_id() const = 0; - - virtual int64_t txn_id() const = 0; - - virtual int64_t partition_id() const = 0; - - // flag for push delete rowset - virtual bool delete_flag() = 0; - virtual bool check_path(const std::string& path) = 0; virtual std::string unique_id() = 0;