Extract an interface to replace ChangeBundle#fromReviewDb
Unfortunately due to a quirk of our googlesource.com implementation, we can't provide a strong enough consistency guarantee when reading a change's sub-entities inside of a beginTransaction block, so we need to provide a hand-written implementation. For a gwtorm-backed implementation, beginTransaction is likely good enough, although the actual semantics are still dependent on the underlying database's isolation level. If this code were going to stay around for longer and see more production use, we might see more implementations, but that is almost certainly more trouble than it's worth. Change-Id: I27aa35d95b9a4eab3178518065b0cab8823feb4e
This commit is contained in:
@@ -27,6 +27,8 @@ import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gerrit.server.config.TrackingFooters;
|
||||
import com.google.gerrit.server.config.TrackingFootersProvider;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.notedb.ChangeBundleReader;
|
||||
import com.google.gerrit.server.notedb.GwtormChangeBundleReader;
|
||||
import com.google.gerrit.server.notedb.NotesMigration;
|
||||
import com.google.gerrit.server.schema.DataSourceType;
|
||||
import com.google.gerrit.server.schema.NotesMigrationSchemaFactory;
|
||||
@@ -89,6 +91,7 @@ class InMemoryTestingDatabaseModule extends LifecycleModule {
|
||||
bind(Key.get(schemaFactory, ReviewDbFactory.class))
|
||||
.to(InMemoryDatabase.class);
|
||||
bind(InMemoryDatabase.class).in(SINGLETON);
|
||||
bind(ChangeBundleReader.class).to(GwtormChangeBundleReader.class);
|
||||
|
||||
listener().to(CreateDatabase.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user