rdbms: make DBMasterPos implement Serializable
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Feb 2018 03:23:19 +0000 (19:23 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Feb 2018 20:46:28 +0000 (12:46 -0800)
commit26d87a26fee1b6e66e221c4452a9f1d23cc003b6
tree2868ebf1f9419da36c7fa8986910b2ef703cf46e
parent5ca659b287a1ef7755729de60c1bcc5ff4a79c76
rdbms: make DBMasterPos implement Serializable

ChronologyProtector uses these classes to briefly store positions
and everytime the fields change then errors can happen when old
values are unserialized and used. Use a simple two-element map
format for serialized positions. The fields are recomputed back
from the data map.

Values from before this change will issue the warning
"Erroneous data format for unserializing". To avoid that, bump
the ChronologyProtector key version. Future field changes will
not require this.

This change should be deployed on all wikis at once.

Bug: T187942
Change-Id: I71bbbc9b9d4c7e02ac02f1d8750b70bda08d4db1
includes/libs/rdbms/ChronologyProtector.php
includes/libs/rdbms/database/position/DBMasterPos.php
includes/libs/rdbms/database/position/MySQLMasterPos.php
tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php