diff --git a/internal/db/fetcher/versioned.go b/internal/db/fetcher/versioned.go index 199ca38d21..4f1b20e64f 100644 --- a/internal/db/fetcher/versioned.go +++ b/internal/db/fetcher/versioned.go @@ -96,8 +96,6 @@ type VersionedFetcher struct { acp immutable.Option[acp.ACP] col client.Collection - // @todo index *client.IndexDescription - mCRDTs map[client.FieldID]merklecrdt.MerkleCRDT } // Init initializes the VersionedFetcher. @@ -116,7 +114,6 @@ func (vf *VersionedFetcher) Init( vf.acp = acp vf.col = col vf.queuedCids = list.New() - vf.mCRDTs = make(map[client.FieldID]merklecrdt.MerkleCRDT) vf.txn = txn // create store @@ -329,16 +326,11 @@ func (vf *VersionedFetcher) merge(c cid.Cid) error { return err } - // first arg 0 is the index for the composite DAG in the mCRDTs cache - mcrdt, exists := vf.mCRDTs[0] - if !exists { - mcrdt = merklecrdt.NewMerkleCompositeDAG( - vf.store, - keys.CollectionSchemaVersionKey{}, - vf.dsKey.WithFieldID(core.COMPOSITE_NAMESPACE), - ) - vf.mCRDTs[0] = mcrdt - } + mcrdt := merklecrdt.NewMerkleCompositeDAG( + vf.store, + keys.CollectionSchemaVersionKey{}, + vf.dsKey.WithFieldID(core.COMPOSITE_NAMESPACE), + ) err = mcrdt.Clock().ProcessBlock(vf.ctx, block, link) if err != nil { return err @@ -357,20 +349,16 @@ func (vf *VersionedFetcher) merge(c cid.Cid) error { return client.NewErrFieldNotExist(l.Name) } - mcrdt, exists := vf.mCRDTs[field.ID] - if !exists { - mcrdt, err = merklecrdt.FieldLevelCRDTWithStore( - vf.store, - keys.CollectionSchemaVersionKey{}, - field.Typ, - field.Kind, - vf.dsKey.WithFieldID(fmt.Sprint(field.ID)), - field.Name, - ) - if err != nil { - return err - } - vf.mCRDTs[field.ID] = mcrdt + mcrdt, err := merklecrdt.FieldLevelCRDTWithStore( + vf.store, + keys.CollectionSchemaVersionKey{}, + field.Typ, + field.Kind, + vf.dsKey.WithFieldID(fmt.Sprint(field.ID)), + field.Name, + ) + if err != nil { + return err } err = mcrdt.Clock().ProcessBlock(vf.ctx, subBlock, l.Link)