You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by bl...@apache.org on 2018/12/06 17:45:43 UTC

[incubator-iceberg] branch master updated: Update ExpireSnapshots to avoid commit when no snapshots are removed. (#22)

This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 8713fb3  Update ExpireSnapshots to avoid commit when no snapshots are removed. (#22)
8713fb3 is described below

commit 8713fb3401cb44e8dee2d244b1eac6b6e9dffaa0
Author: Ryan Blue <rd...@users.noreply.github.com>
AuthorDate: Thu Dec 6 09:45:39 2018 -0800

    Update ExpireSnapshots to avoid commit when no snapshots are removed. (#22)
---
 core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java b/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java
index 8f473b3..9ce6981 100644
--- a/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java
+++ b/core/src/main/java/com/netflix/iceberg/RemoveSnapshots.java
@@ -115,7 +115,10 @@ class RemoveSnapshots implements ExpireSnapshots {
         .onlyRetryOn(CommitFailedException.class)
         .run(item -> {
           TableMetadata updated = internalApply();
-          ops.commit(base, updated);
+          // only commit the updated metadata if at least one snapshot was removed
+          if (updated.snapshots().size() != base.snapshots().size()) {
+            ops.commit(base, updated);
+          }
         });
 
     LOG.info("Committed snapshot changes; cleaning up expired manifests and data files.");