You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/04/27 16:37:25 UTC

[GitHub] [iceberg] southernriver opened a new pull request, #4651: Optimize to delete the oldest metadata file after commit

southernriver opened a new pull request, #4651:
URL: https://github.com/apache/iceberg/pull/4651

   This is to address 2 issues:
   
   - Just construct `Set` of  `removedPreviousMetadataFiles` After  `write.metadata.delete-after-commit.enabled = true`
   - Delete the function of `deleteRemovedMetadataFiles `  in `BaseMetastoreTableOperations` and `HadoopTableOperations`,  and then implement it in interface of `TableOperations` 


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] kbendick commented on pull request #4651: Core: Optimize to delete the oldest metadata file after commit

Posted by GitBox <gi...@apache.org>.
kbendick commented on PR #4651:
URL: https://github.com/apache/iceberg/pull/4651#issuecomment-1111416743

   I agree with @szehon-ho's assessment.


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] kbendick commented on a diff in pull request #4651: Core: Optimize to delete the oldest metadata file after commit

Posted by GitBox <gi...@apache.org>.
kbendick commented on code in PR #4651:
URL: https://github.com/apache/iceberg/pull/4651#discussion_r860192037


##########
core/src/main/java/org/apache/iceberg/TableOperations.java:
##########
@@ -120,4 +124,31 @@ default long newSnapshotId() {
     return (mostSignificantBits ^ leastSignificantBits) & Long.MAX_VALUE;
   }
 
+  /**
+   * Deletes the oldest metadata files if {@link TableProperties#METADATA_DELETE_AFTER_COMMIT_ENABLED} is true.
+   *
+   * @param base     table metadata on which previous versions were based
+   * @param metadata new table metadata with updated previous versions
+   */
+  default void deleteRemovedMetadataFiles(TableMetadata base, TableMetadata metadata) {
+    if (base == null) {
+      return;
+    }
+
+    boolean deleteAfterCommit = metadata.propertyAsBoolean(
+        TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED,
+        TableProperties.METADATA_DELETE_AFTER_COMMIT_ENABLED_DEFAULT);
+
+    if (deleteAfterCommit) {
+      Set<TableMetadata.MetadataLogEntry> removedPreviousMetadataFiles = Sets.newHashSet(base.previousFiles());
+      removedPreviousMetadataFiles.removeAll(metadata.previousFiles());
+      Tasks.foreach(removedPreviousMetadataFiles)
+          .noRetry().suppressFailureWhenFinished()
+          .onFailure((previousMetadataFile, exc) ->
+              LoggerFactory.getLogger(TableOperations.class).warn("Delete failed for previous metadata file: {}",

Review Comment:
   Nit: I don't think this move is necessary, but if it does happen, we shouldn't be instantiating the logger every time we call the log function.



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho commented on pull request #4651: Core: Optimize to delete the oldest metadata file after commit

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on PR #4651:
URL: https://github.com/apache/iceberg/pull/4651#issuecomment-1111340280

   I think the first change makes sense, the second one of raising it to the TableOperations base class may not make sense, I am not sure if all TableOperations in the future (particularly REST) will use this mechanism of metadata.json files?  


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] southernriver commented on pull request #4651: Core: Optimize to delete the oldest metadata file after commit

Posted by GitBox <gi...@apache.org>.
southernriver commented on PR #4651:
URL: https://github.com/apache/iceberg/pull/4651#issuecomment-1123302319

   @szehon-ho @kbendick  Thanks for the review, code has been updated.


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho commented on pull request #4651: Core: Optimize to delete the oldest metadata file after commit

Posted by GitBox <gi...@apache.org>.
szehon-ho commented on PR #4651:
URL: https://github.com/apache/iceberg/pull/4651#issuecomment-1126298153

   Thanks @southernriver for commit, @kbendick  and @singhpk234 for extra review


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] szehon-ho merged pull request #4651: Core: Optimize to delete the oldest metadata file after commit

Posted by GitBox <gi...@apache.org>.
szehon-ho merged PR #4651:
URL: https://github.com/apache/iceberg/pull/4651


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org