You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "snleee (via GitHub)" <gi...@apache.org> on 2024/01/28 08:51:41 UTC

[PR] Wire soft upsert delete for compaction task [pinot]

snleee opened a new pull request, #12330:
URL: https://github.com/apache/pinot/pull/12330

   - Use queryableDocIds if available when doing the upsert compaction
   - Refactored the integration test


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Wire soft upsert delete for compaction task [pinot]

Posted by "snleee (via GitHub)" <gi...@apache.org>.
snleee commented on code in PR #12330:
URL: https://github.com/apache/pinot/pull/12330#discussion_r1468935508


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -500,15 +500,24 @@ public Response downloadValidDocIds(
             String.format("Table %s segment %s is not a immutable segment", tableNameWithType, segmentName),
             Response.Status.BAD_REQUEST);
       }
-      MutableRoaringBitmap validDocIds =
-          indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-      if (validDocIds == null) {
+
+      // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+      // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+      // Otherwise, we read the valid doc ids.
+      MutableRoaringBitmap validDocIdSnapshot = null;

Review Comment:
   changed to `final`



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -500,15 +500,24 @@ public Response downloadValidDocIds(
             String.format("Table %s segment %s is not a immutable segment", tableNameWithType, segmentName),
             Response.Status.BAD_REQUEST);
       }
-      MutableRoaringBitmap validDocIds =
-          indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-      if (validDocIds == null) {
+
+      // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+      // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+      // Otherwise, we read the valid doc ids.
+      MutableRoaringBitmap validDocIdSnapshot = null;
+      if (indexSegment.getQueryableDocIds() != null) {
+        validDocIdSnapshot = indexSegment.getQueryableDocIds().getMutableRoaringBitmap();
+      } else if (indexSegment.getValidDocIds() != null) {
+        validDocIdSnapshot = indexSegment.getValidDocIds().getMutableRoaringBitmap();
+      }
+
+      if (validDocIdSnapshot == null) {

Review Comment:
   good point. I updated the logic πŸ‘ 
   



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Wire soft upsert delete for compaction task [pinot]

Posted by "ege-st (via GitHub)" <gi...@apache.org>.
ege-st commented on code in PR #12330:
URL: https://github.com/apache/pinot/pull/12330#discussion_r1468921167


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -500,15 +500,24 @@ public Response downloadValidDocIds(
             String.format("Table %s segment %s is not a immutable segment", tableNameWithType, segmentName),
             Response.Status.BAD_REQUEST);
       }
-      MutableRoaringBitmap validDocIds =
-          indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-      if (validDocIds == null) {
+
+      // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+      // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+      // Otherwise, we read the valid doc ids.
+      MutableRoaringBitmap validDocIdSnapshot = null;

Review Comment:
   ```suggestion
         final MutableRoaringBitmap validDocIdSnapshot;
   ```
   I believe this must either equal `indexSegment.getQueryableDocIds().getMutableRoaringBitmap()` or `indexSegment.getValidDocIds().getMutableRoaringBitmap()` and if it not assigned one of those then an exception is thrown: so this can be changed to be immutable. 



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -580,17 +589,26 @@ private List<Map<String, Object>> processValidDocIdMetadata(String tableNameWith
           LOGGER.warn(msg);
           continue;
         }
-        MutableRoaringBitmap validDocIds =
-            indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-        if (validDocIds == null) {
+
+        // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+        // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+        // Otherwise, we read the valid doc ids.
+        MutableRoaringBitmap validDocIdSnapshot = null;
+        if (indexSegment.getQueryableDocIds() != null) {
+          validDocIdSnapshot = indexSegment.getQueryableDocIds().getMutableRoaringBitmap();
+        } else if (indexSegment.getValidDocIds() != null) {
+          validDocIdSnapshot = indexSegment.getValidDocIds().getMutableRoaringBitmap();
+        }
+
+        if (validDocIdSnapshot == null) {

Review Comment:
   ```suggestion
           } else {
   ```
   Same as above, this logic is that `validDocIdSnapshot` must be assigned one of the two values and if both are null than an exception is thrown.  I think this structure makes the logic more explicit.



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -500,15 +500,24 @@ public Response downloadValidDocIds(
             String.format("Table %s segment %s is not a immutable segment", tableNameWithType, segmentName),
             Response.Status.BAD_REQUEST);
       }
-      MutableRoaringBitmap validDocIds =
-          indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-      if (validDocIds == null) {
+
+      // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+      // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+      // Otherwise, we read the valid doc ids.
+      MutableRoaringBitmap validDocIdSnapshot = null;
+      if (indexSegment.getQueryableDocIds() != null) {
+        validDocIdSnapshot = indexSegment.getQueryableDocIds().getMutableRoaringBitmap();
+      } else if (indexSegment.getValidDocIds() != null) {
+        validDocIdSnapshot = indexSegment.getValidDocIds().getMutableRoaringBitmap();
+      }
+
+      if (validDocIdSnapshot == null) {

Review Comment:
   ```suggestion
         } else {
   ```
   I think this is equivalent and helps communicate that index.getQueryableDocIds or index.getValidDocIds must be not null.



##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/upsertcompaction/UpsertCompactionTaskGenerator.java:
##########
@@ -97,7 +99,14 @@ public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
         continue;
       }
 
-      // TODO: add a check to see if the task is already running for the table
+      // Only schedule 1 task of this type, per table
+      Map<String, TaskState> incompleteTasks =
+          TaskGeneratorUtils.getIncompleteTasks(taskType, tableNameWithType, _clusterInfoAccessor);
+      if (!incompleteTasks.isEmpty()) {
+        LOGGER.warn("Found incomplete tasks: {} for same table: {}. Skipping task generation.",

Review Comment:
   I haven't debugging Minion much, but I think it'd be helpful to include the task type in the warning message.



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -580,17 +589,26 @@ private List<Map<String, Object>> processValidDocIdMetadata(String tableNameWith
           LOGGER.warn(msg);
           continue;
         }
-        MutableRoaringBitmap validDocIds =
-            indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-        if (validDocIds == null) {
+
+        // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+        // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+        // Otherwise, we read the valid doc ids.
+        MutableRoaringBitmap validDocIdSnapshot = null;

Review Comment:
   ```suggestion
           final MutableRoaringBitmap validDocIdSnapshot;
   ```
   Same suggestion as above.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Wire soft upsert delete for compaction task [pinot]

Posted by "snleee (via GitHub)" <gi...@apache.org>.
snleee merged PR #12330:
URL: https://github.com/apache/pinot/pull/12330


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Wire soft upsert delete for compaction task [pinot]

Posted by "snleee (via GitHub)" <gi...@apache.org>.
snleee commented on code in PR #12330:
URL: https://github.com/apache/pinot/pull/12330#discussion_r1468935569


##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -580,17 +589,26 @@ private List<Map<String, Object>> processValidDocIdMetadata(String tableNameWith
           LOGGER.warn(msg);
           continue;
         }
-        MutableRoaringBitmap validDocIds =
-            indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-        if (validDocIds == null) {
+
+        // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+        // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+        // Otherwise, we read the valid doc ids.
+        MutableRoaringBitmap validDocIdSnapshot = null;
+        if (indexSegment.getQueryableDocIds() != null) {
+          validDocIdSnapshot = indexSegment.getQueryableDocIds().getMutableRoaringBitmap();
+        } else if (indexSegment.getValidDocIds() != null) {
+          validDocIdSnapshot = indexSegment.getValidDocIds().getMutableRoaringBitmap();
+        }
+
+        if (validDocIdSnapshot == null) {

Review Comment:
   fixed



##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -580,17 +589,26 @@ private List<Map<String, Object>> processValidDocIdMetadata(String tableNameWith
           LOGGER.warn(msg);
           continue;
         }
-        MutableRoaringBitmap validDocIds =
-            indexSegment.getValidDocIds() != null ? indexSegment.getValidDocIds().getMutableRoaringBitmap() : null;
-        if (validDocIds == null) {
+
+        // Adopt the same logic as the query execution to get the valid doc ids. 'FilterPlanNode.run()'
+        // If the queryableDocId is available (upsert delete is enabled), we read the valid doc ids from it.
+        // Otherwise, we read the valid doc ids.
+        MutableRoaringBitmap validDocIdSnapshot = null;

Review Comment:
   fixed



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Wire soft upsert delete for compaction task [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #12330:
URL: https://github.com/apache/pinot/pull/12330#issuecomment-1913552005

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: `14 lines` in your changes are missing coverage. Please review.
   > Comparison is base [(`ed6761a`)](https://app.codecov.io/gh/apache/pinot/commit/ed6761a982d4666c68b8fcda598a84571446c2ea?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 61.65% compared to head [(`32dc020`)](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 61.63%.
   
   | [Files](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...che/pinot/server/api/resources/TablesResource.java](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zZXJ2ZXIvYXBpL3Jlc291cmNlcy9UYWJsZXNSZXNvdXJjZS5qYXZh) | 42.85% | [2 Missing and 6 partials :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...psertcompaction/UpsertCompactionTaskGenerator.java](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3QtcGx1Z2lucy9waW5vdC1taW5pb24tdGFza3MvcGlub3QtbWluaW9uLWJ1aWx0aW4tdGFza3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3Bpbm90L3BsdWdpbi9taW5pb24vdGFza3MvdXBzZXJ0Y29tcGFjdGlvbi9VcHNlcnRDb21wYWN0aW9uVGFza0dlbmVyYXRvci5qYXZh) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #12330      +/-   ##
   ============================================
   - Coverage     61.65%   61.63%   -0.02%     
   + Complexity     1146      207     -939     
   ============================================
     Files          2421     2421              
     Lines        131842   131856      +14     
     Branches      20344    20347       +3     
   ============================================
   - Hits          81289    81274      -15     
   - Misses        44594    44618      +24     
   - Partials       5959     5964       +5     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ” | |
   |---|---|---|
   | [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (ΓΈ)` | |
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (ΓΈ)` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `<0.01% <0.00%> (ΓΈ)` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <0.00%> (ΓΈ)` | |
   | [java-11](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.87% <0.00%> (-26.74%)` | :arrow_down: |
   | [java-21](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.50% <30.00%> (-0.04%)` | :arrow_down: |
   | [skip-bytebuffers-false](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.60% <30.00%> (-0.04%)` | :arrow_down: |
   | [skip-bytebuffers-true](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `34.76% <0.00%> (-26.75%)` | :arrow_down: |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.63% <30.00%> (-0.02%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `61.63% <30.00%> (-0.02%)` | :arrow_down: |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `46.76% <ΓΈ> (-0.02%)` | :arrow_down: |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/12330/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.72% <30.00%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/12330?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


Re: [PR] Wire soft upsert delete for compaction task [pinot]

Posted by "snleee (via GitHub)" <gi...@apache.org>.
snleee commented on code in PR #12330:
URL: https://github.com/apache/pinot/pull/12330#discussion_r1468935789


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/upsertcompaction/UpsertCompactionTaskGenerator.java:
##########
@@ -97,7 +99,14 @@ public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
         continue;
       }
 
-      // TODO: add a check to see if the task is already running for the table
+      // Only schedule 1 task of this type, per table
+      Map<String, TaskState> incompleteTasks =
+          TaskGeneratorUtils.getIncompleteTasks(taskType, tableNameWithType, _clusterInfoAccessor);
+      if (!incompleteTasks.isEmpty()) {
+        LOGGER.warn("Found incomplete tasks: {} for same table: {}. Skipping task generation.",

Review Comment:
   +1. added the task type to the log



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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