Test conversion of corrupt changes with GERRIT_CHECK_NOTEDB

ConsistencyCheckerIT creates various kinds of corrupt changes that we
think might exist in the wild. In most cases, the right thing to do
when converting these changes is to do our best and store *something*
in NoteDb, even if it can't be successfully read back. At the very
least this allows admins to go in and manually edit the change, using
interactive rebase in the same way they might poke the SQL database
today. This is preferable to throwing the data away during conversion.

The one time we can't do this is when the change belongs to a deleted
project. For now, we actually just discard these changes.

Rework the NoteDbChecker loops so that we attempt to convert all
changes before checking any. This doesn't make ConsistencyCheckerIT
pass, but it does let us verify from the stack trace that all
conversions were successful, even though changes couldn't be read
back.

Change-Id: I87caa451db4e049fa3fc494b79c6c036fba36b1a
This commit is contained in:
Dave Borowitz
2016-03-10 14:19:16 -05:00
parent a9a99130cf
commit 2443905d17
5 changed files with 66 additions and 10 deletions

View File

@@ -73,6 +73,9 @@ public class ConsistencyCheckerIT extends AbstractDaemonTest {
@Before
public void setUp() throws Exception {
// TODO(dborowitz): Re-enable when ConsistencyChecker supports notedb.
// Note that we *do* want to enable these tests with GERRIT_CHECK_NOTEDB, as
// we need to be able to convert old, corrupt changes. However, those tests
// don't necessarily need to pass.
assume().that(notesMigration.enabled()).isFalse();
// Ignore client clone of project; repurpose as server-side TestRepository.
testRepo = new TestRepository<>(