kangpinghuang commented on a change in pull request #643: Import TabletState
and remove mutex in TabletMeta
URL: https://github.com/apache/incubator-doris/pull/643#discussion_r258308369
##########
File path: be/src/olap/tablet.h
##########
@@ -27,221 +27,211 @@
#include "gen_cpp/AgentService_types.h"
#include "gen_cpp/olap_file.pb.h"
-#include "olap/field.h"
#include "olap/olap_define.h"
-#include "olap/tablet_meta.h"
#include "olap/tuple.h"
#include "olap/row_cursor.h"
#include "olap/rowset_graph.h"
-#include "olap/utils.h"
+#include "olap/rowset/rowset.h"
#include "olap/rowset/rowset_reader.h"
+#include "olap/tablet_meta.h"
+#include "olap/utils.h"
+#include "util/once.h"
+
+using std::pair;
+using std::nothrow;
+using std::sort;
+using std::string;
+using std::vector;
namespace doris {
-class TabletMeta;
-class Rowset;
-class Tablet;
-class RowBlockPosition;
+
class DataDir;
-class RowsetReader;
-class ColumnData;
-class SegmentGroup;
+class Tablet;
+class TabletMeta;
using TabletSharedPtr = std::shared_ptr<Tablet>;
class Tablet : public std::enable_shared_from_this<Tablet> {
public:
- static TabletSharedPtr create_from_tablet_meta_file(
+ static TabletSharedPtr create_tablet_from_meta_file(
const std::string& header_file,
DataDir* data_dir = nullptr);
- static TabletSharedPtr create_from_tablet_meta(
+ static TabletSharedPtr create_tablet_from_meta(
TabletMeta* meta,
DataDir* data_dir = nullptr);
Tablet(TabletMeta* tablet_meta, DataDir* data_dir);
~Tablet();
- OLAPStatus load();
- OLAPStatus load_rowsets();
- inline bool is_loaded();
- OLAPStatus save_tablet_meta();
+ OLAPStatus init_once();
+ OLAPStatus init();
+ inline bool init_success();
- bool has_expired_incremental_rowset();
- void delete_expired_incremental_rowset();
- OLAPStatus revise_tablet_meta(const TabletMeta& tablet_meta,
- const std::vector<RowsetMetaSharedPtr>&
rowsets_to_clone,
- const std::vector<Version>&
versions_to_delete);
- OLAPStatus compute_all_versions_hash(const std::vector<Version>& versions,
- VersionHash* version_hash) const;
- OLAPStatus merge_tablet_meta(const TabletMeta& hdr, int to_version);
- bool has_version(const Version& version) const;
- void list_versions(std::vector<Version>* versions) const;
- void mark_dropped() { _is_dropped = true; }
- bool is_dropped() { return _is_dropped; }
- void delete_all_files();
- void obtain_header_rdlock() { _meta_lock.rdlock(); }
- void obtain_header_wrlock() { _meta_lock.wrlock(); }
- void release_header_lock() { _meta_lock.unlock(); }
- RWMutex* get_header_lock_ptr() { return &_meta_lock; }
- void obtain_push_lock() { _ingest_lock.lock(); }
- void release_push_lock() { _ingest_lock.unlock(); }
- Mutex* get_push_lock() { return &_ingest_lock; }
- bool try_base_compaction_lock() { return _base_lock.trylock() ==
OLAP_SUCCESS; }
- void obtain_base_compaction_lock() { _base_lock.lock(); }
- void release_base_compaction_lock() { _base_lock.unlock(); }
- bool try_cumulative_lock() { return (OLAP_SUCCESS ==
_cumulative_lock.trylock()); }
- void obtain_cumulative_lock() { _cumulative_lock.lock(); }
- void release_cumulative_lock() { _cumulative_lock.unlock(); }
- std::string construct_dir_path() const;
- int version_count() const;
- const uint32_t calc_cumulative_compaction_score() const;
- const uint32_t calc_base_compaction_score() const;
- inline KeysType keys_type() const;
- bool version_for_delete_predicate(const Version& version);
- bool version_for_load_deletion(const Version& version);
- inline const int64_t creation_time() const;
- void set_creation_time(int64_t creation_time);
- inline const int32_t cumulative_layer_point() const;
- inline void set_cumulative_layer_point(const int32_t new_point);
- AlterTabletState alter_state();
- OLAPStatus set_alter_state(AlterTabletState state);
- bool is_schema_changing();
- OLAPStatus delete_alter_task();
- OLAPStatus protected_delete_alter_task();
- void add_alter_task(int64_t tablet_id, int64_t schema_hash,
- const vector<Version>& versions_to_alter,
- const AlterTabletType alter_type);
- const AlterTabletTask& alter_task();
bool is_used();
- std::string storage_root_path_name() const;
- std::string tablet_path() const;
- OLAPStatus test_version(const Version& version);
- size_t get_version_data_size(const Version& version);
- OLAPStatus recover_tablet_until_specfic_version(const int64_t&
spec_version,
- const int64_t&
version_hash);
- const std::string& rowset_path_prefix();
- const size_t id() { return _id; }
- void set_id(size_t id) { _id = id; }
+ inline DataDir* data_dir() const;
OLAPStatus register_tablet_into_dir();
+ std::string dir_path() const;
Review comment:
I think dir_path is not a good name? data_dir_path?
----------------------------------------------------------------
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]