Skip to content
Prev Previous commit
Next Next commit
fix treemigrator
  • Loading branch information
cheggaaa committed Mar 24, 2026
commit 7f6e28b0ae34a78b0f47bcb546b2a954d42ed88f
5 changes: 5 additions & 0 deletions commonspace/object/tree/objecttree/treemigrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"sync/atomic"

anystore "github.com/anyproto/any-store"

Expand Down Expand Up @@ -85,6 +86,10 @@ func (tm *TreeMigrator) MigrateTreeStorage(ctx context.Context, storage treeStor
return fmt.Errorf("migration: failed to start old storage: %w", err)
}
}
// Set up AddSeq counter so storage.AddAll can assign sequence numbers
if setter, ok := newStorage.(interface{ SetAddSeq(seq *atomic.Uint64) }); ok {
setter.SetAddSeq(&atomic.Uint64{})
}
objTree, err := BuildMigratableObjectTree(newStorage, tm.aclList)
if err != nil {
return fmt.Errorf("migration: failed to build object tree: %w", err)
Expand Down