You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/07/07 10:07:00 UTC

[GitHub] [incubator-doris] xy720 commented on a change in pull request #4039: Add delayed deletion of rowsets function, fix -230 error.

xy720 commented on a change in pull request #4039:
URL: https://github.com/apache/incubator-doris/pull/4039#discussion_r450727522



##########
File path: be/src/olap/rowset_graph.h
##########
@@ -47,6 +50,86 @@ class RowsetGraph {
     std::unordered_map<int64_t, int64_t> _vertex_index_map;
 };
 
-}  // namespace doris
+class VersionTracker {
+public:
+    VersionTracker(Version version, int64_t create_time)
+            : _version(version.first, version.second), _create_time(create_time) {}
+
+    ~VersionTracker() {}
+
+    Version version() const { return _version; }
+
+    int64_t get_create_time() { return _create_time; }
+
+    bool operator!=(const VersionTracker& rhs) const {
+        return _version.first != rhs._version.first || _version.second != rhs._version.second;
+    }
+
+    bool operator==(const VersionTracker& rhs) const {
+        return _version.first == rhs._version.first && _version.second == rhs._version.second;
+    }
+
+    bool contains(const VersionTracker& other) const {
+        return _version.first <= other._version.first && _version.second >= other._version.second;
+    }
+
+private:
+    Version _version;
+    int64_t _create_time;
+};
+
+using VersionTrackerSharedPtr = std::shared_ptr<VersionTracker>;
+using PathVersionListSharedPtr = std::shared_ptr<std::vector<VersionTrackerSharedPtr>>;
+
+class VersionedRowsetTracker {
+public:
+    // Construct rowsets version tracker with expired snapshot rowsets
+    void construct_versioned_tracker(
+            const std::vector<RowsetMetaSharedPtr>& rs_metas,
+            const std::vector<RowsetMetaSharedPtr>& expired_snapshot_rs_metas);
+
+    // Reconstruct rowsets version tracker with expired snapshot rowsets
+    void reconstruct_versioned_tracker(
+            const std::vector<RowsetMetaSharedPtr>& rs_metas,
+            const std::vector<RowsetMetaSharedPtr>& expired_snapshot_rs_metas);
+
+    // Add a version
+    void add_version(const Version& version);
+
+    // Add a version path with expired_snapshot_rs_metas
+    void add_expired_path_version(
+            const std::vector<RowsetMetaSharedPtr>& expired_snapshot_rs_metas);
+
+    // Capture consistent versions from graph
+    OLAPStatus capture_consistent_versions(const Version& spec_version,
+                                           std::vector<Version>* version_path) const;
+
+    // Capture all expired path version.
+    // When the last rowset createtime of a path greater than expired time  which can be expressed
+    // "now() - tablet_rowset_expired_snapshot_sweep_time" , this path will be remained.
+    // Otherwise, this path will be added to versions.
+    void capture_expired_path_version(int64_t expired_snapshot_sweep_endtime,
+                                      std::vector<int64_t>* path_version) const;
+
+    void fetch_path_version(int64_t path_version, std::vector<Version>& version_path);
+
+    void fetch_and_delete_path_version(int64_t path_version, std::vector<Version>& version_path);
+
+    void _print_current_state();
+
+private:
+    // construct rowsets version tracker with expired snapshot rowsets
+    void _construct_versioned_tracker(
+            const std::vector<RowsetMetaSharedPtr>& rs_metas,
+            const std::vector<RowsetMetaSharedPtr>& expired_snapshot_rs_metas);
+
+private:
+    int64_t next_path_version = 1;

Review comment:
       _next_path_version




----------------------------------------------------------------
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:
users@infra.apache.org



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