You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2020/07/13 12:54:00 UTC

[incubator-doris] branch master updated: [Bug] Support get all rowset meta info in memory from tablet meta url (#4061)

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 2e460f5  [Bug] Support get all rowset meta info in memory from tablet meta url (#4061)
2e460f5 is described below

commit 2e460f581cc67dc32a6565eb869e9712807d7d24
Author: caiconghui <55...@users.noreply.github.com>
AuthorDate: Mon Jul 13 07:53:51 2020 -0500

    [Bug] Support get all rowset meta info in memory from tablet meta url (#4061)
    
    This PR is to fix bug that we cannot get the newest tablet meta info from tablet meta url.
---
 be/src/http/action/meta_action.cpp | 12 +++++-------
 be/src/olap/tablet.cpp             | 12 +++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/be/src/http/action/meta_action.cpp b/be/src/http/action/meta_action.cpp
index 2fad2a9..3db8316 100644
--- a/be/src/http/action/meta_action.cpp
+++ b/be/src/http/action/meta_action.cpp
@@ -60,13 +60,11 @@ Status MetaAction::_handle_header(HttpRequest* req, std::string* json_meta) {
         LOG(WARNING) << "no tablet for tablet_id:" << tablet_id << " schema hash:" << schema_hash;
         return Status::InternalError("no tablet exist");
     }
-    OLAPStatus s =
-            TabletMetaManager::get_json_meta(tablet->data_dir(), tablet_id, schema_hash, json_meta);
-    if (s == OLAP_ERR_META_KEY_NOT_FOUND) {
-        return Status::InternalError("no header exist");
-    } else if (s != OLAP_SUCCESS) {
-        return Status::InternalError("backend error");
-    }
+    TabletMetaSharedPtr tablet_meta(new TabletMeta());
+    tablet->generate_tablet_meta_copy(tablet_meta);
+    json2pb::Pb2JsonOptions json_options;
+    json_options.pretty_json = true;
+    tablet_meta->to_json(json_meta, json_options);
     return Status::OK();
 }
 
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 8075714..ea88b5d 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -991,11 +991,7 @@ bool Tablet::rowset_meta_is_useful(RowsetMetaSharedPtr rowset_meta) {
             find_version = true;
         }
     }
-    if (find_rowset_id || !find_version) {
-        return true;
-    } else {
-        return false;
-    }
+    return find_rowset_id || !find_version;
 }
 
 bool Tablet::_contains_rowset(const RowsetId rowset_id) {
@@ -1050,10 +1046,12 @@ void Tablet::build_tablet_report_info(TTabletInfo* tablet_info) {
 // should use this method to get a copy of current tablet meta
 // there are some rowset meta in local meta store and in in-memory tablet meta
 // but not in tablet meta in local meta store
-// TODO(lingbin): do we need _meta_lock?
 void Tablet::generate_tablet_meta_copy(TabletMetaSharedPtr new_tablet_meta) const {
     TabletMetaPB tablet_meta_pb;
-    _tablet_meta->to_meta_pb(&tablet_meta_pb);
+    {
+        ReadLock rdlock(&_meta_lock);
+        _tablet_meta->to_meta_pb(&tablet_meta_pb);
+    }
     new_tablet_meta->init_from_pb(tablet_meta_pb);
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org