badalprasadsingh commented on code in PR #2599:
URL: https://github.com/apache/iceberg-go/pull/2599#discussion_r4597219309
##########
table/maintenance/orphan_cleanup.go:
##########
@@ -386,6 +389,14 @@ func validateOrphanCleanupGC(tbl *table.Table) error {
return nil
}
+func validateCompleteSnapshotHistory(tbl *table.Table) error {
+ if tbl.SnapshotHistoryLimitedToRefs() {
+ return fmt.Errorf("table snapshot history is incomplete under
REST snapshot-loading-mode=refs; reload with snapshot-loading-mode=all")
Review Comment:
ran the lint locally, and its failing here: `fmt.Errorf` with no arguments,
also, no blank lines before many "return err"
better: wrap the sentinel, like the refs-only cherry-pick check, so callers
can use "errors.Is", and assert it with "require.ErrorIs"
```go
return fmt.Errorf("%w: table snapshot history is incomplete under REST
snapshot-loading-mode=refs; reload with snapshot-loading-mode=all",
table.ErrInvalidOperation)
```
##########
table/maintenance/orphan_cleanup.go:
##########
@@ -1394,6 +1413,10 @@ func pathPrefix(path string) (scheme, authority string,
ok bool) {
// concurrently and is bounded to defaultPurgeMaxConcurrency operations because
// it is typically I/O-bound.
func PurgeFiles(ctx context.Context, tbl *table.Table) error {
+ if err := validateCompleteSnapshotHistory(tbl); err != nil {
Review Comment:
"PurgeFiles" only deletes. with the default `gc.enabled=true` it walks the
table location, so refs-only history can only miss files outside it -> catalogs
call it after the drop, when the table can't be reloaded as the hint says.
better:drop this check, its getReferencedFiles copy and the release-note
mention.
--
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]