bagostuff: optimize SqlBagOStuff and fix failing segmentation tests
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 29 Jun 2019 17:26:37 +0000 (10:26 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 10 Jul 2019 05:53:18 +0000 (22:53 -0700)
commit20a9c8d24ed85238b0a79cecf68a2a6b949457a5
tree90926813f7a815905a633ce8dd23a5e420761b6a
parent8763879da660e66038686da0fa63125988589db9
bagostuff: optimize SqlBagOStuff and fix failing segmentation tests

In SqlBagOStuff:
* Add modifyMulti() helper method to reduce code duplication
* Improve atomicity of add(), cas(), and changeTTL() queries
* Avoid integer serialization and improve atomicity of incr()
* Optimize new BagOStuff::changeTTLMulti() method

In BagOStuff:
* Add changeTTLMulti() method for subclasses to optimize
* Make set() ignore WRITE_ALLOW_SEGMENTS for integers so incr() works
* Strip WRITE_ALLOW_SEGMENTS flag from the setMulti() call in set() to
  avoid triggering bogus sanity check exceptions
* Fix BagOStuffTest::testSetSegmentable failures via the above changes
* Enforce WRITE_ALLOW_SEGMENTS sanity check in setMulti() for all the
  subclasses by using a final wrapper method
* Add WRITE_ALLOW_SEGMENTS sanity check to deleteMulti()

Bug: T113916
Change-Id: I25d1790fa9b0d1837643efccfa94a12043cfbf42
includes/libs/objectcache/BagOStuff.php
includes/libs/objectcache/MemcachedPeclBagOStuff.php
includes/libs/objectcache/MemcachedPhpBagOStuff.php
includes/libs/objectcache/MultiWriteBagOStuff.php
includes/libs/objectcache/RedisBagOStuff.php
includes/libs/objectcache/ReplicatedBagOStuff.php
includes/objectcache/SqlBagOStuff.php
tests/phpunit/includes/libs/objectcache/BagOStuffTest.php