Commit graph

3 commits

Author SHA1 Message Date
Tim Starling
3cabe8bf8a SqlBagOStuff: Fix modtoken comparison
String offsets in MariaDB are 1-based, except in "Oracle compatible"
mode. SUBSTR(modtoken,0,13) was always the empty string and so the
modtoken comparison was always true. I was able to reproduce a failure
to reach consistency using ring replication.

Add regression test.

Bug: T315271
Change-Id: I74e54e8aba44505dd04426c12d91a9ea0de17f22
2022-08-19 11:11:58 +10:00
Tim Starling
bcfb90cdd7 objectcache: Simplify SqlBagOStuff class configuration
Substantive changes:

* Remove the parameters globalKeyLB and localKeyLB, not needed in
  production, probably not used anywhere.
* Add a "cluster" parameter, for production.
* Don't call markServerDown() in LoadBalancer mode.

Style changes:

* Document config parameters separately from constructor parameters, to
  clarify the role of the wiring normalisation.
* Inject a load balancer from ObjectCache to SqlBagOStuff, using a
  closure to defer construction.
* Clarify the split between LoadBalancer mode and server array mode by
  introducing a useLB property. Use it instead of special shard index
  values and array counts.
* multiPrimaryModeType wasn't needed anywhere and wasn't available in
  the constructor, so it just became a boolean multiPrimaryMode.
* Add a test covering most of the server array (!useLB) branches.

Bug: T212129
Change-Id: Ib097082efb40b514a29a42286dc362f2e3743ee4
2022-05-27 15:04:43 +00:00
Aaron Schulz
cc1bb73490 objectcache: remove "multiPrimaryMode" DB type assertion
Since no mysql-specific queries are required, allow sqlite and
Postgres setups to use "multiPrimaryMode" for easier testing.

Avoid "CASE types text and integer cannot be matched" Postgres
error by making dbEncodeSerialValue() cast the result to a string
so that addQuotes() applies in buildUpsertSetForOverwrite().

Bug: T212129
Change-Id: Ic84a804c272a7070779c8d41d3a33003852d0839
2022-04-21 16:20:39 -07:00
Renamed from tests/phpunit/includes/objectcache/SqlBagOStuffMultiMysqlIntegrationTest.php (Browse further)