This case was explicitly handled by ChangeRebuilderImpl, and
NoteDbMigrator in fact caught NoPatchSetsException and let the migration
proceed. Unfortunately, this would then cause the primary storage
migration step to fail with:
com.google.gwtorm.server.OrmRuntimeException: change X has no note_db_state; rebuild it first
Work around this by catching this exception and checking after the fact
whether the change is known to be unrecoverably corrupt. In theory this
is still racy, but if the change is in fact corrupt, then we just assume
nobody is concurrently writing to it, because they wouldn't be able to
read it in the first place.
Bug: Issue 8445
Change-Id: I0439c7fc8e52f013b22e416dc9136f976d4a085a