aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-12-15 14:52:38 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-12-16 14:35:28 +0100
commitfb123dc62f66e87792652dec81dfa1bb6422d24c (patch)
treeff9378d1a33bdc9003909dbad3d56f8a0572d5a6 /server
parent1af4105f69b467eca5233c164752923fce021884 (diff)
downloadsonarqube-fb123dc62f66e87792652dec81dfa1bb6422d24c.tar.gz
sonarqube-fb123dc62f66e87792652dec81dfa1bb6422d24c.zip
SONAR-8445 move DatabaseVersion to level2
also moved DatabaseServerCompatibility which depends on it
Diffstat (limited to 'server')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java5
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java10
4 files changed, 13 insertions, 10 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
index 4bc68e4546c..8ca295e95aa 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
@@ -222,8 +222,6 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer {
// must instantiate deprecated class in 5.2 and only this one (and not its replacement)
// to avoid having two SqlSessionFactory instances
org.sonar.core.persistence.MyBatis.class,
- DatabaseServerCompatibility.class,
- DatabaseVersion.class,
PurgeProfiler.class,
ServerFileSystemImpl.class,
new TempFolderProvider(),
@@ -253,6 +251,9 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer {
private static Object[] level2Components() {
return new Object[] {
+ DatabaseVersion.class,
+ DatabaseServerCompatibility.class,
+
DatabaseSettingLoader.class,
DatabaseSettingsEnabler.class,
UrlSettings.class,
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
index b17c2a2d183..6b915dd5648 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
@@ -101,11 +101,11 @@ public class ComputeEngineContainerImplTest {
);
assertThat(picoContainer.getParent().getParent().getComponentAdapters()).hasSize(
CONTAINER_ITSELF
- + 14 // level 2
+ + 16 // level 2
);
assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(
COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION
- + 27 // level 1
+ + 25 // level 1
+ 48 // content of DaoModule
+ 2 // content of EsSearchModule
+ 63 // content of CorePropertyDefinitions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
index 7bc4c362646..583ce633d84 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
@@ -36,13 +36,11 @@ import org.sonar.db.DbClient;
import org.sonar.db.DefaultDatabase;
import org.sonar.db.purge.PurgeProfiler;
import org.sonar.db.semaphore.SemaphoresImpl;
-import org.sonar.db.version.DatabaseVersion;
import org.sonar.process.logging.LogbackHelper;
import org.sonar.server.app.ProcessCommandWrapperImpl;
import org.sonar.server.app.RestartFlagHolderImpl;
import org.sonar.server.app.WebServerProcessLogging;
import org.sonar.server.issue.index.IssueIndex;
-import org.sonar.server.platform.DatabaseServerCompatibility;
import org.sonar.server.platform.LogServerVersion;
import org.sonar.server.platform.Platform;
import org.sonar.server.platform.ServerFileSystemImpl;
@@ -94,8 +92,6 @@ public class PlatformLevel1 extends PlatformLevel {
// must instantiate deprecated class in 5.2 and only this one (and not its replacement)
// to avoid having two SqlSessionFactory instances
org.sonar.core.persistence.MyBatis.class,
- DatabaseServerCompatibility.class,
- DatabaseVersion.class,
PurgeProfiler.class,
ServerFileSystemImpl.class,
SemaphoresImpl.class,
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java
index 0dbcb46be64..a3bb6fc8fa7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel2.java
@@ -24,6 +24,8 @@ import org.sonar.core.i18n.DefaultI18n;
import org.sonar.core.i18n.RuleI18nManager;
import org.sonar.core.platform.PluginClassloaderFactory;
import org.sonar.core.platform.PluginLoader;
+import org.sonar.db.version.DatabaseVersion;
+import org.sonar.server.platform.DatabaseServerCompatibility;
import org.sonar.server.platform.DefaultServerUpgradeStatus;
import org.sonar.server.platform.StartupMetadataProvider;
import org.sonar.server.platform.db.CheckDatabaseCharsetAtStartup;
@@ -47,6 +49,9 @@ public class PlatformLevel2 extends PlatformLevel {
@Override
protected void configureLevel() {
add(
+ DatabaseVersion.class,
+ DatabaseServerCompatibility.class,
+
new StartupMetadataProvider(),
DefaultServerUpgradeStatus.class,
Durations.class,
@@ -68,12 +73,13 @@ public class PlatformLevel2 extends PlatformLevel {
DefaultI18n.class,
RuleI18nManager.class);
- // DB Migration framework dependencies required at level2
- addIfStartupLeader(MigrationHistoryTableImpl.class);
+ // Migration state must be kept at level2 to survive moving in and then out of safe mode
+ // ExecutorService must be kept at level2 because stopping it when stopping safe mode level causes error making SQ fail
add(DatabaseMigrationStateImpl.class,
DatabaseMigrationExecutorServiceImpl.class);
addIfStartupLeader(
+ MigrationHistoryTableImpl.class,
DatabaseCharsetChecker.class,
CheckDatabaseCharsetAtStartup.class);
}