Gabriel39 commented on code in PR #9804:
URL: https://github.com/apache/incubator-doris/pull/9804#discussion_r883325715


##########
be/src/olap/delta_writer.cpp:
##########
@@ -98,6 +100,8 @@ Status DeltaWriter::init() {
             MemTracker::create_tracker(-1, "DeltaWriter:" + 
std::to_string(_tablet->tablet_id()));
     // check tablet version number
     if (_tablet->version_count() > config::max_tablet_version_num) {
+        //trigger samll compaction
+        StorageEngine::instance()->submit_samll_compaction_task(_tablet);

Review Comment:
   should we check whether to pass this check after small compaction?



##########
be/src/olap/tablet.cpp:
##########
@@ -839,10 +839,53 @@ void Tablet::calculate_cumulative_point() {
     if (ret_cumulative_point == K_INVALID_CUMULATIVE_POINT) {
         return;
     }
-
     set_cumulative_layer_point(ret_cumulative_point);
 }
 
+//1.小版本rowset
+//2.不改变cp,cp值的更新有cc任务来执行
+//3.找到最大的,连续小版本rowset
+Status Tablet::pick_samll_verson_rowsets(std::vector<RowsetSharedPtr>* 
input_rowsets) {
+    int max_series_num = 1000;
+    int max_rows = config::small_version_max_rows;
+    if (max_rows <= 0) return Status::OK();
+    std::vector<std::vector<RowsetSharedPtr>> 
samll_version_rowsets(max_series_num);
+    int idx = 0;
+    bool is_bad = false;
+    if (tablet_state() == TABLET_RUNNING) {
+        for (auto& rs : _rs_version_map) {
+            bool is_delete = version_for_delete_predicate(rs.first);
+            if (rs.first.first > cumulative_layer_point()) {
+                // find samll rowset
+                if (!is_delete && rs.first.first > 0) {
+                    if (rs.second->num_rows() < max_rows) {
+                        samll_version_rowsets[idx].push_back(rs.second);
+                    } else {
+                        idx++;
+                        if (idx > max_series_num) {
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        int max_idx = samll_version_rowsets.size() > 0 ? 0 : -1;
+        std::vector<RowsetSharedPtr> result;
+        if (is_bad) Status::OK();
+        for (int i = 0; i < samll_version_rowsets.size(); i++) {
+            if (samll_version_rowsets[i].size() > 
samll_version_rowsets[max_idx].size()) {
+                max_idx = i;
+            }
+            result = samll_version_rowsets[max_idx];

Review Comment:
   seems you should move this line into the above `if` code block



##########
be/src/olap/tablet.cpp:
##########
@@ -839,10 +839,53 @@ void Tablet::calculate_cumulative_point() {
     if (ret_cumulative_point == K_INVALID_CUMULATIVE_POINT) {
         return;
     }
-
     set_cumulative_layer_point(ret_cumulative_point);
 }
 
+//1.小版本rowset
+//2.不改变cp,cp值的更新有cc任务来执行
+//3.找到最大的,连续小版本rowset
+Status Tablet::pick_samll_verson_rowsets(std::vector<RowsetSharedPtr>* 
input_rowsets) {
+    int max_series_num = 1000;
+    int max_rows = config::small_version_max_rows;
+    if (max_rows <= 0) return Status::OK();
+    std::vector<std::vector<RowsetSharedPtr>> 
samll_version_rowsets(max_series_num);
+    int idx = 0;
+    bool is_bad = false;
+    if (tablet_state() == TABLET_RUNNING) {
+        for (auto& rs : _rs_version_map) {
+            bool is_delete = version_for_delete_predicate(rs.first);
+            if (rs.first.first > cumulative_layer_point()) {
+                // find samll rowset
+                if (!is_delete && rs.first.first > 0) {
+                    if (rs.second->num_rows() < max_rows) {
+                        samll_version_rowsets[idx].push_back(rs.second);
+                    } else {
+                        idx++;
+                        if (idx > max_series_num) {
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        int max_idx = samll_version_rowsets.size() > 0 ? 0 : -1;

Review Comment:
   Just set `max_idx` to 0



##########
be/src/agent/task_worker_pool.cpp:
##########
@@ -717,7 +719,18 @@ void 
TaskWorkerPool::_publish_version_worker_thread_callback() {
                          << ", error_code=" << res;
             finish_task_request.__set_error_tablet_ids(error_tablet_ids);
         } else {
-            LOG(INFO) << "publish_version success. signature:" << 
agent_task_req.signature;
+            for (int i = 0; i < succ_tablet_ids.size(); i++) {
+                TabletSharedPtr tablet =
+                        
StorageEngine::instance()->tablet_manager()->get_tablet(succ_tablet_ids[i]);
+                if (tablet != nullptr) {

Review Comment:
   should we always do small compaction after PublishVersionTask?



##########
be/src/olap/tablet.cpp:
##########
@@ -839,10 +839,53 @@ void Tablet::calculate_cumulative_point() {
     if (ret_cumulative_point == K_INVALID_CUMULATIVE_POINT) {
         return;
     }
-
     set_cumulative_layer_point(ret_cumulative_point);
 }
 
+//1.小版本rowset
+//2.不改变cp,cp值的更新有cc任务来执行
+//3.找到最大的,连续小版本rowset
+Status Tablet::pick_samll_verson_rowsets(std::vector<RowsetSharedPtr>* 
input_rowsets) {
+    int max_series_num = 1000;
+    int max_rows = config::small_version_max_rows;
+    if (max_rows <= 0) return Status::OK();
+    std::vector<std::vector<RowsetSharedPtr>> 
samll_version_rowsets(max_series_num);
+    int idx = 0;
+    bool is_bad = false;

Review Comment:
   Unused variable?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to