CPh*_*lps 6 postgresql maven flyway
我正在尝试对Postgres 9.2数据库运行CREATE INDEX CONCURRENTLY命令.我实现了MigrationResolver,如问题655所示.当此迁移步骤通过mvn flyway:migrate或类似运行时,该命令将启动但在等待模式下挂起.
我验证了该命令是通过pg_stat_activity表执行的:
test_2015_04_13_110536=# select * from pg_stat_activity;
datid | datname | pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | xact_start | query_start | state_change | waiting | state | query
-------+------------------------+-------+----------+----------+------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+---------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
21095 | test_2015_04_13_110536 | 56695 | 16385 | postgres | psql | | | -1 | 2015-04-13 11:10:01.127768-06 | 2015-04-13 11:13:08.936651-06 | 2015-04-13 11:13:08.936651-06 | 2015-04-13 11:13:08.936655-06 | f | active | select * from pg_stat_activity;
21095 | test_2015_04_13_110536 | 56824 | 16385 | postgres | | 127.0.0.1 | | 52437 | 2015-04-13 11:12:55.438927-06 | 2015-04-13 11:12:55.476442-06 | 2015-04-13 11:12:55.487139-06 | 2015-04-13 11:12:55.487175-06 | f | idle in transaction | SELECT "version_rank","installed_rank","version","description","type","script","checksum","installed_on","installed_by","execution_time","success" FROM "public"."schema_version" ORDER BY "version_rank"
21095 | test_2015_04_13_110536 | 56825 | 16385 | postgres | | 127.0.0.1 | | 52438 | 2015-04-13 11:12:55.443687-06 | 2015-04-13 11:12:55.49024-06 | 2015-04-13 11:12:55.49024-06 | 2015-04-13 11:12:55.490241-06 | t | active | CREATE UNIQUE INDEX CONCURRENTLY person_restrict_duplicates_2_idx ON person(name, person_month, person_year)
(3 rows)
Run Code Online (Sandbox Code Playgroud)
可以在我的github中找到复制此问题的示例项目:chrisphelps/flyway-experiment
我怀疑是飞路查询针对schema version该idle in transaction阻止的Postgres从索引创建进行.
如何解决冲突,以便postgres继续进行迁移?有没有人能够通过flyway将这种迁移应用到postgres?
| 归档时间: |
|
| 查看次数: |
1817 次 |
| 最近记录: |