File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
graph/src/components/store Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -205,11 +205,26 @@ impl EntityCache {
205205 }
206206 GetScope :: InBlock => None ,
207207 } ;
208-
209208 // Always test the cache consistency in debug mode. The test only
210- // makes sense when we were actually asked to read from the store
209+ // makes sense when we were actually asked to read from the store.
210+ // We need to remove the VID as the one from the DB might come from
211+ // a legacy subgraph that has VID autoincremented while this trait
212+ // always creates it in a new style.
211213 debug_assert ! ( match scope {
212- GetScope :: Store => entity == self . store. get( key) . unwrap( ) . map( Arc :: new) ,
214+ GetScope :: Store => {
215+ // Release build will never call this function and hence it's OK
216+ // when that implementation is not correct.
217+ fn remove_vid( entity: Option <Arc <Entity >>) -> Option <Entity > {
218+ entity. map( |e| {
219+ #[ allow( unused_mut) ]
220+ let mut entity = ( * e) . clone( ) ;
221+ #[ cfg( debug_assertions) ]
222+ entity. remove( "vid" ) ;
223+ entity
224+ } )
225+ }
226+ remove_vid( entity. clone( ) ) == remove_vid( self . store. get( key) . unwrap( ) . map( Arc :: new) )
227+ }
213228 GetScope :: InBlock => true ,
214229 } ) ;
215230
You can’t perform that action at this time.
0 commit comments