From 403a6b5a7e75d941ecb7bde1540306dae248d49b Mon Sep 17 00:00:00 2001 From: yiguolei <676222867@qq.com> Date: Wed, 12 Dec 2018 13:51:02 +0800 Subject: [PATCH 01/15] move txn related task to txn manager (#416) --- be/src/olap/storage_engine.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/be/src/olap/storage_engine.h b/be/src/olap/storage_engine.h index 6152934cb3c41a..5f2c2b9e415223 100644 --- a/be/src/olap/storage_engine.h +++ b/be/src/olap/storage_engine.h @@ -484,6 +484,13 @@ class StorageEngine { // 错误磁盘所在百分比,超过设定的值,则engine需要退出运行 uint32_t _min_percentage_of_error_disk; +<<<<<<< HEAD +======= + + RWMutex _tablet_map_lock; + tablet_map_t _tablet_map; + size_t _global_tablet_id; +>>>>>>> move txn related task to txn manager (#416) Cache* _file_descriptor_lru_cache; Cache* _index_stream_lru_cache; uint32_t _max_base_compaction_task_per_disk; @@ -527,7 +534,10 @@ class StorageEngine { std::atomic_bool _is_report_disk_state_already; std::atomic_bool _is_report_tablet_already; TxnManager _txn_mgr; +<<<<<<< HEAD TabletManager _tablet_mgr; +======= +>>>>>>> move txn related task to txn manager (#416) }; } // namespace doris From 7ea5cfff70b940eb4cd589f672151447f8c08ca9 Mon Sep 17 00:00:00 2001 From: yiguolei <676222867@qq.com> Date: Wed, 12 Dec 2018 17:44:27 +0800 Subject: [PATCH 02/15] Remove olaprootpath and related unit test since it is useless (#419) --- a | 1 + 1 file changed, 1 insertion(+) create mode 100644 a diff --git a/a b/a new file mode 100644 index 00000000000000..678f931d5798a3 --- /dev/null +++ b/a @@ -0,0 +1 @@ +be_refactor From afa99842752759e491650b1d07d5aa22826419d8 Mon Sep 17 00:00:00 2001 From: lichaoyong Date: Thu, 13 Dec 2018 16:22:58 +0800 Subject: [PATCH 03/15] Remove check tablet code path (#427) --- a | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a b/a index 678f931d5798a3..1ecdc11bd2586f 100644 --- a/a +++ b/a @@ -1 +1 @@ -be_refactor +be_refactorbe_refactor From 36a734f4ae4892d30b9cf4688a4718e18dce90b0 Mon Sep 17 00:00:00 2001 From: kangpinghuang <40422952+kangpinghuang@users.noreply.github.com> Date: Mon, 17 Dec 2018 15:12:06 +0800 Subject: [PATCH 04/15] add rowset meta manager (#429) * add rowset meta manager * Fix cr related problem 1. add virtual destructor 2. modify RowsetMeta realization --- a | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/a b/a index 1ecdc11bd2586f..83b486200f50f5 100644 --- a/a +++ b/a @@ -1 +1,2 @@ -be_refactorbe_refactor +ee_refror + From 2cc042f0e52601d94b40cbb22467766755be2514 Mon Sep 17 00:00:00 2001 From: yiguolei <676222867@qq.com> Date: Mon, 17 Dec 2018 15:12:54 +0800 Subject: [PATCH 05/15] Move tablet management code from StorageEngine to TabletManager (#437) --- be/src/olap/data_dir.cpp | 12 ++++++++++++ be/src/olap/storage_engine.h | 10 ---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index 7ef19358a4e306..5eea87fc997540 100755 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -71,7 +71,11 @@ DataDir::~DataDir() { } } +<<<<<<< HEAD:be/src/olap/data_dir.cpp Status DataDir::init() { +======= +Status OlapStore::init() { +>>>>>>> Move tablet management code from StorageEngine to TabletManager (#437):be/src/olap/store.cpp _rand_seed = static_cast(time(NULL)); if (posix_memalign((void**)&_test_file_write_buf, DIRECT_IO_ALIGNMENT, @@ -437,6 +441,7 @@ OLAPStatus DataDir::deregister_tablet(Tablet* tablet) { return OLAP_SUCCESS; } +<<<<<<< HEAD:be/src/olap/data_dir.cpp void DataDir::clear_tablets(std::vector* tablet_infos) { for (auto& tablet : _tablet_set) { tablet_infos->push_back(tablet); @@ -449,6 +454,13 @@ std::string DataDir::get_absolute_shard_path(const std::string& shard_string) { } std::string DataDir::get_absolute_tablet_path(TabletMeta* header, bool with_schema_hash) { +======= +std::string OlapStore::get_absolute_shard_path(const std::string& shard_string) { + return _path + DATA_PREFIX + "/" + shard_string; +} + +std::string OlapStore::get_absolute_tablet_path(TabletMeta* header, bool with_schema_hash) { +>>>>>>> Move tablet management code from StorageEngine to TabletManager (#437):be/src/olap/store.cpp if (with_schema_hash) { return _path + DATA_PREFIX + "/" + std::to_string(header->shard()) + "/" + std::to_string(header->tablet_id()) + "/" + std::to_string(header->schema_hash()); diff --git a/be/src/olap/storage_engine.h b/be/src/olap/storage_engine.h index 5f2c2b9e415223..6152934cb3c41a 100644 --- a/be/src/olap/storage_engine.h +++ b/be/src/olap/storage_engine.h @@ -484,13 +484,6 @@ class StorageEngine { // 错误磁盘所在百分比,超过设定的值,则engine需要退出运行 uint32_t _min_percentage_of_error_disk; -<<<<<<< HEAD -======= - - RWMutex _tablet_map_lock; - tablet_map_t _tablet_map; - size_t _global_tablet_id; ->>>>>>> move txn related task to txn manager (#416) Cache* _file_descriptor_lru_cache; Cache* _index_stream_lru_cache; uint32_t _max_base_compaction_task_per_disk; @@ -534,10 +527,7 @@ class StorageEngine { std::atomic_bool _is_report_disk_state_already; std::atomic_bool _is_report_tablet_already; TxnManager _txn_mgr; -<<<<<<< HEAD TabletManager _tablet_mgr; -======= ->>>>>>> move txn related task to txn manager (#416) }; } // namespace doris From e86009490c69cc8f91e91fbea911162c88e8af79 Mon Sep 17 00:00:00 2001 From: yiguolei <676222867@qq.com> Date: Tue, 18 Dec 2018 13:59:03 +0800 Subject: [PATCH 06/15] Rename OlapStore to DataDir (#446) --- be/src/olap/data_dir.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index 5eea87fc997540..7ef19358a4e306 100755 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -71,11 +71,7 @@ DataDir::~DataDir() { } } -<<<<<<< HEAD:be/src/olap/data_dir.cpp Status DataDir::init() { -======= -Status OlapStore::init() { ->>>>>>> Move tablet management code from StorageEngine to TabletManager (#437):be/src/olap/store.cpp _rand_seed = static_cast(time(NULL)); if (posix_memalign((void**)&_test_file_write_buf, DIRECT_IO_ALIGNMENT, @@ -441,7 +437,6 @@ OLAPStatus DataDir::deregister_tablet(Tablet* tablet) { return OLAP_SUCCESS; } -<<<<<<< HEAD:be/src/olap/data_dir.cpp void DataDir::clear_tablets(std::vector* tablet_infos) { for (auto& tablet : _tablet_set) { tablet_infos->push_back(tablet); @@ -454,13 +449,6 @@ std::string DataDir::get_absolute_shard_path(const std::string& shard_string) { } std::string DataDir::get_absolute_tablet_path(TabletMeta* header, bool with_schema_hash) { -======= -std::string OlapStore::get_absolute_shard_path(const std::string& shard_string) { - return _path + DATA_PREFIX + "/" + shard_string; -} - -std::string OlapStore::get_absolute_tablet_path(TabletMeta* header, bool with_schema_hash) { ->>>>>>> Move tablet management code from StorageEngine to TabletManager (#437):be/src/olap/store.cpp if (with_schema_hash) { return _path + DATA_PREFIX + "/" + std::to_string(header->shard()) + "/" + std::to_string(header->tablet_id()) + "/" + std::to_string(header->schema_hash()); From 03392060997f69c7390df36ee061e16b5fc0a294 Mon Sep 17 00:00:00 2001 From: yiguolei <676222867@qq.com> Date: Wed, 12 Dec 2018 17:44:27 +0800 Subject: [PATCH 07/15] Remove olaprootpath and related unit test since it is useless (#419) --- a | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 a diff --git a/a b/a deleted file mode 100644 index 83b486200f50f5..00000000000000 --- a/a +++ /dev/null @@ -1,2 +0,0 @@ -ee_refror - From 6f16335c3ed76557ed1917ee1de23234f49a7aa9 Mon Sep 17 00:00:00 2001 From: kangpinghuang <40422952+kangpinghuang@users.noreply.github.com> Date: Thu, 13 Dec 2018 14:33:04 +0800 Subject: [PATCH 08/15] modify header to tablet meta (#426) --- a | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 a diff --git a/a b/a new file mode 100644 index 00000000000000..e69de29bb2d1d6 From 054260396629041e153a3f3006b97c2d6615807c Mon Sep 17 00:00:00 2001 From: lichaoyong Date: Thu, 13 Dec 2018 16:22:58 +0800 Subject: [PATCH 09/15] Remove check tablet code path (#427) --- a | 1 + 1 file changed, 1 insertion(+) diff --git a/a b/a index e69de29bb2d1d6..76d4bb83f8dab3 100644 --- a/a +++ b/a @@ -0,0 +1 @@ +add From d402866343cf2af88dff2ffac9f979e8a32ea2f9 Mon Sep 17 00:00:00 2001 From: kangpinghuang <40422952+kangpinghuang@users.noreply.github.com> Date: Mon, 17 Dec 2018 15:12:06 +0800 Subject: [PATCH 10/15] add rowset meta manager (#429) * add rowset meta manager * Fix cr related problem 1. add virtual destructor 2. modify RowsetMeta realization --- a | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a b/a index 76d4bb83f8dab3..d7293c97550718 100644 --- a/a +++ b/a @@ -1 +1 @@ -add +gensrc/thrift/Status.thrift From 353cc0a5c81839cc6d10ff6d0b42293a6defb552 Mon Sep 17 00:00:00 2001 From: kangpinghuang <40422952+kangpinghuang@users.noreply.github.com> Date: Thu, 13 Dec 2018 14:33:04 +0800 Subject: [PATCH 11/15] modify header to tablet meta (#426) --- a | 1 - 1 file changed, 1 deletion(-) delete mode 100644 a diff --git a/a b/a deleted file mode 100644 index d7293c97550718..00000000000000 --- a/a +++ /dev/null @@ -1 +0,0 @@ -gensrc/thrift/Status.thrift From e2909e872f3716b3ee6a5e39169adc7c1653e3ca Mon Sep 17 00:00:00 2001 From: lichaoyong Date: Thu, 13 Dec 2018 16:22:58 +0800 Subject: [PATCH 12/15] Remove check tablet code path (#427) --- a | 1 + 1 file changed, 1 insertion(+) create mode 100644 a diff --git a/a b/a new file mode 100644 index 00000000000000..290fd2bd67c21d --- /dev/null +++ b/a @@ -0,0 +1 @@ +be/src/olap/data_dir.h From 8c6bbede75c039b6817baf7ff4da726e91a0c4bd Mon Sep 17 00:00:00 2001 From: chaoyli Date: Mon, 17 Dec 2018 15:15:10 +0800 Subject: [PATCH 13/15] Refactor Tablet and TabletMeta --- a | 1 - gensrc/proto/olap_file.proto | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) delete mode 100644 a diff --git a/a b/a deleted file mode 100644 index 290fd2bd67c21d..00000000000000 --- a/a +++ /dev/null @@ -1 +0,0 @@ -be/src/olap/data_dir.h diff --git a/gensrc/proto/olap_file.proto b/gensrc/proto/olap_file.proto index 1b460055aab923..8a5e33f4d2294b 100644 --- a/gensrc/proto/olap_file.proto +++ b/gensrc/proto/olap_file.proto @@ -243,6 +243,47 @@ message TabletMetaPB { optional AlterTabletPB alter_tablet_task = 10; } +enum AlterTabletStatePB { + RUNNING = 0; + FINISHED = 1; + FAILED = 2; +} + +enum AlterTabletTypePB { + SCHEMA_CHANGE = 0; + ROLLUP = 1; +} + +message AlterTabletPB { + required int64 related_tablet_id = 1; + optional int64 related_schema_hash = 2; + repeated RowsetMetaPB rowsets_to_alter = 3; + optional AlterTabletStatePB alter_state = 4; + optional AlterTabletTypePB alter_type = 5; +} + +enum TabletStatePB { + NOTREADY = 0; // under alter table, rollup, clone + RUNNING = 1; + TOMBSTONED = 2; + STOPPED = 3; + SHUTDOWN = 4; +} + +message TabletMetaPB { + optional int64 table_id = 1; + optional int64 partition_id = 2; + optional int64 tablet_id = 3; + optional int64 schema_hash = 4; + optional int16 shard_id = 5; + + optional SchemaPB schema = 6; + repeated RowsetMetaPB rs_meta = 7; + repeated RowsetMetaPB inc_rs_meta = 8; + optional TabletStatePB tablet_state = 9; + optional AlterTabletPB alter_tablet_task = 10; +} + message OLAPIndexHeaderMessage { required int32 start_version = 1; required int32 end_version = 2; From eed551f7504f4753f731366f7ac9686c26075a8a Mon Sep 17 00:00:00 2001 From: chaoyli Date: Tue, 25 Dec 2018 18:31:52 +0800 Subject: [PATCH 14/15] Change Rowset pointer to std::shared_ptr --- gensrc/proto/olap_file.proto | 41 ------------------------------------ 1 file changed, 41 deletions(-) diff --git a/gensrc/proto/olap_file.proto b/gensrc/proto/olap_file.proto index 8a5e33f4d2294b..1b460055aab923 100644 --- a/gensrc/proto/olap_file.proto +++ b/gensrc/proto/olap_file.proto @@ -243,47 +243,6 @@ message TabletMetaPB { optional AlterTabletPB alter_tablet_task = 10; } -enum AlterTabletStatePB { - RUNNING = 0; - FINISHED = 1; - FAILED = 2; -} - -enum AlterTabletTypePB { - SCHEMA_CHANGE = 0; - ROLLUP = 1; -} - -message AlterTabletPB { - required int64 related_tablet_id = 1; - optional int64 related_schema_hash = 2; - repeated RowsetMetaPB rowsets_to_alter = 3; - optional AlterTabletStatePB alter_state = 4; - optional AlterTabletTypePB alter_type = 5; -} - -enum TabletStatePB { - NOTREADY = 0; // under alter table, rollup, clone - RUNNING = 1; - TOMBSTONED = 2; - STOPPED = 3; - SHUTDOWN = 4; -} - -message TabletMetaPB { - optional int64 table_id = 1; - optional int64 partition_id = 2; - optional int64 tablet_id = 3; - optional int64 schema_hash = 4; - optional int16 shard_id = 5; - - optional SchemaPB schema = 6; - repeated RowsetMetaPB rs_meta = 7; - repeated RowsetMetaPB inc_rs_meta = 8; - optional TabletStatePB tablet_state = 9; - optional AlterTabletPB alter_tablet_task = 10; -} - message OLAPIndexHeaderMessage { required int32 start_version = 1; required int32 end_version = 2; From 5a8d646f645117d88fbfa1a7acf84849fb8103b2 Mon Sep 17 00:00:00 2001 From: chaoyli Date: Wed, 26 Dec 2018 11:29:07 +0800 Subject: [PATCH 15/15] Fixed compilation error in refactoring tablet and tabletmeta --- be/src/olap/olap_common.h | 9 --- be/src/olap/rowset_graph.cpp | 23 ++++---- be/src/olap/rowset_graph.h | 17 ++++-- be/src/olap/tablet.cpp | 30 +++++----- be/src/olap/tablet.h | 24 ++++++-- be/src/olap/tablet_meta.cpp | 52 ++++++++--------- be/src/olap/tablet_meta.h | 50 +++++++++-------- be/src/olap/tablet_schema.cpp | 101 ++++++++++++++++++++++++++++++++++ be/src/olap/tablet_schema.h | 60 ++++++++++++++++++++ gensrc/proto/olap_file.proto | 44 ++++++++++----- 10 files changed, 300 insertions(+), 110 deletions(-) create mode 100644 be/src/olap/tablet_schema.cpp create mode 100644 be/src/olap/tablet_schema.h diff --git a/be/src/olap/olap_common.h b/be/src/olap/olap_common.h index b5bda19dc09523..5d45adcd70b136 100644 --- a/be/src/olap/olap_common.h +++ b/be/src/olap/olap_common.h @@ -186,15 +186,6 @@ enum ReaderType { // , such as <100, 110> //using Version = std::pair; typedef std::pair Version; - -// used for hash-struct of hash_map. -struct HashOfVersion { - uint64_t operator()(const Version& version) const { - uint64_t value = version.first ^ version.second; - return std::hash(value); - } -}; - typedef std::vector Versions; // It is used to represent Graph vertex. diff --git a/be/src/olap/rowset_graph.cpp b/be/src/olap/rowset_graph.cpp index fc9d7483923085..be0d5a8e96d5df 100644 --- a/be/src/olap/rowset_graph.cpp +++ b/be/src/olap/rowset_graph.cpp @@ -17,7 +17,9 @@ #include "olap/rowset_graph.h" -NewStatus Tablet::construct_rowset_graph(const std::vector& rs_metas) { +namespace doris { + +OLAPStatus Tablet::construct_rowset_graph(const std::vector& rs_metas) { if (rs_metas.size() == 0) { VLOG(3) << "there is no version in the header."; return Status::OK(); @@ -43,7 +45,7 @@ NewStatus Tablet::construct_rowset_graph(const std::vector& rs_metas } // Add vertex to graph. - NewStatus status = add_vertex_to_graph(vertex_values[i]); + OLAPStatus status = add_vertex_to_graph(vertex_values[i]); if (!status.ok()) LOG(WARNING) << "fail to add vertex to version graph. vertex=" << vertex_values[i]; return status; @@ -67,19 +69,19 @@ NewStatus Tablet::construct_rowset_graph(const std::vector& rs_metas } } -NewStatus RowsetGraph::add_version_to_graph(const Version& version) { +OLAPStatus RowsetGraph::add_version_to_graph(const Version& version) { // Add version.first as new vertex of version graph if not exist. int start_vertex_value = version.first; int end_vertex_value = version.second + 1; // Add vertex to graph. - NewStatus status = add_vertex_to_graph(start_vertex_value); + OLAPStatus status = add_vertex_to_graph(start_vertex_value); if (!status.ok()) { LOG(WARNING) << "fail to add vertex to version graph. vertex=" << start_vertex_value; return status; } - NewStatus status = add_vertex_to_graph(end_vertex_value); + OLAPStatus status = add_vertex_to_graph(end_vertex_value); if (!status.ok()) { LOG(WARNING) << "fail to add vertex to version graph. vertex=" << end_vertex_value; return status; @@ -100,7 +102,7 @@ NewStatus RowsetGraph::add_version_to_graph(const Version& version) { return Status::OK(); } -NewStatus RowsetGraph::delete_version_from_graph(const Version& version) { +OLAPStatus RowsetGraph::delete_version_from_graph(const Version& version) { int start_vertex_value = version.first; int end_vertex_value = version.second + 1; @@ -108,7 +110,7 @@ NewStatus RowsetGraph::delete_version_from_graph(const Version& version) { || _vertex_helper_map->find(end_vertex_value) == _vertex_helper_map->end()) { LOG(WARNING) << "vertex for version does not exists. " << "version=" << version.first << "-" << version.second; - return NewStatus::NotFound("vertex for version does not exists."); + return OLAPStatus::NotFound("vertex for version does not exists."); } int start_vertex_index = (*_vertex_helper_map)[start_vertex_value]; @@ -131,7 +133,7 @@ NewStatus RowsetGraph::delete_version_from_graph(const Version& version) { return Status::OK(); } -NewStatus RowsetGraph::_add_vertex_to_graph(int vertex_value) { +OLAPStatus RowsetGraph::_add_vertex_to_graph(int vertex_value) { // Vertex with vertex_value already exists. if (_vertex_index_map->find(vertex_value) != _vertex_index_map->end()) { VLOG(3) << "vertex with vertex value already exists. value=" << vertex_value; @@ -140,7 +142,7 @@ NewStatus RowsetGraph::_add_vertex_to_graph(int vertex_value) { list* edges = new(std::nothrow) list(); if (edges == NULL) { - return NewStatus::Corruption("malloc memory failed for edge list"); + return OLAPStatus::Corruption("malloc memory failed for edge list"); } Vertex vertex = {vertex_value, edges}; @@ -149,7 +151,8 @@ NewStatus RowsetGraph::_add_vertex_to_graph(int vertex_value) { return Status::OK(); } -NewStatus Tablet::capture_consistent_versions(const Version& spec_version, version* version_path) { +OLAPStatus Tablet::capture_consistent_versions(const Version& spec_version, + std::vector* version_path) { if (spec_version.first > spec_version.second) { LOG(WARNING) << "invalid specfied version. " << "spec_version=" << spec_version.first << "-" << spec_version.second; diff --git a/be/src/olap/rowset_graph.h b/be/src/olap/rowset_graph.h index f39c51d2e74ec1..43e9026266dbd6 100644 --- a/be/src/olap/rowset_graph.h +++ b/be/src/olap/rowset_graph.h @@ -18,15 +18,20 @@ #ifndef DORIS_BE_SRC_OLAP_ROWSET_GRAPH_H #define DORIS_BE_SRC_OLAP_ROWSET_GRAPH_H +#include "olap/olap_common.h" +#include "olap/olap_define.h" + +namespace doris { + class RowsetGraph { public: - NewStatus construct_rowset_graph(const std::vector& rs_metas); - NewStatus add_version_to_graph(const Versrion& version); - NewStatus delete_version_from_graph(const Version& version); - NewStatus capture_consistent_versions(const Version& spec_version, - version* version_path); + OLAPStatus construct_rowset_graph(const std::vector& rs_metas); + OLAPStatus add_version_to_graph(const Version& version); + OLAPStatus delete_version_from_graph(const Version& version); + OLAPStatus capture_consistent_versions(const Version& spec_version, + std::vector* version_path); private: - NewStatus _add_vertex_to_graph(int vertex_value); + OLAPStatus _add_vertex_to_graph(int vertex_value); // OLAP version contains two parts, [start_version, end_version]. In order // to construct graph, the OLAP version has two corresponding vertex, one diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index f17474fb5899a0..84a7688a6835f0 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -58,12 +58,8 @@ Tablet(TabletMeta* tablet_meta, DataDir* data_dir) { } Tablet::~Tablet() { - if (_tablet_meta == NULL) { - return; // for convenience of mock test. - } - // ensure that there is nobody using Tablet, like acquiring OLAPData(SegmentGroup) - WriteLock wrlock(_meta_lock); + WriteLock wrlock(&_meta_lock); for (auto& it : _version_rowset_map) { SAFE_DELETE(it.second); } @@ -87,7 +83,7 @@ bool Tablet::can_do_compaction() { // 如果table正在做schema change,则通过选路判断数据是否转换完成 // 如果选路成功,则转换完成,可以进行BE // 如果选路失败,则转换未完成,不能进行BE - ReadLock rdlock(_meta_lock); + ReadLock rdlock(&_meta_lock); RowsetSharedPtr lastest_rowset = lastest_version(); if (lastest_rowset == NULL) { return false; @@ -96,7 +92,7 @@ bool Tablet::can_do_compaction() { Version test_version = Version(0, lastest_version->end_version()); vector path_versions; if (OLAP_SUCCESS != _rs_graph->capture_consistent_versions(test_version, &path_versions)) { - LOG(WARNING) << "tablet has missed version. tablet=" << table->full_name(); + LOG(WARNING) << "tablet has missed version. tablet=" << full_name(); return false; } @@ -132,7 +128,7 @@ OLAPStatus Tablet::capture_consistent_rowsets(const Version& spec_version, void Tablet::acquire_rs_reader_by_version(const vector& version_vec, vector>* rs_readers) const { - DCHECK(rs_readers != NULL && rs_readers.empty()); + DCHECK(rs_readers != NULL && rs_readers->empty()); for (auto version : version_vec) { auto it2 = _rs_version_map.find(*it1); if (it2 == _rs_version_map.end()) { @@ -149,7 +145,7 @@ void Tablet::acquire_rs_reader_by_version(const vector& version_vec, << ", version=" << version.first << "-" << version.second; release_rs_readers(rs_readers); } - rs_reader.push_back(std::move(rs_reader)): + rs_reader->push_back(std::move(rs_reader)): } } @@ -160,11 +156,11 @@ OLAPStatus Tablet::release_rs_readers(vector>* rs_ } rs_readers->clear(); - return OLAP_SUCCESS; + return OLAP_SUCCESS; } OLAPStatus Tablet::add_inc_rowset(const Rowset& rowset) { - return _table_meta->add_inc_rs_meta(rowset->get_rs_meta()); + return _table_meta.add_inc_rs_meta(rowset->get_rs_meta()); } OLAPStatus Tablet::delete_expired_inc_rowset() { @@ -201,7 +197,7 @@ void Tablet::calc_missed_versions(int64_t spec_version, DCHECK(spec_version > 0) << "invalid spec_version: " << spec_version; std::list existing_versions; for (RowsetMeta& rs : _tablet_meta->get_all_rs_metas()) { - existing_versions.emplace_back(rs->version()); + existing_versions.emplace_back(rs.version()); } // sort the existing versions in ascending order @@ -210,7 +206,7 @@ void Tablet::calc_missed_versions(int64_t spec_version, return a.first < b.first; }); - // find the missing version until until_version + // find the missing version until spec_version int64_t last_version = -1; for (const Version& version : existing_versions) { if (version.first > last_version + 1) { @@ -223,8 +219,8 @@ void Tablet::calc_missed_versions(int64_t spec_version, break; } } - for (int64_t i = last_version + 1; i <= until_version; ++i) { - spec_versions->emplace_back(i, i); + for (int64_t i = last_version + 1; i <= spec_version; ++i) { + missed_versions->emplace_back(i, i); } } @@ -375,7 +371,7 @@ OLAPStatus Tablet::split_range( } cur_start_key.attach(entry.data); - last_start_key.allocate_memory_for_string_type(_tablet_schema); + last_start_key.allocate_memory_for_string_type(_schema); last_start_key.copy_without_pool(cur_start_key); // start_key是last start_key, 但返回的实际上是查询层给出的key ranges->emplace_back(start_key.to_tuple()); @@ -471,7 +467,7 @@ bool Tablet::is_schema_changing() { bool is_schema_changing = false; ReadLock rdlock(_meta_lock); - if (_tablet_meta->alter_state() != AlterTabletState::none) { + if (_tablet_meta->alter_state() != AlterTabletState::NONE) { is_schema_changing = true; } diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h index 24934b22a82e0a..c78599945f1448 100644 --- a/be/src/olap/tablet.h +++ b/be/src/olap/tablet.h @@ -32,6 +32,7 @@ #include "olap/tablet_meta.h" #include "olap/tuple.h" #include "olap/row_cursor.h" +#include "olap/rowset_graph.h" #include "olap/utils.h" namespace doris { @@ -40,6 +41,7 @@ class Rowset; class Tablet; class RowBlockPosition; class DataDir; +class RowsetReader; using TabletSharedPtr = std::shared_ptr; @@ -59,7 +61,7 @@ class Tablet : public std::enable_shared_from_this { double bloom_filter_fpp() const; bool equal(TTabletId tablet_id, TSchemaHash schema_hash); - Schema* schema() const; + TabletSchema* schema() const; const std::string& full_name() const; size_t num_fields() const; size_t num_null_fields(); @@ -100,7 +102,7 @@ class Tablet : public std::enable_shared_from_this { vector>* rs_readers) const; OLAPStatus release_rs_readers(vector>* rs_readers) const; - RMMutex* meta_lock(); + RWMutex* meta_lock(); Mutex* ingest_lock(); Mutex* base_lock(); Mutex* cumulative_lock(); @@ -120,7 +122,7 @@ class Tablet : public std::enable_shared_from_this { bool can_do_compaction(); DeletePredicatePB* add_delete_predicates() { - return _tablet_meta->add_delete_predicates(); + return _tablet_meta.add_delete_predicates(); } const google::protobuf::RepeatedPtrField& @@ -151,12 +153,22 @@ class Tablet : public std::enable_shared_from_this { RowsetGraph* _rs_graph; TabletMeta _tablet_meta; - Schema* _schema; - RMMutex _meta_lock; + TabletSchema* _schema; + RWMutex _meta_lock; Mutex _ingest_lock; Mutex _base_lock; Mutex _cumulative_lock; - std::unordered_map, HashOfVersion> _version_rowset_map; + + // used for hash-struct of hash_map. + struct HashOfVersion { + size_t operator()(const Version& version) const { + size_t seed = 0; + seed = HashUtil::hash64(&version.first, sizeof(version.first), seed); + seed = HashUtil::hash64(&version.second, sizeof(version.second), seed); + return seed; + } + }; + std::unordered_map _version_rowset_map; DISALLOW_COPY_AND_ASSIGN(Tablet); }; diff --git a/be/src/olap/tablet_meta.cpp b/be/src/olap/tablet_meta.cpp index cb55461c9d199e..533e1bf4a8e3e7 100644 --- a/be/src/olap/tablet_meta.cpp +++ b/be/src/olap/tablet_meta.cpp @@ -30,10 +30,10 @@ OLAPStatus TabletMeta::serialize(string* meta_binary) { OLAPStatus TabletMeta::serialize_unlock(string* meta_binary) { _tablet_meta_pb.SerializeToString(meta_binary); - return OLAP_SUCCESS: + return OLAP_SUCCESS; }; -OLAPStatus TabletMeta::deserialize(string* meta_binary) { +OLAPStatus TabletMeta::deserialize(const string& meta_binary) { std::lock_guard lock(_mutex); return deserialize_unlock(meta_binary); } @@ -59,28 +59,28 @@ OLAPStatus TabletMeta::deserialize_unlock(const string& meta_binary) { // generate TabletState switch (_tablet_meta_pb.tablet_state()) { - case NOT_READY: - _tablet_state = TabletState::kNotReady; + case PB_NOTREADY: + _tablet_state = TabletState::NOTREADY; break; - case RUNNING: - _tablet_state = TabletState::kRunning; + case PB_RUNNING: + _tablet_state = TabletState::RUNNING; break; - case TOMBSTONED: - _tablet_state = TabletState::kTombstoned; + case PB_TOMBSTONED: + _tablet_state = TabletState::TOMBSTONED; break; - case STOPPED: - _tablet_state = TabletState::kStopped; + case PB_STOPPED: + _tablet_state = TabletState::STOPPED; break; - case SHUTDOWN: - _tablet_state = TabletState::kShutdown; + case PB_SHUTDOWN: + _tablet_state = TabletState::SHUTDOWN; break; default: - LOG(WARNNING) << "tablet has no state. tablet=" << _tablet_id + LOG(WARNING) << "tablet has no state. tablet=" << _tablet_id << ", schema_hash=" << _schema_hash; } // generate AlterTabletTask - RETURN(_alter_task.deserialize_from_pb(_tablet_meta_pb.alter_tablet_task())); + RETURN_NOT_OK(_alter_task.init_from_pb(_tablet_meta_pb.alter_tablet_task())); return OLAP_SUCCESS; } @@ -91,7 +91,7 @@ OLAPStatus TabletMeta::save_meta() { OLAPStatus TabletMeta::save_meta_unlock() { string meta_binary; - serialize_unlock(meta_binary); + serialize_unlock(&meta_binary); OLAPStatus status = TabletMetaManager::save(_data_dir, _tablet_id, _schema_hash, meta_binary); if (status != OLAP_SUCCESS) { LOG(WARNING) << "fail to save tablet_meta. status=" << status.to_string() @@ -101,12 +101,12 @@ OLAPStatus TabletMeta::save_meta_unlock() { return status; } -OLAPStatus TabletMeta::to_meta_pb(TabletMetaPB* tablet_meta_pb) { +OLAPStatus TabletMeta::to_tablet_pb(TabletMetaPB* tablet_meta_pb) { std::lock_guard lock(_mutex); - return to_meta_pb_unlock(tablet_meta_pb); + return to_tablet_pb_unlock(tablet_meta_pb); } -OLAPStatus TabletMeta::to_meta_pb_unlock(TabletMetaPB* tablet_meta_pb) { +OLAPStatus TabletMeta::to_tablet_pb_unlock(TabletMetaPB* tablet_meta_pb) { tablet_meta_pb->set_table_id(_table_id); tablet_meta_pb->set_partition_id(_partition_id); tablet_meta_pb->set_table_id(_tablet_id); @@ -115,10 +115,10 @@ OLAPStatus TabletMeta::to_meta_pb_unlock(TabletMetaPB* tablet_meta_pb) { tablet_meta_pb->set_tablet_name(_tablet_name); for (auto rs : _rs_metas) { - rs->to_meta_pb(pb.add_rs_meta()); + rs.to_rowset_pb(pb.add_rs_meta()); } for (auto rs : _inc_rs_metas) { - rs->to_meta_pb(pb.add_inc_rc_meta()); + rs.to_rowset_pb(pb.add_inc_rc_meta()); } _schema.to_schema_pb(pb.mutable_schema()); @@ -129,16 +129,16 @@ OLAPStatus TabletMeta::add_inc_rs_meta(const RowsetMeta& rs_meta) { std::lock_guard lock(_mutex); // check RowsetMeta is valid - for (auts rs : _inc_rs_metas) { - if (rs.rowset_id() == rs_meta.rowset_id()()) { + for (auto rs : _inc_rs_metas) { + if (rs.rowset_id() == rs_meta.rowset_id()) { LOG(WARNING) << "rowset already exist. rowset_id=" << rs.rowset_id(); return OLAPStatus::AlreadyExist("rowset already exist."); } } _inc_rs_metas.push_back(std::move(rs_meta)); - RowsetMetaPB* rs_meta_pb = _tablet_meta_pb->add_inc_rs_meta(); - RETURN_NOT_OK(rs_meta->to_meta_pb(rs_meta_pb)); + RowsetMetaPB* rs_meta_pb = _tablet_meta_pb.add_inc_rs_meta(); + RETURN_NOT_OK(rs_meta.to_rowset_pb(rs_meta_pb)); RETURN_NOT_OK(save_meta_unlock()); return OLAP_SUCCESS; @@ -153,7 +153,7 @@ OLAPStatus TabletMeta::delete_inc_rs_meta_by_version(const Version& version) } TabletMetaPB tablet_meta_pb; - RETURN_NOT_OK(to_meta_pb_unlock(&tablet_meta_pb)); + RETURN_NOT_OK(to_tablet_pb_unlock(&tablet_meta_pb)); _tablet_meta_pb = std::move(tablet_meta_pb); RETURN_NOT_OK(save_meta_unlock()); @@ -186,7 +186,7 @@ OLAPStatus TabletMeta::modify_rowsets(const vector& to_add, } TabletMetaPB tablet_meta_pb; - RETURN_NOT_OK(to_meta_pb_unlock(&tablet_meta_pb)); + RETURN_NOT_OK(to_tablet_pb_unlock(&tablet_meta_pb)); _tablet_meta_pb = std::move(tablet_meta_pb); RETURN_NOT_OK(save_meta_unlock()); diff --git a/be/src/olap/tablet_meta.h b/be/src/olap/tablet_meta.h index 39d3a8e88ee907..297c1484fd4cf2 100644 --- a/be/src/olap/tablet_meta.h +++ b/be/src/olap/tablet_meta.h @@ -18,13 +18,15 @@ #ifndef DORIS_BE_SRC_OLAP_TABLET_META_H #define DORIS_BE_SRC_OLAP_TABLET_META_H +#include #include #include +#include "common/logging.h" #include "gen_cpp/olap_file.pb.h" -#include "gen_cpp/Types_types.h" #include "olap/olap_common.h" #include "olap/olap_define.h" +#include "olap/tablet_schema.h" using std::string; using std::vector; @@ -41,20 +43,23 @@ enum TabletState { enum AlterTabletState { NONE, - RUNNING, + ALTERING, FINISHED, FAILED }; -enum AlterTabletType { - SCHEMA_CHANGE = 0, - ROLLUP = 1 -} +class Rowset; +using RowsetSharedPtr = std::shared_ptr; + +class RowsetMeta; +using RowsetMetaSharedPtr = std::shared_ptr; + +class DataDir; class AlterTabletTask { public: - OLAPStatus deserialize_from_pb(const AlterTabletPB& alter_tablet_task); - OLAPStatus to_meta_pb(AlterTabletTaskPB* alter_task); + OLAPStatus init_from_pb(const AlterTabletPB& alter_tablet_task); + OLAPStatus to_alter_pb(AlterTabletPB* alter_task); OLAPStatus clear(); inline int64_t related_tablet_id() { return _related_tablet_id; } @@ -62,15 +67,15 @@ class AlterTabletTask { vector& rowsets_to_alter() { return _rowsets_to_alter; } - AlterTabletState alter_state() { return _alter_state; } - AlterTabletType { return _alter_type; } + const AlterTabletState& alter_state() const { return _alter_state; } + const AlterTabletType& alter_type() const { return _alter_type; } private: int64_t _related_tablet_id; int64_t _related_schema_hash; vector _rowsets_to_alter; AlterTabletState _alter_state; AlterTabletType _alter_type; -} +}; class TabletMeta { public: @@ -85,12 +90,13 @@ class TabletMeta { OLAPStatus save_meta(); OLAPStatus save_meta_unlock(); - OLAPStatus to_meta_pb(TabletMetaPB* tablet_meta_pb); - OLAPStatus to_meta_pb_unlock(TabletMetaPB* tablet_meta_pb); + OLAPStatus to_tablet_pb(TabletMetaPB* tablet_meta_pb); + OLAPStatus to_tablet_pb_unlock(TabletMetaPB* tablet_meta_pb); - Newstatus add_inc_rs_meta(const RowsetMeta& rs_meta); + OLAPStatus add_inc_rs_meta(const RowsetMeta& rs_meta); OLAPStatus delete_inc_rs_meta_by_version(const Version& version); const RowsetMetaSharedPtr get_inc_rs_meta(const Version& version) const; + DeletePredicatePB* add_delete_predicates(); const std::vector& all_inc_rs_metas() const; const std::vector& all_rs_metas() const; @@ -132,35 +138,35 @@ class TabletMeta { std::mutex _mutex; }; -inline const int64_t table_id() const { +inline const int64_t TabletMeta::table_id() const { return _tablet_id; } -inline const int64_t partition_id() const { +inline const int64_t TabletMeta::partition_id() const { return _partition_id; } -inline const int64_t tablet_id() const { +inline const int64_t TabletMeta::tablet_id() const { return _tablet_id; } -inline const int64_t schema_hash() const { +inline const int64_t TabletMeta::schema_hash() const { return _schema_hash; } -inline const int16_t shard_id() { +inline const int16_t TabletMeta::shard_id() { return _shard_id; } -inline const AlterTabletTask& alter_task() const { +inline const AlterTabletTask& TabletMeta::alter_task() const { return _alter_task; } -inline const AlterTabletState& alter_state() const { +inline const AlterTabletState& TabletMeta::alter_state() const { return _alter_task.alter_state(); } -inline const TabletState& tablet_state() const { +inline const TabletState& TabletMeta::tablet_state() const { return _tablet_state; } diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp new file mode 100644 index 00000000000000..73914792c60709 --- /dev/null +++ b/be/src/olap/tablet_schema.cpp @@ -0,0 +1,101 @@ +// 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. + +#ifndef DORIS_BE_SRC_OLAP_TABLET_SCHEMA_H +#define DORIS_BE_SRC_OLAP_TABLET_SCHEMA_H + +#include + +#include "runtime/tablet_schema.h" + +namespace doris { + +OLAPStatus TabletColumnSchema::init_from_pb(const TabletColumnSchema& column) { + _column_id = column.column_id(); + switch (column.type()) { + case TINYINT: + _type = OLAP_FIELD_TYPE_TINYINT; + break; + case SMALLINT: + _type = OLAP_FIELD_TYPE_SMALLINT; + break; + case INT: + _type = OLAP_FIELD_TYPE_INT; + break; + case BIGINT: + _type = OLAP_FIELD_TYPE_BIGINT; + break; + case LARGEINT: + _type = OLAP_FIELD_TYPE_LARGEINT; + break; + case FLOAT: + _type = OLAP_FIELD_TYPE_FLOAT; + break; + case DOUBLE: + _type = OLAP_FIELD_TYPE_DOUBLE; + break; + case DECIMAL: + _type = OLAP_FIELD_TYPE_DECIMAL; + break; + case CHAR: + _type = OLAP_FIELD_TYPE_CHAR; + break; + case VARCHAR: + _type = OLAP_FIELD_TYPE_VARCHAR; + break; + case HLL: + _type = OLAP_FIELD_TYPE_HLL; + break; + case DATE: + _type = OLAP_FIELD_TYPE_DATE; + break; + case DATETIME: + _type = OLAP_FIELD_TYPE_DATETIME; + default: + _type = OLAP_FIELD_TYPE_UNKNOWN; + break; + } + _type_info = get_type_info(type); + _is_key = column.is_key(); + _is_nullable = column.is_nullable(); + _is_bf_column = column.is_bf_column(); +} + +TabletSchema TabletSchema() + : _num_columns(0), + _num_key_columns(0), + _num_null_columns(0), + _num_short_key_columns(0) + +OLAPStatus TabletSchema::init_from_pb(const TabletSchemaPB& schema) { + for (auto& column : schema.columns()) { + TabletColumnSchema column_schema; + column_schema.init_from_pb(column); + _cols.push_back(column_schema); + _num_columns++; + if (column_schema.is_key()) { + _num_key_columns++; + } + if (column_schema.is_nullable()) { + _num_null_columns++; + } + } +} + +} // namespace doris + +#endif // DORIS_BE_SRC_OLAP_SCHEMA_H diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h new file mode 100644 index 00000000000000..118a50c6980055 --- /dev/null +++ b/be/src/olap/tablet_schema.h @@ -0,0 +1,60 @@ +// 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. + +#ifndef DORIS_BE_SRC_OLAP_TABLET_SCHEMA_H +#define DORIS_BE_SRC_OLAP_TABLET_SCHEMA_H + +#include + +#include "gen_cpp/olap_file.pb.h" +#include "olap/types.h" + +namespace doris { + +class TabletColumnSchema { +public: + TabletColumnSchema(); + OLAPStatus init_from_pb(const ColumnPB& column); + + inline int32_t column_id() const { return _column_id; } + inline bool is_key() const { return _is_key; } + inline bool is_nullable() const { return _is_nullable; } + inline bool is_bf_column() const { return _is_bf_column; } +private: + int32_t _column_id; + FieldType _type; + TypeInfo* _type_info; + bool _is_key; + bool _is_nullable; + bool _is_bf_column; +}; + +class TabletSchema { +public: + TabletSchema(); + OLAPStatus init_from_pb(const TabletSchemaPB& schema); + size_t get_row_size() const; +private: + std::vector _cols; + size_t _num_columns; + size_t _num_key_columns; + size_t _num_null_columns; +}; + +} // namespace doris + +#endif // DORIS_BE_SRC_OLAP_SCHEMA_H diff --git a/gensrc/proto/olap_file.proto b/gensrc/proto/olap_file.proto index 1b460055aab923..360cc26a9766b5 100644 --- a/gensrc/proto/olap_file.proto +++ b/gensrc/proto/olap_file.proto @@ -55,7 +55,7 @@ message PDelta { required int64 version_hash = 3; required int64 creation_time = 4; repeated SegmentGroupPB segment_group = 5; - optional DeleteConditionMessage delete_condition = 6; + optional DeletePredicatePB delete_condition = 6; } enum RowsetTypePB { @@ -85,7 +85,7 @@ message RowsetMetaPB { optional int64 index_disk_size = 13; // column min/max/null flag statistic info repeated ColumnPruning column_statistics = 14; - optional DeleteConditionMessage delete_predicate = 15; + optional DeletePredicatePB delete_predicate = 15; optional bool empty = 16; optional string rowset_path = 17; // spare field id for future use @@ -111,7 +111,7 @@ message PPendingDelta { required int64 transaction_id = 2; required int64 creation_time = 3; repeated PendingSegmentGroupPB pending_segment_group = 4; - optional DeleteConditionMessage delete_condition = 5; + optional DeletePredicatePB delete_condition = 5; } message PendingSegmentGroupPB { @@ -144,7 +144,7 @@ enum KeysType { AGG_KEYS = 2; } -message DeleteConditionMessage { +message DeletePredicatePB { required int32 version = 1; repeated string sub_conditions = 2; } @@ -164,7 +164,7 @@ message OLAPHeaderMessage { optional uint32 next_column_unique_id = 10 [default = 0]; optional CompressKind compress_kind = 11 [default = COMPRESS_LZO]; optional uint32 segment_size = 12 [default = 4292870144]; - repeated DeleteConditionMessage delete_data_conditions = 13; + repeated DeletePredicatePB delete_data_conditions = 13; // bloom filter false positive probability optional double bf_fpp = 14; optional KeysType keys_type = 15; @@ -184,9 +184,9 @@ message OLAPHeaderMessage { } enum AlterTabletStatePB { - ALTERING = 0; - FINISHED = 1; - FAILED = 2; + PB_ALTERING = 0; + PB_FINISHED = 1; + PB_FAILED = 2; } enum AlterTabletTypePB { @@ -202,9 +202,25 @@ message AlterTabletPB { optional AlterTabletTypePB alter_type = 5; } +enum ColumnType { + TINYINT = 0; + SMALLINT = 1; + INT = 2; + BIGINT = 3; + LARGEINT = 4; + FLOAT = 5; + DOUBLE = 6; + DECIMAL = 7; + CHAR = 8; + VARCHAR = 9; + HLL = 10; + DATE = 11; + DATETIME = 12; +} + message ColumnPB { required int32 column_id = 1; - required FieldType type = 2; + required ColumnType type = 2; optional bool is_key = 3; optional bool is_nullable = 4; optional bytes default_value = 5; @@ -222,11 +238,11 @@ message TabletSchemaPB { } enum TabletStatePB { - NOTREADY = 0; // under alter table, rollup, clone - RUNNING = 1; - TOMBSTONED = 2; - STOPPED = 3; - SHUTDOWN = 4; + PB_NOTREADY = 0; // under alter table, rollup, clone + PB_RUNNING = 1; + PB_TOMBSTONED = 2; + PB_STOPPED = 3; + PB_SHUTDOWN = 4; } message TabletMetaPB {