Fix undeletion write-both/read-old mode.
authordaniel <daniel.kinzler@wikimedia.de>
Mon, 27 Aug 2018 19:45:40 +0000 (21:45 +0200)
committerDaniel Kinzler <daniel.kinzler@wikimedia.de>
Mon, 10 Sep 2018 19:36:27 +0000 (19:36 +0000)
commitf5b7a93979487d09a81d7e3262b7aec08d8165d0
tree91fccdbe86523ad967f201d015e912efd7fc316a
parent87dd9db226dd94a1691ecffcb35fb604d42c25af
Fix undeletion write-both/read-old mode.

With the new schema, undeletion does not create now slot rows.
However, when in read-old mode, we may still have un-migrated
archive rows. When undeletion based on such a row, we do need
to insert a slot row.

This also changes the return value of SlotRecord for
SCHEMA_COMPAT_READ_OLD mode from null to the negative value of
rev_text_id, for consistency. Conceptually, the emulated slots
in SCHEMA_COMPAT_OLD now have a "virtual" content ID, hich is
 however distinct from any real content ID that may exist in
the future. Such virtual content IDs are however not assigned
in SCHEMA_COMPAT_WRITE_BOTH mode. In that mode, unmigrated
rows can be detected by calling hasContentId() on the main
slot. Migrated rows will return true here and provide the
id of the associated content row, even in
SCHEMA_COMPAT_READ_OLD mode. This is particularly essential
for undeletion, which needs to maintain the association
between revision and slot rows even in SCHEMA_COMPAT_READ_OLD
mode.

Bug: T174024
Bug: T194015
Bug: T183488
Change-Id: I88ee9809b9752e1e72d635d62e82008315402901
includes/Storage/RevisionStore.php
includes/Storage/SlotRecord.php
tests/phpunit/includes/Storage/McrWriteBothRevisionStoreDbTest.php
tests/phpunit/includes/Storage/RevisionStoreDbTestBase.php