gradle-baseline icon indicating copy to clipboard operation
gradle-baseline copied to clipboard

Move all AtlasDB persisters to the new reusable type

Open raiju opened this issue 2 years ago • 5 comments

Before this PR

Non-reusable persisters are created for each cell read/write. This causes a lot of object creation, which is particularly problematic when a new object mapper is created,

After this PR

==COMMIT_MSG== Enforce all AtlasDB persisters to be marked as reusable ==COMMIT_MSG==

Possible downsides?

  • Should applying this fix be broken out into a separate excavator to ensure enough attention is paid to it? I haven't found a single non-reusable persister yet, but I'm sure they exist.
  • @jeremyk-91 @Jolyon-S Are there reasons to not do this?

raiju avatar Jun 13 '22 16:06 raiju

Generate changelog in changelog/@unreleased

Type

  • [ ] Feature
  • [x] Improvement
  • [ ] Fix
  • [ ] Break
  • [ ] Deprecation
  • [ ] Manual task
  • [ ] Migration

Description Enforce all AtlasDB persisters to be marked as reusable

Check the box to generate changelog(s)

  • [x] Generate changelog entry

changelog-app[bot] avatar Jun 13 '22 16:06 changelog-app[bot]

Given that we own the persister API, I would prefer if we updated the API in such a way that it's difficult to get wrong rather than relying on static analysis.

carterkozak avatar Jun 13 '22 16:06 carterkozak

I'd prefer that too; @jeremyk-91 is there a world where we could flip the expectations/always enforce this?

@carterkozak Would you be ok merging this with a plan to get persisters to be safe by default?

raiju avatar Jun 13 '22 16:06 raiju

No objections to changing the API in the long term (in fact that's preferable, I remember this bit of defensiveness being somewhat annoying to add) - the main thing is how to get there. If this is likely to have people touch each of their persisters, I'm thinking if we should instead do:

  • add @StatefulPersister annotation to AtlasDB (or something like that)
  • require users to specify at least one
  • (not 100% safe, but probably >99%) after some point in time, switch the default behaviour over

jeremyk-91 avatar Jun 13 '22 17:06 jeremyk-91

Refactored this to support the new setup (only ReusablePersisters are supported, Persisters are deprecated)

raiju avatar Jul 11 '22 20:07 raiju