Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: write changes back to *Persistence.DataStores #4284

Merged
merged 1 commit into from
Jun 24, 2021

Conversation

Groxx
Copy link
Contributor

@Groxx Groxx commented Jun 24, 2021

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:

--- FAIL: TestConfigFallbacks (0.00s)
    config_test.go:95: 
                Error Trace:    config_test.go:95
                Error:          Should NOT be empty, but was <nil>
                Test:           TestConfigFallbacks
                Messages:       nosql config should contain cassandra config / not be empty

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.

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:
```
--- FAIL: TestCassandraFallbackConfig (0.00s)
    config_test.go:90:
                Error Trace:    config_test.go:90
                Error:          Should NOT be empty, but was <nil>
                Test:           TestCassandraFallbackConfig
                Messages:       nosql config should contain cassandra config
```
and now it works.
@coveralls
Copy link

Pull Request Test Coverage Report for Build df5f1b18-77de-4e01-abc4-1a1a7bb99248

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 47 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.03%) to 60.171%

Files with Coverage Reduction New Missed Lines %
common/persistence/executionManager.go 2 75.5%
common/persistence/statsComputer.go 2 95.71%
service/history/task/fetcher.go 2 77.18%
service/matching/taskListManager.go 2 74.72%
service/history/shard/context.go 9 65.23%
service/history/execution/context.go 14 66.78%
common/persistence/sql/sqlExecutionStore.go 16 59.54%
Totals Coverage Status
Change from base Build 43038319-4203-497d-8795-db6211790382: 0.03%
Covered Lines: 89923
Relevant Lines: 149445

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants