harshilv17 opened a new pull request, #2790: URL: https://github.com/apache/iceberg-go/pull/2790
Closes #2690 ## What - `iceberg clean-orphan-files` loads the table through `table.FullSnapshotHistoryLoader` when the catalog supports it, as `expire-snapshots` does. - `Table.Refresh` reloads through `LoadTableWithFullSnapshotHistory` when the table was loaded with full history (`WithSnapshotHistoryLimitedToRefs(false)`, which REST already sets). Tables with an unknown load mode, such as those built with `table.New` and no option, still refresh with `LoadTable` and pick up the catalog's mode. ## Why - Under `snapshot-loading-mode=refs`, the CLI got a refs-only table and cleanup failed with the incomplete-history error from #2689. - Loading full history at the start was not enough: orphan cleanup refreshes the table before deleting, and `Refresh` always used `LoadTable`, so the refreshed table came back refs-only and was rejected. - The incomplete-history error is unchanged when no full loader is available. No new exported API. ## Testing - `TestRunCleanOrphanFilesLoadsFullHistory` (CLI, dry run and delete) fails if the CLI uses `LoadTable`. - `TestOrphanCleanupKeepsFullHistoryAcrossRefresh` (maintenance) and `TestOrphanCleanupRefreshKeepsRESTFullSnapshotHistory` (REST, refs default) fail on `main` with the incomplete-history error and pass with the change. - The existing `TestCherryPickRefsModePersistsAcrossRESTTableLifecycle` still passes, so a refresh still applies the catalog's mode to handles with no recorded mode. **Open question:** REST passes `WithSnapshotHistoryLimitedToRefs(mode == SnapshotModeRefs)`, so a load with no `snapshot-loading-mode` set is also marked full even if the server defaults to refs. Refresh then goes through `LoadTableWithFullSnapshotHistory`, which in unset mode is a plain `LoadTable`, so behavior is unchanged there, but the flag is optimistic. Happy to tighten it to only the explicit `all`/full-loader paths if you prefer. -- 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]
