This is an automated email from the ASF dual-hosted git repository.
dweeks 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 1667a65 Minor update to BaseTransaction snapshot ID handling. (#368)
1667a65 is described below
commit 1667a658434bbb2745053443235e4f980fcbb51f
Author: Ryan Blue <[email protected]>
AuthorDate: Fri Aug 9 12:26:56 2019 -0700
Minor update to BaseTransaction snapshot ID handling. (#368)
---
.../main/java/org/apache/iceberg/BaseTransaction.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/core/src/main/java/org/apache/iceberg/BaseTransaction.java
b/core/src/main/java/org/apache/iceberg/BaseTransaction.java
index dd1a623..1454fa3 100644
--- a/core/src/main/java/org/apache/iceberg/BaseTransaction.java
+++ b/core/src/main/java/org/apache/iceberg/BaseTransaction.java
@@ -314,7 +314,9 @@ class BaseTransaction implements Transaction {
}
}
- currentSnapshotId.set(current.currentSnapshot().snapshotId());
+ if (current.currentSnapshot() != null) {
+ currentSnapshotId.set(current.currentSnapshot().snapshotId());
+ }
// fix up the snapshot log, which should not contain intermediate
snapshots
underlyingOps.commit(base,
current.removeSnapshotLogEntries(intermediateSnapshotIds));
@@ -342,7 +344,9 @@ class BaseTransaction implements Transaction {
// the commit succeeded
try {
- intermediateSnapshotIds.add(currentSnapshotId.get());
+ if (currentSnapshotId.get() != -1) {
+ intermediateSnapshotIds.add(currentSnapshotId.get());
+ }
// clean up the data files that were deleted by each operation. first,
get the list of committed manifests to
// ensure that no committed manifest is deleted. a manifest could be
deleted in one successful operation
@@ -367,10 +371,14 @@ class BaseTransaction implements Transaction {
}
}
- private static Set<String> committedFiles(TableOperations ops, Set<Long>
intermediateSnapshotIds) {
+ private static Set<String> committedFiles(TableOperations ops, Set<Long>
snapshotIds) {
+ if (snapshotIds.isEmpty()) {
+ return null;
+ }
+
Set<String> committedFiles = Sets.newHashSet();
- for (long snapshotId : intermediateSnapshotIds) {
+ for (long snapshotId : snapshotIds) {
Snapshot snap = ops.current().snapshot(snapshotId);
if (snap != null) {
committedFiles.add(snap.manifestListLocation());