Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion table/snapshot_producers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ func (fa *fastAppendFiles) existingManifests() ([]iceberg.ManifestFile, error) {
return nil, err
}

// This provides a constant-time (O(1)) search in a loop.
previousSnapshotList := make(map[int64]struct{}, len(fa.base.txn.meta.snapshotList))
for _, sn := range fa.base.txn.meta.snapshotList {
previousSnapshotList[sn.SnapshotID] = struct{}{}
}

for _, m := range manifests {
if m.HasAddedFiles() || m.HasExistingFiles() || m.SnapshotID() == fa.base.snapshotID {
if _, ok := previousSnapshotList[m.SnapshotID()]; m.HasAddedFiles() || m.HasExistingFiles() || ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, if we're saying that the existing manifests can't contain the current snapshot_id shouldn't this use !ok?

Why are we searching the previous snapshot list? Couldn't we just remove this check entirely and just do if m.HasAddedFiles() || m.HasExistingFiles() { ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nudging you @lamOrigin007, are you still available to work on this?

existing = append(existing, m)
}
}
Expand Down
Loading