Remove outdated NotesMigrationSchemaFactory comments

Change-Id: I3d19cfdb41f87514bca59cf5c31644e093058c58
This commit is contained in:
Dave Borowitz
2018-12-14 15:13:11 -08:00
parent d771413ead
commit 63a175e481

View File

@@ -28,40 +28,10 @@ public class NotesMigrationSchemaFactory implements SchemaFactory<ReviewDb> {
@Override
public ReviewDb open() throws OrmException {
// There are two levels at which this class disables access to Changes and related tables,
// corresponding to two phases of the NoteDb migration:
//
// 1. When changes are read from NoteDb but some changes might still have their primary storage
// in ReviewDb, it is generally programmer error to read changes from ReviewDb. However,
// since ReviewDb is still the primary storage for most or all changes, we still need to
// support writing to ReviewDb. This behavior is accomplished by wrapping in a
// DisallowedReviewDb.
//
// Some codepaths might need to be able to read from ReviewDb if they really need to,
// because they need to operate on the underlying source of truth, for example when reading
// a change to determine its primary storage. To support this, ReviewDbUtil#unwrapDb can
// detect and unwrap databases of this type.
//
// 2. After all changes have their primary storage in NoteDb, we can completely shut off access
// to the change tables. At this point in the migration, we are by definition not using the
// ReviewDb tables at all; we could even delete the tables at this point, and Gerrit would
// continue to function.
//
// This is accomplished by setting the delegate ReviewDb *underneath*
// DisallowReadFromChanges to be a complete no-op, with NoChangesReviewDb. With this
// stub implementation, all read operations return no results, and write operations silently
// do nothing. This implementation is not a public class and callers couldn't do anything
// useful with it even if it were.
// Disable writes to change tables in ReviewDb (ReviewDb access for changes are No-Ops); all
// other table accesses throw runtime exceptions.
// TODO(dborowitz): This class is purely vestigial, and documenting the historical reasons for
// this specific behavior is not worth it. Remove this class instead.
ReviewDb db = new NoChangesReviewDb();
// Second create the wrappers which can be removed by ReviewDbUtil#unwrapDb(ReviewDb).
// ReviewDb is no longer supported, make sure that any attempt to read a change from ReviewDb
// anyway fails with an exception.
db = new DisallowedReviewDb(db);
return db;
}
}