kangpinghuang commented on a change in pull request #1200: Merge refactor code
into master
URL: https://github.com/apache/incubator-doris/pull/1200#discussion_r288475002
##########
File path: be/src/olap/data_dir.h
##########
@@ -21,70 +21,97 @@
#include <set>
#include <string>
#include <mutex>
+#include <condition_variable>
#include "common/status.h"
#include "gen_cpp/Types_types.h"
#include "olap/olap_common.h"
-#include "olap/olap_engine.h"
+#include "olap/storage_engine.h"
+#include "olap/rowset/rowset_id_generator.h"
namespace doris {
-class OLAPRootPath;
-class OLAPEngine;
-
-// A OlapStore used to manange data in same path.
-// Now, After OlapStore was created, it will never be deleted for easy
implementation.
-class OlapStore {
+// A DataDir used to manange data in same path.
+// Now, After DataDir was created, it will never be deleted for easy
implementation.
+class DataDir {
public:
- OlapStore(const std::string& path, int64_t capacity_bytes = -1);
- ~OlapStore();
+ DataDir(const std::string& path,
+ int64_t capacity_bytes = -1,
+ TabletManager* tablet_manager = nullptr,
+ TxnManager* txn_manager = nullptr);
+ ~DataDir();
- Status load();
+ Status init();
const std::string& path() const { return _path; }
- const int64_t path_hash() const { return _path_hash; }
+ const size_t path_hash() const { return _path_hash; }
bool is_used() const { return _is_used; }
void set_is_used(bool is_used) { _is_used = is_used; }
int32_t cluster_id() const { return _cluster_id; }
- RootPathInfo to_root_path_info() {
- RootPathInfo info;
+ DataDirInfo get_dir_info() {
+ DataDirInfo info;
info.path = _path;
info.path_hash = _path_hash;
info.is_used = _is_used;
info.capacity = _capacity_bytes;
return info;
}
+ // save a cluster_id file under data path to prevent
+ // invalid be config for example two be use the same
+ // data path
Status set_cluster_id(int32_t cluster_id);
void health_check();
OLAPStatus get_shard(uint64_t* shard);
- OlapMeta* get_meta();
+
+ OlapMeta* get_meta() { return _meta; }
bool is_ssd_disk() const {
return _storage_medium == TStorageMedium::SSD;
}
+
TStorageMedium::type storage_medium() const { return _storage_medium; }
- OLAPStatus register_table(OLAPTable* table);
- OLAPStatus deregister_table(OLAPTable* table);
+ OLAPStatus register_tablet(Tablet* tablet);
+ OLAPStatus deregister_tablet(Tablet* tablet);
+ void clear_tablets(std::vector<TabletInfo>* tablet_infos);
+
+ std::string get_absolute_tablet_path(TabletMeta* tablet_meta, bool
with_schema_hash);
- std::string get_tablet_schema_hash_path_from_header(OLAPHeader* header);
+ std::string get_absolute_tablet_path(OLAPHeaderMessage& olap_header_msg,
bool with_schema_hash);
- std::string get_tablet_path_from_header(OLAPHeader* header);
+ std::string get_absolute_tablet_path(TabletMetaPB* tablet_meta, bool
with_schema_hash);
- std::string get_shard_path_from_header(const std::string& shard_string);
+ std::string get_absolute_shard_path(const std::string& shard_string);
void find_tablet_in_trash(int64_t tablet_id, std::vector<std::string>*
paths);
static std::string get_root_path_from_schema_hash_path_in_trash(const
std::string& schema_hash_dir_in_trash);
+/*
+ OLAPStatus next_id(RowsetId* id) {
+ return _id_generator->get_next_id(id);
+ }
+
+ OLAPStatus set_next_id(RowsetId new_rowset_id) {
+ return _id_generator->set_next_id(new_rowset_id);
+ }
+*/
Review comment:
delete these codes?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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]