chaoyli commented on a change in pull request #437: Move tablet management code 
from StorageEngine to TabletManager
URL: https://github.com/apache/incubator-doris/pull/437#discussion_r242041166
 
 

 ##########
 File path: be/src/olap/tablet_manager.h
 ##########
 @@ -0,0 +1,199 @@
+// 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_MANAGER_H
+#define DORIS_BE_SRC_OLAP_TABLET_MANAGER_H
+
+#include <ctime>
+#include <list>
+#include <map>
+#include <mutex>
+#include <condition_variable>
+#include <set>
+#include <string>
+#include <vector>
+#include <thread>
+
+#include <rapidjson/document.h>
+#include <pthread.h>
+
+#include "agent/status.h"
+#include "common/status.h"
+#include "gen_cpp/AgentService_types.h"
+#include "gen_cpp/BackendService_types.h"
+#include "gen_cpp/MasterService_types.h"
+#include "olap/atomic.h"
+#include "olap/lru_cache.h"
+#include "olap/olap_common.h"
+#include "olap/olap_define.h"
+#include "olap/tablet.h"
+#include "olap/olap_meta.h"
+#include "olap/options.h"
+
+namespace doris {
+
+class Tablet;
+class OlapStore;
+
+// TabletManager provides get,add, delete tablet method for storage engine
+class TabletManager {
+public:
+    TabletManager();
+    ~TabletManager() {
+        _tablet_map.clear();
+        _global_tablet_id = 0;
+    }
+
+    // Add a tablet pointer to StorageEngine
+    // If force, drop the existing tablet add this new one
+    //
+    // Return OLAP_SUCCESS, if run ok
+    //        OLAP_ERR_TABLE_INSERT_DUPLICATION_ERROR, if find duplication
+    //        OLAP_ERR_NOT_INITED, if not inited
+    OLAPStatus add_tablet(TTabletId tablet_id, SchemaHash schema_hash,
+                         const TabletSharedPtr& tablet, bool force = false);
+
+    void cancel_unfinished_schema_change();
+
+    bool check_tablet_id_exist(TTabletId tablet_id);
+
+    void clear();
+    
+    // Add empty data for Tablet
+    //
+    // Return OLAP_SUCCESS, if run ok
+    OLAPStatus create_init_version(
+            TTabletId tablet_id, SchemaHash schema_hash,
+            Version version, VersionHash version_hash);
+
+    OLAPStatus create_tablet(const TCreateTabletReq& request, 
+                             std::vector<OlapStore*> stores);
+
+    // Create new tablet for StorageEngine
+    //
+    // Return Tablet *  succeeded; Otherwise, return NULL if failed
+    TabletSharedPtr create_tablet(const TCreateTabletReq& request,
 
 Review comment:
   OLAPStatus is used to indicate status like disk error, and so on. So return 
a TabletSharedPtr may can not include this error.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to