ConeyLiu commented on code in PR #6335:
URL: https://github.com/apache/iceberg/pull/6335#discussion_r1261306767
##########
core/src/main/java/org/apache/iceberg/FastAppend.java:
##########
@@ -178,8 +184,25 @@ public Object updateEvent() {
@Override
protected void cleanUncommitted(Set<ManifestFile> committed) {
- if (newManifest != null && !committed.contains(newManifest)) {
- deleteFile(newManifest.path());
+ if (newManifests != null) {
+ // Delete newManifests that have not been committed and clear them from
the list.
+ // This is needed for manifests cleanup especially in transaction mode,
for example:
+ // Transaction txn = beginTransaction(...)
+ // // Operation succeeds and calls cleanUncommitted'
+ // txn.newFastAppend().appendFile(...).commit();
+ // // Some other operations ...
+ // // Commit fails and needs to clean up newManifests
Review Comment:
I add the blank line between the comments to separate them.
##########
core/src/main/java/org/apache/iceberg/FastAppend.java:
##########
@@ -178,8 +184,25 @@ public Object updateEvent() {
@Override
protected void cleanUncommitted(Set<ManifestFile> committed) {
- if (newManifest != null && !committed.contains(newManifest)) {
- deleteFile(newManifest.path());
+ if (newManifests != null) {
+ // Delete newManifests that have not been committed and clear them from
the list.
+ // This is needed for manifests cleanup especially in transaction mode,
for example:
+ // Transaction txn = beginTransaction(...)
+ // // Operation succeeds and calls cleanUncommitted'
Review Comment:
updated
##########
core/src/main/java/org/apache/iceberg/ManifestFiles.java:
##########
@@ -167,6 +167,30 @@ public static ManifestWriter<DataFile> write(
"Cannot write manifest for table version: " + formatVersion);
}
+ /**
+ * Create a new {@link RollingManifestWriter} for the given format version.
+ *
+ * @param formatVersion a target format version
+ * @param snapshotId a snapshot ID for the manifest entries, or null for an
inherited ID
+ * @param spec a {@link PartitionSpec}
+ * @param io a {@link FileIO}
+ * @param outputFileFactory a {@link ManifestOutputFileFactory} to generate
the manifest output
+ * file
+ * @param targetFileSizeInBytes the target file size for manifest file, and
will create a new one
+ * when reached
+ * @return a rolling manifest writer which could generate multiple manifest
file
Review Comment:
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]