Merge "Stop creating the entire SchemaVersion chain at runtime"

This commit is contained in:
Shawn Pearce
2015-01-05 21:20:01 +00:00
committed by Gerrit Code Review
9 changed files with 59 additions and 73 deletions

View File

@@ -74,7 +74,6 @@ public class SchemaUpdaterTest {
protected void configure() {
bind(new TypeLiteral<SchemaFactory<ReviewDb>>() {}).toInstance(db);
bind(SitePaths.class).toInstance(paths);
install(new SchemaVersion.Module());
Config cfg = new Config();
cfg.setString("user", null, "name", "Gerrit Code Review");

View File

@@ -67,7 +67,6 @@ public class InMemoryDatabase implements SchemaFactory<ReviewDb> {
}
}
private final SchemaVersion schemaVersion;
private final SchemaCreator schemaCreator;
private Connection openHandle;
@@ -75,9 +74,7 @@ public class InMemoryDatabase implements SchemaFactory<ReviewDb> {
private boolean created;
@Inject
InMemoryDatabase(SchemaVersion schemaVersion,
SchemaCreator schemaCreator) throws OrmException {
this.schemaVersion = schemaVersion;
InMemoryDatabase(SchemaCreator schemaCreator) throws OrmException {
this.schemaCreator = schemaCreator;
try {
@@ -161,6 +158,6 @@ public class InMemoryDatabase implements SchemaFactory<ReviewDb> {
public void assertSchemaVersion() throws OrmException {
final CurrentSchemaVersion act = getSchemaVersion();
assertEquals(schemaVersion.getVersionNbr(), act.versionNbr);
assertEquals(SchemaVersion.getBinaryVersion(), act.versionNbr);
}
}

View File

@@ -48,10 +48,8 @@ import com.google.gerrit.server.index.ChangeSchemas;
import com.google.gerrit.server.index.IndexModule.IndexType;
import com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier;
import com.google.gerrit.server.mail.SmtpEmailSender;
import com.google.gerrit.server.schema.Current;
import com.google.gerrit.server.schema.DataSourceType;
import com.google.gerrit.server.schema.SchemaCreator;
import com.google.gerrit.server.schema.SchemaVersion;
import com.google.gerrit.server.securestore.DefaultSecureStore;
import com.google.gerrit.server.securestore.SecureStore;
import com.google.gerrit.server.ssh.NoSshKeyCache;
@@ -127,8 +125,6 @@ public class InMemoryModule extends FactoryModule {
bindScope(RequestScoped.class, PerThreadRequestScope.REQUEST);
install(new SchemaVersion.Module());
bind(File.class).annotatedWith(SitePath.class).toInstance(new File("."));
bind(Config.class).annotatedWith(GerritServerConfig.class).toInstance(cfg);
bind(SocketAddress.class).annotatedWith(RemotePeer.class).toInstance(
@@ -197,9 +193,9 @@ public class InMemoryModule extends FactoryModule {
@Provides
@Singleton
InMemoryDatabase getInMemoryDatabase(@Current SchemaVersion schemaVersion,
SchemaCreator schemaCreator) throws OrmException {
return new InMemoryDatabase(schemaVersion, schemaCreator);
InMemoryDatabase getInMemoryDatabase(SchemaCreator schemaCreator)
throws OrmException {
return new InMemoryDatabase(schemaCreator);
}
private Module luceneIndexModule() {