diff --git a/mysql-persistence/dependencies.lock b/mysql-persistence/dependencies.lock index 355189e1f2..58d65d8112 100644 --- a/mysql-persistence/dependencies.lock +++ b/mysql-persistence/dependencies.lock @@ -232,8 +232,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -498,8 +498,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -764,8 +764,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -1093,8 +1093,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -1359,8 +1359,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -1662,8 +1662,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -2085,8 +2085,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -2508,8 +2508,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -2931,8 +2931,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", diff --git a/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLConfiguration.java b/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLConfiguration.java index 3776fdd5f2..1625c9d00a 100644 --- a/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLConfiguration.java +++ b/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLConfiguration.java @@ -2,7 +2,7 @@ import com.netflix.conductor.core.config.Configuration; -import java.util.Optional; + import java.util.concurrent.TimeUnit; public interface MySQLConfiguration extends Configuration { @@ -20,7 +20,7 @@ public interface MySQLConfiguration extends Configuration { boolean FLYWAY_ENABLED_DEFAULT_VALUE = true; String FLYWAY_TABLE_PROPERTY_NAME = "flyway.table"; - Optional FLYWAY_TABLE_DEFAULT_VALUE = Optional.empty(); + String FLYWAY_TABLE_DEFAULT_VALUE = "schema_version"; // The defaults are currently in line with the HikariConfig defaults, which are unfortunately private. String CONNECTION_POOL_MAX_SIZE_PROPERTY_NAME = "conductor.mysql.connection.pool.size.max"; @@ -61,8 +61,8 @@ default boolean isFlywayEnabled() { return getBoolProperty(FLYWAY_ENABLED_PROPERTY_NAME, FLYWAY_ENABLED_DEFAULT_VALUE); } - default Optional getFlywayTable() { - return Optional.ofNullable(getProperty(FLYWAY_TABLE_PROPERTY_NAME, null)); + default String getFlywayTable() { + return getProperty(FLYWAY_TABLE_PROPERTY_NAME, FLYWAY_TABLE_DEFAULT_VALUE); } default int getConnectionPoolMaxSize() { diff --git a/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLDataSourceProvider.java b/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLDataSourceProvider.java index 85a3fdc922..57f181dac9 100644 --- a/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLDataSourceProvider.java +++ b/mysql-persistence/src/main/java/com/netflix/conductor/mysql/MySQLDataSourceProvider.java @@ -4,6 +4,7 @@ import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.configuration.FluentConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,16 +68,15 @@ private void flywayMigrate(DataSource dataSource) { logger.debug("Flyway migrations are disabled"); return; } + String flywayTable = configuration.getFlywayTable(); + logger.debug("Using Flyway migration table '{}'", flywayTable); + FluentConfiguration flywayConfiguration = Flyway.configure() + .table(flywayTable) + .dataSource(dataSource) + .placeholderReplacement(false); - Flyway flyway = new Flyway(); - configuration.getFlywayTable().ifPresent(tableName -> { - logger.debug("Using Flyway migration table '{}'", tableName); - flyway.setTable(tableName); - }); - - flyway.setDataSource(dataSource); - flyway.setPlaceholderReplacement(false); + Flyway flyway = flywayConfiguration.load(); flyway.migrate(); } } diff --git a/mysql-persistence/src/test/java/com/netflix/conductor/dao/mysql/MySQLDAOTestUtil.java b/mysql-persistence/src/test/java/com/netflix/conductor/dao/mysql/MySQLDAOTestUtil.java index 31d08177bf..91b4c55970 100644 --- a/mysql-persistence/src/test/java/com/netflix/conductor/dao/mysql/MySQLDAOTestUtil.java +++ b/mysql-persistence/src/test/java/com/netflix/conductor/dao/mysql/MySQLDAOTestUtil.java @@ -72,9 +72,12 @@ private HikariDataSource getDataSource(Configuration config) { private void flywayMigrate(DataSource dataSource) { - Flyway flyway = new Flyway(); - flyway.setDataSource(dataSource); - flyway.setPlaceholderReplacement(false); + Flyway flyway = Flyway.configure() + .dataSource(dataSource) + .table("schema_version") + .placeholderReplacement(false) + .load(); + flyway.migrate(); } diff --git a/postgres-persistence/dependencies.lock b/postgres-persistence/dependencies.lock index 030fdb2178..3100811ec2 100644 --- a/postgres-persistence/dependencies.lock +++ b/postgres-persistence/dependencies.lock @@ -227,8 +227,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -492,8 +492,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -757,8 +757,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -1085,8 +1085,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -1350,8 +1350,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -1652,8 +1652,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -2074,8 +2074,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -2496,8 +2496,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", @@ -2918,8 +2918,8 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", - "requested": "4.0.3" + "locked": "7.5.2", + "requested": "7.5.2" }, "org.glassfish:javax.el": { "locked": "3.0.0", diff --git a/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresConfiguration.java b/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresConfiguration.java index b1fd3fabc4..d29c60a376 100644 --- a/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresConfiguration.java +++ b/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresConfiguration.java @@ -14,7 +14,6 @@ import com.netflix.conductor.core.config.Configuration; -import java.util.Optional; import java.util.concurrent.TimeUnit; public interface PostgresConfiguration extends Configuration { @@ -32,7 +31,7 @@ public interface PostgresConfiguration extends Configuration { boolean FLYWAY_ENABLED_DEFAULT_VALUE = true; String FLYWAY_TABLE_PROPERTY_NAME = "flyway.table"; - Optional FLYWAY_TABLE_DEFAULT_VALUE = Optional.empty(); + String FLYWAY_TABLE_DEFAULT_VALUE = "schema_version"; // The defaults are currently in line with the HikariConfig defaults, which are unfortunately private. String CONNECTION_POOL_MAX_SIZE_PROPERTY_NAME = "conductor.postgres.connection.pool.size.max"; @@ -73,8 +72,8 @@ default boolean isFlywayEnabled() { return getBoolProperty(FLYWAY_ENABLED_PROPERTY_NAME, FLYWAY_ENABLED_DEFAULT_VALUE); } - default Optional getFlywayTable() { - return Optional.ofNullable(getProperty(FLYWAY_TABLE_PROPERTY_NAME, null)); + default String getFlywayTable() { + return getProperty(FLYWAY_TABLE_PROPERTY_NAME, FLYWAY_TABLE_DEFAULT_VALUE); } default int getConnectionPoolMaxSize() { diff --git a/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresDataSourceProvider.java b/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresDataSourceProvider.java index 06a85a270c..47bce1c5a4 100644 --- a/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresDataSourceProvider.java +++ b/postgres-persistence/src/main/java/com/netflix/conductor/postgres/PostgresDataSourceProvider.java @@ -16,6 +16,7 @@ import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.configuration.FluentConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,17 +81,16 @@ private void flywayMigrate(DataSource dataSource) { logger.debug("Flyway migrations are disabled"); return; } + String flywayTable = configuration.getFlywayTable(); + logger.debug("Using Flyway migration table '{}'", flywayTable); + FluentConfiguration flywayConfiguration = Flyway.configure() + .table(flywayTable) + .locations(Paths.get("db","migration_postgres").toString()) + .dataSource(dataSource) + .placeholderReplacement(false); - Flyway flyway = new Flyway(); - configuration.getFlywayTable().ifPresent(tableName -> { - logger.debug("Using Flyway migration table '{}'", tableName); - flyway.setTable(tableName); - }); - - flyway.setLocations(Paths.get("db","migration_postgres").toString()); - flyway.setDataSource(dataSource); - flyway.setPlaceholderReplacement(false); + Flyway flyway = flywayConfiguration.load(); flyway.migrate(); } } diff --git a/postgres-persistence/src/test/java/com/netflix/conductor/dao/postgres/PostgresDAOTestUtil.java b/postgres-persistence/src/test/java/com/netflix/conductor/dao/postgres/PostgresDAOTestUtil.java index d34c8eed88..bfa1fb07a1 100644 --- a/postgres-persistence/src/test/java/com/netflix/conductor/dao/postgres/PostgresDAOTestUtil.java +++ b/postgres-persistence/src/test/java/com/netflix/conductor/dao/postgres/PostgresDAOTestUtil.java @@ -18,6 +18,7 @@ import com.netflix.conductor.core.config.Configuration; import com.zaxxer.hikari.HikariDataSource; import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.configuration.FluentConfiguration; import org.postgresql.ds.PGSimpleDataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,11 +75,15 @@ private HikariDataSource getDataSource(Configuration config) { private void flywayMigrate(DataSource dataSource) { - Flyway flyway = new Flyway(); - flyway.setLocations(Paths.get("db","migration_postgres").toString()); - flyway.setDataSource(dataSource); - flyway.setPlaceholderReplacement(false); + FluentConfiguration flywayConfiguration = Flyway.configure() + .table("schema_version") + .locations(Paths.get("db","migration_postgres").toString()) + .dataSource(dataSource) + .placeholderReplacement(false); + + Flyway flyway = flywayConfiguration.load(); flyway.migrate(); + } public HikariDataSource getDataSource() { diff --git a/postgres-persistence/src/test/java/com/netflix/conductor/performance/PerformanceTest.java b/postgres-persistence/src/test/java/com/netflix/conductor/performance/PerformanceTest.java index 2d6bec3d3a..21283465cb 100644 --- a/postgres-persistence/src/test/java/com/netflix/conductor/performance/PerformanceTest.java +++ b/postgres-persistence/src/test/java/com/netflix/conductor/performance/PerformanceTest.java @@ -36,6 +36,7 @@ import javax.sql.DataSource; import org.flywaydb.core.Flyway; import org.flywaydb.core.api.FlywayException; +import org.flywaydb.core.api.configuration.FluentConfiguration; import org.junit.After; import org.junit.Before; import org.junit.Ignore; @@ -447,10 +448,15 @@ private List getRandomMessages(int i) { } private void flywayMigrate(DataSource dataSource) { - Flyway flyway = new Flyway(); - flyway.setDataSource(dataSource); - flyway.setPlaceholderReplacement(false); - flyway.setLocations(Paths.get("db", "migration_postgres").toString()); + + FluentConfiguration flywayConfiguration = Flyway.configure() + .table(configuration.getFlywayTable()) + .locations(Paths.get("db","migration_postgres").toString()) + .dataSource(dataSource) + .placeholderReplacement(false); + + Flyway flyway = flywayConfiguration.load(); + try { flyway.migrate(); } catch (FlywayException e) { diff --git a/server/dependencies.lock b/server/dependencies.lock index f57c239fa6..ff857664b7 100644 --- a/server/dependencies.lock +++ b/server/dependencies.lock @@ -1520,7 +1520,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -3266,7 +3266,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -5012,7 +5012,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -6758,7 +6758,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -9572,7 +9572,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -11318,7 +11318,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -13031,7 +13031,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -14788,7 +14788,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -16556,7 +16556,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -18324,7 +18324,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -20092,7 +20092,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -20358,4 +20358,4 @@ ] } } -} \ No newline at end of file +} diff --git a/test-harness/dependencies.lock b/test-harness/dependencies.lock index 02134202d1..024932ad5d 100644 --- a/test-harness/dependencies.lock +++ b/test-harness/dependencies.lock @@ -1756,7 +1756,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -3747,7 +3747,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -5738,7 +5738,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -7729,7 +7729,7 @@ ] }, "org.flywaydb:flyway-core": { - "locked": "4.0.3", + "locked": "7.5.2", "transitive": [ "com.netflix.conductor:conductor-mysql-persistence", "com.netflix.conductor:conductor-postgres-persistence" @@ -8026,4 +8026,4 @@ ] } } -} \ No newline at end of file +} diff --git a/versionsOfDependencies.gradle b/versionsOfDependencies.gradle index 35fac1bcc5..e66aff4e43 100644 --- a/versionsOfDependencies.gradle +++ b/versionsOfDependencies.gradle @@ -16,7 +16,7 @@ ext { revElasticSearch6 = '6.8.12' revElasticSearch7 = '7.10.1' revEurekaClient = '1.8.7' - revFlywayCore ='4.0.3' + revFlywayCore ='7.5.2' revGrpc = '1.14.+' revGuavaRetrying = '2.0.0' revGuice = '4.1.0'