diff --git a/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java b/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java index 01180b0..50d9ca3 100644 --- a/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java +++ b/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBDatabase.java @@ -77,18 +77,9 @@ public String getRawCreateScript(Table table, boolean baseline) { "CREATE INDEX IF NOT EXISTS \"" + table.getName() + "_s_idx\" ON " + table + " (\"success\");"; } - /** - * YugabyteDB does not support PG Advisor Locks. So the YugabyteDB plugin - * employs SELECT ... FOR UPDATE in a transaction to implement locking for - * Flyway operations instead of the PG Advisory locks. If a single - * connection is used, it may cause issues if multiple threads execute - * begin/commit on it for Flyway operations. Returning false from this - * method ensures the same connection is not used for migrations. - * @return false - */ @Override public boolean useSingleConnection() { - return false; + return true; } private void createLockTable() { diff --git a/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBExecutionTemplate.java b/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBExecutionTemplate.java index 7a08f9b..920b487 100644 --- a/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBExecutionTemplate.java +++ b/flyway-database-yugabytedb/src/main/java/org/flywaydb/community/database/postgresql/yugabytedb/YugabyteDBExecutionTemplate.java @@ -8,16 +8,16 @@ import org.flywaydb.core.internal.util.FlywayDbWebsiteLinks; import java.sql.*; -import java.util.HashMap; +import java.util.Map; import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; @CustomLog public class YugabyteDBExecutionTemplate { private final JdbcTemplate jdbcTemplate; private final String tableName; - private final HashMap tableEntries = new HashMap<>(); - + private static final Map tableEntries = new ConcurrentHashMap<>(); YugabyteDBExecutionTemplate(JdbcTemplate jdbcTemplate, String tableName) { this.jdbcTemplate = jdbcTemplate;