zilverline / sequent

CQRS & event sourcing framework for Ruby
https://sequent.io
MIT License
541 stars 58 forks source link

Replay optimized postgres persistor fixes #403

Closed erikrozendaal closed 9 months ago

erikrozendaal commented 9 months ago

This fixes two problems in the ReplayOptimizedPostgresPersistor:

  1. The documentation specifies that a default aggregate_id index is automatically added. Unfortunately the implementation was broken.
  2. The index used the hash value of the record keys but did not handle hash collisions at all. So when the hash function collided records could be affected with different keys, causing data corruption.

This PR fixes both issues and (tries to) clean up the code.