yujun777 commented on code in PR #49771:
URL: https://github.com/apache/doris/pull/49771#discussion_r2265855103


##########
be/src/olap/tablet.cpp:
##########
@@ -1296,8 +1296,8 @@ std::vector<RowsetSharedPtr> 
Tablet::_pick_visible_rowsets_to_compaction(
             // 1. had been visible;
             // 2. exceeds the limit of keep invisible versions.
             int64_t version_end = version.second;
-            if (version_end <= visible_version ||
-                version_end > visible_version + keep_invisible_version_limit) {
+            if (version_end <= visible_version || ((candidate_rowsets.empty() 
|| candidate_rowsets.front()->version().second > visible_version) 

Review Comment:
   suppose max version = 1000,  visible version = 100,   
keep_invisible_version_limit = 20,  then all the versions can split into 3 
parts:
   A. 1 ~ 100  (1 to visible version);
   B. 101 ~ 120 (visible version  + 1 to visible_version + 
keep_visible_version_limit);
   C.  121 ~ 1000;
   
   will chose part A,  part C to compact,  but not chose part B to compact (if 
compact cross visible version,  sql query will throw error E-230 version had 
been compact ) ;
   
   so we need to compact part A + part C,   but the problem is,  for base 
compaction, need the candidate rowsets continous (but not require from version 
1 ),  so if the candidate rowset is all part A or all part C is ok,  but if 
include them both will fail.
   
   here is the fix:
   use two candidate_rowset  vectors:
   one is to hold  part A:  version.second >= visible version, 
   the other is to hold part C:  version.first(notice this change to 
version.first) > visible_version + keep_invisible_version_limit
   
   if vector size of part A >1, then return part A;
   else return part C;



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