core-java
core-java copied to clipboard
Repository `iterator` and Storage `index` produce inconsistent results during migration
The repository iterator
method relies on the storage index
method implementation that changed with the introduction of Mirror
.
The new implementation queries Mirror to retrieve unique entity IDs if the entity visibility was configured in any way or uses distinctAggregateIds
from the storage directly if the mirror is not configured.
Such an approach is not an issue if mirroring was for all entities was configured in Protobuf with the very first entity, but if we have any entities in the storage already that were not previously stored in the Mirror, the index will not return them as well.
From my personal perspective, I do not see any advantage of retrieving IDs from the Mirror. Also, I do observe one disadvantage — we have to retrieve MirrorProjection
entities and pay for API requests, while with the distinctAggregateIds
call we use the free-of-charge ProjectionQuery
.
@yuri-sergiichuk let's discuss this one in person. I want to understand which changes would make your life easier.