Repository navigation
Upgrade to patchlevel/hydrator 2.0 - #900
Conversation
Replace our own upcaster with the UpcastExtension of the hydrator and switch the serializer and snapshot store to take a configured hydrator instead of an upcaster and cryptographer. The legacy cryptography is gone in hydrator 2.0, so the old DoctrineCipherKeyStore is removed and the extension based store takes over its name.
|
Hello 👋 here is the most recent benchmark result:
This comment gets update everytime a new commit comes in! |
|
PersonalDataBench::benchLoad10000Events got a lot slower with this change (116ms before, 2.7s after). The old legacy DoctrineCipherKeyStore had an internal key cache, the new one doesn't, so loading 10k events now runs one query per event. I don't want to put an unbounded array cache back into the store, since in long running workers it would never be cleared and removed keys would still be usable there. The plan is to use the Psr6/Psr16CacheStoreDecorator from the hydrator with a TTL and max items instead. That didn't work yet because the decorators used reserved characters in their cache keys and didn't evict everything on removal, which is fixed in patchlevel/hydrator#207. Once that is merged up to 2.0.x and released, I'll bump the hydrator here, switch the benchmark to the decorator (symfony/cache as dev dependency) and add a section about caching to the personal data docs. |
The event serializer now passes the stored event name and the event class as context to the hydrator, so upcasters can tell under which name an event was stored, which matters since renames are handled with aliases. The headers serializer factories accept a custom hydrator as well. The personal data page is renamed to sensitive data to match the new SensitiveData attribute, and the upgrade guide covers the moved attributes.
The old DoctrineCipherKeyStore cached keys internally, the new one does not, so loading an aggregate ran one query per encrypted value. Instead of an unbounded cache in the store, which never gets cleared in long running workers, the benchmark and the docs now use the cache decorator of the hydrator with a lifetime and a limit. This needs hydrator 2.0.2, which fixes the cache keys and eviction of the decorators.
phpbench runs the benchmarks in a subprocess, which did not get the memory limit from the Makefile. With xdebug enabled locally, benchSave10000Events ran out of memory, and xdebug also skews the measured times.
The COLUMNS env in the phpunit config did not override an existing value, so console tests failed in the infection subprocess, where the SymfonyStyle error blocks got wrapped at 80 columns. The infection-diff target now uses the same options as CI, since --only-covered no longer exists.
Updates the hydrator to 2.0 and drops our own upcaster in favor of the hydrator's UpcastExtension. Upcasters now work per event class, so renaming events is done with event aliases instead.
DefaultEventSerializer::createFromPaths()andDefaultSnapshotStore::createDefault()now take a configured hydrator instead of an upcaster and cryptographer, and the$upcasterconstructor argument of the serializer is gone.Hydrator 2.0 removed the legacy cryptography, so the old
DoctrineCipherKeyStore(crypto_keystable) is removed andExtensionDoctrineCipherKeyStoreis renamed toDoctrineCipherKeyStore. Data encrypted with the legacy cryptographer can't be read anymore, the upgrade guide recommends migrating it while still on 3.x.All breaking changes are documented in the 4.0 upgrade guide, and the upcasting and personal data docs are updated.