alexjo2144 opened a new issue, #5442:
URL: https://github.com/apache/iceberg/issues/5442

   ### Apache Iceberg version
   
   0.14.0 (latest release)
   
   ### Query engine
   
   _No response_
   
   ### Please describe the bug 🐞
   
   If a Transaction has multiple changes that it applies the table history is 
cleared and `TableManifest.snapshotLog` is cleared.
   
   Here's a test case, adopted from 
`TestTransaction#testMultipleOperationTransaction`
   
   ```java
     @Test
     public void testMultipleOperationTransaction() {
       Assert.assertEquals("Table should be on version 0", 0, (int) version());
   
       table.newAppend().appendFile(FILE_C).commit();
       List<HistoryEntry> initialHistory = table.history();
   
       TableMetadata base = readMetadata();
   
       Transaction txn = table.newTransaction();
   
       Assert.assertSame("Base metadata should not change when commit is 
created",
           base, readMetadata());
       Assert.assertEquals("Table should be on version 1 after txn create", 1, 
(int) version());
   
       txn.newAppend()
           .appendFile(FILE_A)
           .appendFile(FILE_B)
           .commit();
   
       Assert.assertSame("Base metadata should not change when commit is 
created",
           base, readMetadata());
       Assert.assertEquals("Table should be on version 1 after txn create", 1, 
(int) version());
   
       Snapshot appendSnapshot = txn.table().currentSnapshot();
   
       txn.newDelete()
           .deleteFile(FILE_A)
           .commit();
   
       Snapshot deleteSnapshot = txn.table().currentSnapshot();
   
       Assert.assertSame("Base metadata should not change when an append is 
committed",
           base, readMetadata());
       Assert.assertEquals("Table should be on version 1 after append", 1, 
(int) version());
   
       txn.commitTransaction();
   
       Assert.assertEquals("Table should be on version 2 after commit", 2, 
(int) version());
       Assert.assertEquals("Table should have two manifest after commit",
           2, readMetadata().currentSnapshot().allManifests(table.io()).size());
       Assert.assertEquals("Table snapshot should be the delete snapshot",
           deleteSnapshot, readMetadata().currentSnapshot());
       
validateManifestEntries(readMetadata().currentSnapshot().allManifests(table.io()).get(0),
           ids(deleteSnapshot.snapshotId(), appendSnapshot.snapshotId()),
           files(FILE_A, FILE_B), statuses(Status.DELETED, Status.EXISTING));
   
       Assert.assertEquals("Table should have a snapshot for each operation",
           3, readMetadata().snapshots().size());
       
validateManifestEntries(readMetadata().snapshots().get(1).allManifests(table.io()).get(0),
           ids(appendSnapshot.snapshotId(), appendSnapshot.snapshotId()),
           files(FILE_A, FILE_B), statuses(Status.ADDED, Status.ADDED));
   
       List<HistoryEntry> finalHistory = table.history();
       for (HistoryEntry historyEntry : initialHistory) {
         // Fails
         Assert.assertTrue(finalHistory.contains(historyEntry));
       }
     }
   ```


-- 
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]

Reply via email to