laskoviymishka commented on code in PR #2601:
URL: https://github.com/apache/iceberg-go/pull/2601#discussion_r4618034006


##########
table/expire_replay.go:
##########
@@ -18,10 +18,15 @@
 package table
 
 import (
+       "errors"
        "fmt"
        "slices"
 )
 
+var errSnapshotHistoryIncompleteForExpiration = errors.New(
+       "cannot expire snapshots with incomplete history under REST 
snapshot-loading-mode=refs; reload with snapshot-loading-mode=all",

Review Comment:
   Could the message say the history may be incomplete? Both guards check the 
load mode, not what came back 
([rest.go](https://github.com/apache/iceberg-go/blob/91642ed2c3df80f1bb2a8b24686a5d922f728f39/catalog/rest/rest.go#L2076-L2078)),
 so a refs-mode table whose snapshots are all ref heads gets this error too. 
Cherry-pick only rejects on `!complete` 
([cherry_pick.go](https://github.com/apache/iceberg-go/blob/91642ed2c3df80f1bb2a8b24686a5d922f728f39/table/cherry_pick.go#L89-L103)).
   
   ```suggestion
        "cannot expire snapshots: history may be incomplete under REST 
snapshot-loading-mode=refs; reload with snapshot-loading-mode=all",
   ```



##########
table/transaction.go:
##########
@@ -827,6 +827,9 @@ func (t *Transaction) ExpireSnapshots(opts 
...ExpireSnapshotsOpt) error {
        if err := validateGCEnabledForSnapshotExpiration(meta.props); err != 
nil {
                return err
        }
+       if t.tbl.snapshotHistoryRefsOnly {

Review Comment:
   Could we load the full history here instead of rejecting? In refs mode 
Java's `RESTSessionCatalog` sets a snapshots supplier that reloads with 
`SnapshotMode.ALL` 
([RESTSessionCatalog.java](https://github.com/apache/iceberg/blob/5b132c88f7700eff26968a699e2bf1d8bc7330ed/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java#L566-L583)).
 As I read it, a table from a refs-mode `LoadTable` can't be expired with this 
guard. `loadTableWithMode` is unexported 
([rest.go](https://github.com/apache/iceberg-go/blob/91642ed2c3df80f1bb2a8b24686a5d922f728f39/catalog/rest/rest.go#L2026-L2030)),
 so the only way out is a second catalog with `snapshot-loading-mode=all`.



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