File tree Expand file tree Collapse file tree 2 files changed +21
-13
lines changed
graph/src/components/store Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -406,19 +406,23 @@ impl EntityCache {
406406 * write_capacity_remaining -= weight;
407407 }
408408
409- // The next VID is based on a block number and a sequence within the block
410- let vid = ( ( block as i64 ) << 32 ) + self . vid_seq as i64 ;
411- self . vid_seq += 1 ;
409+ let is_object = key. entity_type . is_object_type ( ) ;
410+
412411 let mut entity = entity;
413- let old_vid = entity. set_vid ( vid) . expect ( "the vid should be set" ) ;
414- // Make sure that there was no VID previously set for this entity.
415- if let Some ( ovid) = old_vid {
416- bail ! (
417- "VID: {} of entity: {} with ID: {} was already present when set in EntityCache" ,
418- ovid,
419- key. entity_type,
420- entity. id( )
421- ) ;
412+ if self . strict_vid_order && is_object {
413+ // The next VID is based on a block number and a sequence within the block
414+ let vid = ( ( block as i64 ) << 32 ) + self . vid_seq as i64 ;
415+ self . vid_seq += 1 ;
416+ let old_vid = entity. set_vid ( vid) . expect ( "the vid should be set" ) ;
417+ // Make sure that there was no VID previously set for this entity.
418+ if let Some ( ovid) = old_vid {
419+ bail ! (
420+ "VID: {} of entity: {} with ID: {} was already present when set in EntityCache" ,
421+ ovid,
422+ key. entity_type,
423+ entity. id( )
424+ ) ;
425+ }
422426 }
423427
424428 self . entity_op ( key. clone ( ) , EntityOp :: Update ( entity) ) ;
Original file line number Diff line number Diff line change @@ -2257,7 +2257,11 @@ impl<'a> InsertRow<'a> {
22572257 }
22582258 let br_value = BlockRangeValue :: new ( table, row. block , row. end ) ;
22592259 let causality_region = row. causality_region ;
2260- let vid = row. entity . vid ( ) ;
2260+ let vid = if table. object . has_vid_seq ( ) {
2261+ row. entity . vid ( )
2262+ } else {
2263+ 0
2264+ } ;
22612265 Ok ( Self {
22622266 values,
22632267 br_value,
You can’t perform that action at this time.
0 commit comments