You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "LinMingQiang (via GitHub)" <gi...@apache.org> on 2024/11/26 01:59:11 UTC

[PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

LinMingQiang opened a new pull request, #4589:
URL: https://github.com/apache/paimon/pull/4589

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #xxx
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on code in PR #4589:
URL: https://github.com/apache/paimon/pull/4589#discussion_r1857698050


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/MultiTablesStoreCompactOperator.java:
##########
@@ -165,7 +168,8 @@ public void processElement(StreamRecord<RowData> element) throws Exception {
                     files.isEmpty(),
                     "Batch compact job does not concern what files are compacted. "
                             + "They only need to know what buckets are compacted.");
-            write.compact(partition, bucket, true);
+            // `minor` compact strategy is supported in batch mode.

Review Comment:
   Yeah, this reminder should be placed above.  `full compact is not supported in streaming mode.`



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang closed pull request #4589: [flink] Support minor compact strategy for dedicated compaction action.
URL: https://github.com/apache/paimon/pull/4589


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #4589:
URL: https://github.com/apache/paimon/pull/4589#discussion_r1859779954


##########
paimon-flink/paimon-flink-1.18/src/main/java/org/apache/paimon/flink/procedure/CompactProcedure.java:
##########
@@ -125,6 +129,7 @@ public String[] call(
             ProcedureContext procedureContext,
             String tableId,
             String partitions,
+            String compactStrategy,

Review Comment:
   It is better to keep compatibility?



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on code in PR #4589:
URL: https://github.com/apache/paimon/pull/4589#discussion_r1857724625


##########
docs/content/maintenance/dedicated-compaction.md:
##########
@@ -107,6 +107,7 @@ Run the following command to submit a compaction job for the table.
     --database <database-name> \ 
     --table <table-name> \
     [--partition <partition-name>] \
+    [--compact_strategy <minor / full>] \

Review Comment:
   Essentially there are only two strategies `full` or `minor`, so using `compact_strategy ` is more suitable for this scenario.



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on PR #4589:
URL: https://github.com/apache/paimon/pull/4589#issuecomment-2499776397

   > Can you also modify Flink & Spark procedures?
   
   I plan to complete this in another PR.


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "wwj6591812 (via GitHub)" <gi...@apache.org>.
wwj6591812 commented on code in PR #4589:
URL: https://github.com/apache/paimon/pull/4589#discussion_r1857687881


##########
docs/content/maintenance/dedicated-compaction.md:
##########
@@ -107,6 +107,7 @@ Run the following command to submit a compaction job for the table.
     --database <database-name> \ 
     --table <table-name> \
     [--partition <partition-name>] \
+    [--compact_strategy <minor / full>] \

Review Comment:
   Now in paimon, there are already three compact_strategy, FullCompaction, UniversalCompaction, ForceUpLevel0Compaction.
   I think here we change compact_strategy to compact_type may better.?



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/sink/MultiTablesStoreCompactOperator.java:
##########
@@ -165,7 +168,8 @@ public void processElement(StreamRecord<RowData> element) throws Exception {
                     files.isEmpty(),
                     "Batch compact job does not concern what files are compacted. "
                             + "They only need to know what buckets are compacted.");
-            write.compact(partition, bucket, true);
+            // `minor` compact strategy is supported in batch mode.

Review Comment:
   `minor` and `full` compact type are both supported in batch mode.



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/CompactAction.java:
##########
@@ -59,6 +59,8 @@ public class CompactAction extends TableActionBase {
 
     @Nullable private Duration partitionIdleTime = null;
 
+    private Boolean fullCompaction;

Review Comment:
   Why not define a enum of CompactionType?



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/CompactActionFactory.java:
##########
@@ -76,6 +76,10 @@ public Optional<Action> create(MultipleParameterToolAdapter params) {
                 action.withPartitionIdleTime(
                         TimeUtils.parseDuration(params.get(PARTITION_IDLE_TIME)));
             }
+            String compactStrategy = params.get(COMPACT_STRATEGY);
+            if (compactStrategy != null) {

Review Comment:
   compact_type?



##########
paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/CompactActionITCaseBase.java:
##########
@@ -37,6 +42,12 @@
 /** Base IT cases for {@link CompactAction} and {@link CompactDatabaseAction} . */
 public class CompactActionITCaseBase extends ActionITCaseBase {
 
+    protected static final DataType[] FIELD_TYPES =

Review Comment:
   private



##########
paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/action/CompactActionITCaseBase.java:
##########
@@ -87,4 +98,29 @@ protected void checkFileAndRowSize(
         assertThat(files.size()).isEqualTo(fileNum);
         assertThat(count).isEqualTo(rowCount);
     }
+
+    protected void checkLatestSnapshot(
+            FileStoreTable table, long snapshotId, Snapshot.CommitKind commitKind) {
+        SnapshotManager snapshotManager = table.snapshotManager();
+        Snapshot snapshot = snapshotManager.snapshot(snapshotManager.latestSnapshotId());

Review Comment:
   Unboxing of 'snapshotManager.latestSnapshotId()' may produce 'NullPointerException' 



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on code in PR #4589:
URL: https://github.com/apache/paimon/pull/4589#discussion_r1857725854


##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/action/CompactAction.java:
##########
@@ -59,6 +59,8 @@ public class CompactAction extends TableActionBase {
 
     @Nullable private Duration partitionIdleTime = null;
 
+    private Boolean fullCompaction;

Review Comment:
   Refer to above, If there are more other strategies in the future, we can use enumeration.



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "LinMingQiang (via GitHub)" <gi...@apache.org>.
LinMingQiang commented on PR #4589:
URL: https://github.com/apache/paimon/pull/4589#issuecomment-2499784586

   > Can you also modify Flink & Spark procedures?
   
   I plan to complete this in another PR.
   
   Plan to add a new procedure `minor_compact`, and provide some new parameters like 
   `num-sorted-run.compaction-trigger` / `compaction.size-ratio`. 


-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #4589:
URL: https://github.com/apache/paimon/pull/4589#discussion_r1859779954


##########
paimon-flink/paimon-flink-1.18/src/main/java/org/apache/paimon/flink/procedure/CompactProcedure.java:
##########
@@ -125,6 +129,7 @@ public String[] call(
             ProcedureContext procedureContext,
             String tableId,
             String partitions,
+            String compactStrategy,

Review Comment:
   It is better to keep compability?



-- 
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: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [flink] Support minor compact strategy for dedicated compaction action. [paimon]

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


-- 
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: issues-unsubscribe@paimon.apache.org

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