manuzhang commented on code in PR #1104:
URL: https://github.com/apache/iceberg-cpp/pull/1104#discussion_r4609073545


##########
src/iceberg/transaction.cc:
##########
@@ -99,6 +104,60 @@ std::string FormatCommittedSnapshots(
   return detail;
 }
 
+/// Collect files that must survive transaction finalization.
+///
+/// The set includes manifests and manifest lists from all snapshots created by
+/// this transaction. It also includes owned content files still referenced by
+/// retained delete manifests.
+///
+/// \param metadata The metadata after the transaction commit.
+/// \param io FileIO used to read manifest lists and delete manifests.
+/// \param snapshot_ids Snapshot IDs in the committed AddSnapshot changes.
+/// \param content_paths Owned files whose live references have not been found.
+Result<std::unordered_set<std::string>> CommittedTransactionFiles(
+    const TableMetadata& metadata, const std::shared_ptr<FileIO>& io,
+    std::unordered_set<int64_t> snapshot_ids,
+    std::unordered_set<std::string> content_paths) {
+  std::unordered_set<std::string> committed;
+  for (const auto& snapshot : metadata.snapshots) {

Review Comment:
   Can we refactor this block with three loops, multiple control flows with 
`break` and `continue`? That's hard to grok.



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