Skip to content

Commit

Permalink
fix(#677): fixed initialization of sequence for new collections
Browse files Browse the repository at this point in the history
  • Loading branch information
novoj committed Nov 20, 2024
1 parent 814dd48 commit f4c11d9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,15 @@ public EntityCollection(
// from older storage format when it was stored as a part of the global index
this.pricePkSequence = sequenceService.getOrCreateSequence(
catalogName, SequenceType.PRICE, entityType,
// if entity header has no last internal price id, initialized and there is global index available
entityHeader.lastInternalPriceId() == -1 && entityHeader.globalEntityIndexId() != null ?
// try to initialize sequence from deprecated storage key format
entityCollectionPersistenceService.fetchLastAssignedInternalPriceIdFromGlobalIndex(
catalogVersion,
entityHeader.globalEntityIndexId()
).orElse(0) : entityHeader.lastInternalPriceId()
).orElse(0) :
// otherwise initialize from the last internal price id - when it's initialized, othewise start from 0
entityHeader.lastInternalPriceId() == -1 ? 0 : entityHeader.lastInternalPriceId()
);

// initialize container buffer
Expand Down

0 comments on commit f4c11d9

Please sign in to comment.