Bugfix: write changes back to *Persistence.DataStores #4284
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since DataStores is a
map[string]DataStore
,ds
is a copy of the data in the map, and changes are made only to that copy.So this change writes the (possibly)-changed value back to the map, so it actually takes effect.
I added a test because why not. Prior to this fix it fails with:
and now it passes.
The NumShards update worked before because it's modifying a
*SQL
, but I've included an assertion for it to serve as a counter-example / to guard against a bug if it ever becomes a value object as well. Plus I assume we have other "fill in defaults / backfill legacy stuff" values, or we will eventually, and bundling all the simple ones into one test is fairly reasonable.