accumulo icon indicating copy to clipboard operation
accumulo copied to clipboard

Prevent multiple creation of multiple PropStore instances.

Open EdColeman opened this issue 3 years ago • 4 comments

As a follow-on to single node property storage in ZooKeeper (issue https://github.com/apache/accumulo/issues/1454)

Currently ZooPropStore exposes the cache builder to facilitate testing. It may be possible that future code could create multiple ZooPropStores instead of sharing a common instance. (The code would work, just be using unnecessary resources)

As a follow-on, the builder could be made private or better protected if tests extended / override the builder to expose the builder for mock injection.

EdColeman avatar Apr 15 '22 15:04 EdColeman

While working on adding version check refresh it looks like we are creating multiple server contexts so this has a higher priority and will look at this next.

EdColeman avatar Jun 15 '22 01:06 EdColeman

I don't think this is a problem, as long as the PropStore in the ServerContext is lazily initialized, which can be done by Suppliers.memoize, like other fields in ServerContext. I also noticed a related issue: we're creating two SystemConfiguration objects... one is created by ServerConfigurationFactory, and another is directly created in ServerContext. The latter should be removed, so only ServerConfigurationFactory is responsible for creating it. I don't know if there's any chicken-egg problems that this was trying to workaround, but if all the ITs pass, I would expect this to not be a problem getting rid of the latter one.

ctubbsii avatar Jun 16 '22 19:06 ctubbsii

Addressed in PR #2781

EdColeman avatar Jun 17 '22 14:06 EdColeman

@EdColeman Can this be closed?

milleruntime avatar Jun 21 '22 11:06 milleruntime