Open ScottDugas opened 4 years ago
Perhaps a record store should copy the metadata from the provider into its own field at some sensible point in its open
lifecycle and have a separate, explicit, operation to refresh it.
More precisely, I think it should do so during checkVersion. and then calling checkVersion again should refresh the metadata. While we're at it, the UserVersionChecker
should probably become a field of the FDBRecordStore
rather than just a part of the builder.
The StoreExistenceCheck
parameter to checkVersion
may only make sense the first time after build
, as part of open
. An open store presumably exists.
In the event that a store is opened, even with calling
checkVersion
if theRecordMetaDataProvider
later returns a newer (or older) metadata, the record store will immediately start using the new metadata, without callingcheckVersion
. One such issue with this is that the index state is incorrect (indexes will appear readable, even though they haven't been built yet). Another issue is that the records stored might not align with the metadata version in the store header.As part of my fix to #489 I have added at least one test for this.