You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "yihua (via GitHub)" <gi...@apache.org> on 2023/03/20 05:41:44 UTC

[GitHub] [hudi] yihua opened a new pull request, #8238: [HUDI-5954] Infer cleaning policy based on clean configs

yihua opened a new pull request, #8238:
URL: https://github.com/apache/hudi/pull/8238

   ### Change Logs
   
   This PR adds the logic of inferring the cleaning policy based on clean configs.  By default, the cleaning policy is determined based on one of the following configs explicitly set by the user (at most one of them can be set; otherwise, KEEP_LATEST_COMMITS cleaning policy is used):
   - "hoodie.cleaner.commits.retained": the KEEP_LATEST_COMMITS cleaning policy is used;
   - "hoodie.cleaner.hours.retained": the KEEP_LATEST_BY_HOURS cleaning policy is used;
   - "hoodie.cleaner.fileversions.retained": the KEEP_LATEST_FILE_VERSIONS cleaning policy is used.
   
   Now setting only one of the configs above automatically switch the cleaning policy.
   
   ### Impact
   
   A user does not need to explicitly set the cleaning policy alongside the one of following configs: "hoodie.cleaner.commits.retained", "hoodie.cleaner.hours.retained", or "hoodie.cleaner.fileversions.retained".
   
   ### Risk level
   
   none
   
   ### Documentation Update
   
   Docs update: HUDI-595
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


-- 
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@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1476091034

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802",
       "triggerID" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 167606ece52fcec13e7d23b2bf4f9f25223cd6f4 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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@hudi.apache.org

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


[GitHub] [hudi] yihua commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "yihua (via GitHub)" <gi...@apache.org>.
yihua commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1492829259

   > > > I'm so confused by these options, does the option hoodie.cleaner.policy make any sense here? If all the specific cleaning param: hoodie.cleaner.commits.retained, hoodie.cleaner.hours.retained, hoodie.cleaner.fileversions.retained all have detemistic policy, then this option should be eliminated.
   > > > For example, can we use a combination like HoodieCleaningPolicy.KEEP_LATEST_COMMITS policy and hoodie.cleaner.fileversions.retained, if not, introduce the redundant option key hoodie.cleaner.policy is totally unnecessary.
   > > 
   > > 
   > > @danny0405 what you mentioned totally makes sense. The reason I keep `hoodie.cleaner.policy` is that we should still make it backwards compatible, so that if `hoodie.cleaner.policy` is set, we should honor that. If none of `hoodie.cleaner.commits.retained`, `hoodie.cleaner.hours.retained`, or `hoodie.cleaner.fileversions.retained` is set, the specified policy should be used, and the default clean config value (commits, hours, or file versions retained) is used.
   > 
   > Then let's mark this option `hoodie.cleaner.policy` as deprecated and add some release notes on the website.
   
   Makes sense.  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@hudi.apache.org

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


[GitHub] [hudi] yihua commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "yihua (via GitHub)" <gi...@apache.org>.
yihua commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1492861245

   CI is green.
   <img width="1495" alt="Screenshot 2023-04-01 at 00 19 32" src="https://user-images.githubusercontent.com/2497195/229271805-6db678af-348c-48c9-8862-de80acbe56ae.png">
   


-- 
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@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1475662339

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 167606ece52fcec13e7d23b2bf4f9f25223cd6f4 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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@hudi.apache.org

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


[GitHub] [hudi] yihua commented on a diff in pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "yihua (via GitHub)" <gi...@apache.org>.
yihua commented on code in PR #8238:
URL: https://github.com/apache/hudi/pull/8238#discussion_r1155055932


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieCleanConfig.java:
##########
@@ -59,25 +63,67 @@ public class HoodieCleanConfig extends HoodieConfig {
       .withDocumentation("Only applies when " + AUTO_CLEAN.key() + " is turned on. "
           + "When turned on runs cleaner async with writing, which can speed up overall write performance.");
 
+  // The cleaner policy config definition has to be before the following configs for inference:
+  // CLEANER_COMMITS_RETAINED, CLEANER_HOURS_RETAINED, CLEANER_FILE_VERSIONS_RETAINED
+  public static final ConfigProperty<String> CLEANER_POLICY = ConfigProperty
+      .key("hoodie.cleaner.policy")
+      .defaultValue(HoodieCleaningPolicy.KEEP_LATEST_COMMITS.name())
+      .withInferFunction(cfg -> {
+        boolean isCommitsRetainedConfigured = cfg.contains(CLEANER_COMMITS_RETAINED_KEY);
+        boolean isHoursRetainedConfigured = cfg.contains(CLEANER_HOURS_RETAINED_KEY);

Review Comment:
   As discussed, I marked it as deprecated.



-- 
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@hudi.apache.org

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


[GitHub] [hudi] yihua commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "yihua (via GitHub)" <gi...@apache.org>.
yihua commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1491404273

   > I'm so confused by these options, does the option hoodie.cleaner.policy make any sense here? If all the specific cleaning param: hoodie.cleaner.commits.retained, hoodie.cleaner.hours.retained, hoodie.cleaner.fileversions.retained all have detemistic policy, then this option should be eliminated.
   > 
   > For example, can we use a combination like HoodieCleaningPolicy.KEEP_LATEST_COMMITS policy and hoodie.cleaner.fileversions.retained, if not, introduce the redundant option key hoodie.cleaner.policy is totally unnecessary.
   
   @danny0405 what you mentioned totally makes sense.  The reason I keep `hoodie.cleaner.policy` is that we should still make it backwards compatible, so that if `hoodie.cleaner.policy` is set, we should honor that.  If none of `hoodie.cleaner.commits.retained`, `hoodie.cleaner.hours.retained`, or `hoodie.cleaner.fileversions.retained` is set, the specified policy should be used, and the default clean config value (commits, hours, or file versions retained) is used.


-- 
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@hudi.apache.org

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


[GitHub] [hudi] danny0405 commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1492814706

   > > I'm so confused by these options, does the option hoodie.cleaner.policy make any sense here? If all the specific cleaning param: hoodie.cleaner.commits.retained, hoodie.cleaner.hours.retained, hoodie.cleaner.fileversions.retained all have detemistic policy, then this option should be eliminated.
   > > For example, can we use a combination like HoodieCleaningPolicy.KEEP_LATEST_COMMITS policy and hoodie.cleaner.fileversions.retained, if not, introduce the redundant option key hoodie.cleaner.policy is totally unnecessary.
   > 
   > @danny0405 what you mentioned totally makes sense. The reason I keep `hoodie.cleaner.policy` is that we should still make it backwards compatible, so that if `hoodie.cleaner.policy` is set, we should honor that. If none of `hoodie.cleaner.commits.retained`, `hoodie.cleaner.hours.retained`, or `hoodie.cleaner.fileversions.retained` is set, the specified policy should be used, and the default clean config value (commits, hours, or file versions retained) is used.
   
   Then let's mark this option `hoodie.cleaner.policy` as deprecated and add some release notes on the website.


-- 
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@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1475668665

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802",
       "triggerID" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 167606ece52fcec13e7d23b2bf4f9f25223cd6f4 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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@hudi.apache.org

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


[GitHub] [hudi] danny0405 commented on a diff in pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #8238:
URL: https://github.com/apache/hudi/pull/8238#discussion_r1153970726


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieCleanConfig.java:
##########
@@ -59,25 +63,67 @@ public class HoodieCleanConfig extends HoodieConfig {
       .withDocumentation("Only applies when " + AUTO_CLEAN.key() + " is turned on. "
           + "When turned on runs cleaner async with writing, which can speed up overall write performance.");
 
+  // The cleaner policy config definition has to be before the following configs for inference:
+  // CLEANER_COMMITS_RETAINED, CLEANER_HOURS_RETAINED, CLEANER_FILE_VERSIONS_RETAINED
+  public static final ConfigProperty<String> CLEANER_POLICY = ConfigProperty
+      .key("hoodie.cleaner.policy")
+      .defaultValue(HoodieCleaningPolicy.KEEP_LATEST_COMMITS.name())
+      .withInferFunction(cfg -> {
+        boolean isCommitsRetainedConfigured = cfg.contains(CLEANER_COMMITS_RETAINED_KEY);
+        boolean isHoursRetainedConfigured = cfg.contains(CLEANER_HOURS_RETAINED_KEY);

Review Comment:
   I'm so confused by these options, does the option `hoodie.cleaner.policy` make any sense here? If all the specific cleaning param: `hoodie.cleaner.commits.retained`, `hoodie.cleaner.hours.retained`, `hoodie.cleaner.fileversions.retained` all have detemistic policy, then this option should be eliminated.
   
   For example, can we use a combination like `HoodieCleaningPolicy.KEEP_LATEST_COMMITS` policy and `hoodie.cleaner.fileversions.retained`, if not, introduce the redundant option key `hoodie.cleaner.policy` is totally unnecessary.



-- 
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@hudi.apache.org

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


[GitHub] [hudi] yihua merged pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

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


-- 
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@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1492831129

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802",
       "triggerID" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9d3995bd57254f2ce654623016c0d8e6cbc60f3a",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16037",
       "triggerID" : "9d3995bd57254f2ce654623016c0d8e6cbc60f3a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 167606ece52fcec13e7d23b2bf4f9f25223cd6f4 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802) 
   * 9d3995bd57254f2ce654623016c0d8e6cbc60f3a Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=16037) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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@hudi.apache.org

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


[GitHub] [hudi] hudi-bot commented on pull request #8238: [HUDI-5954] Infer cleaning policy based on clean configs

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8238:
URL: https://github.com/apache/hudi/pull/8238#issuecomment-1492830221

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802",
       "triggerID" : "167606ece52fcec13e7d23b2bf4f9f25223cd6f4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "9d3995bd57254f2ce654623016c0d8e6cbc60f3a",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9d3995bd57254f2ce654623016c0d8e6cbc60f3a",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 167606ece52fcec13e7d23b2bf4f9f25223cd6f4 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15802) 
   * 9d3995bd57254f2ce654623016c0d8e6cbc60f3a UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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@hudi.apache.org

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