quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

Flyway transactional lock property #28502

Closed OleKsimov closed 1 year ago

OleKsimov commented 2 years ago

Description

Please consider adding new Flyway property to Quarkus configuration with default value set to "false" A discussion about this property and issue with its current default (true) value can be found here

Implementation ideas

No response

quarkus-bot[bot] commented 2 years ago

/cc @cristhiank, @gastaldi, @geoand, @gsmet

OleKsimov commented 2 years ago

This feature request is based on this issue

geoand commented 2 years ago

So this is a postgresql specific configuration?

OleKsimov commented 2 years ago

I believe it's Flyway-specific property to choose what lock should be used: session or transactional. I would say some problems with default value (true = transactional advisory locks) appear because of Agroal connection pooling implementation. You can find a reproducer in the issue I mentioned before.

geoand commented 2 years ago

Yeah, but my point is that in Flyway this property seems to be PostgreSQL specific.

OleKsimov commented 2 years ago

Yeah, you are right, it is obviously Postgres configuration property only.

Philipp-Borchert-ISH commented 2 years ago

I think this could be a blocker issue for some people running quarkus-flyway + postgres. As described in the links to flyway docs with "out of the box" flyway you can bypass this by setting a system property, however that doesn't seem to work with quarkus-flyway because there is no call to FluentConfiguration::configuration or ClassicConfiguration::configure from FlywayCreator::createFlyway.

I've tested setting the system property for dev mode / test lifecycle via maven configuration (quarkus-maven-plugin/configuration/systemProperties + maven-surefire-plugin/configuration/systemPropertyVariable) but that doesn't work due to the way the config is loaded in quarkus-flyway, i don't think there is any alternative workaround other than not upgrading quarkus :-(

geoand commented 2 years ago

Yeah, I think we'll need to provide the property. Do you agree @gsmet @gastaldi ?

gsmet commented 2 years ago

Yup. Sounds like a good opportunity for a pull request :)

gastaldi commented 2 years ago

+1, this would be nice to have

geoand commented 2 years ago

I've added the good first issue tag for anyone that wants to pick it up.

gsmet commented 2 years ago

My advice would be to add a postgresql config group then a property inside it to mimic the Flyway structure and be ready in case they add more.

jcsim1024 commented 2 years ago

Hi @geoand If it's not already taken care of, could I give this a try ?

geoand commented 2 years ago

@jcsim1024 go right ahead!

gsmet commented 2 years ago

@jcsim1024 have a look at this comment before starting your work: https://github.com/quarkusio/quarkus/issues/28502#issuecomment-1277916719

Thanks!

geoand commented 1 year ago

@jcsim1024 just checking in, how is this going? Do you need any help?

piyush-1234 commented 1 year ago

hi all, i want to pick up this issue if you guys would not mind, I m new here and wanted to start contributing to quarkus,

geoand commented 1 year ago

Hi @piyush-1234,

Thanks for the offer. Let's see how far @jcsim1024 has got

piyush-1234 commented 1 year ago

thanks @geoand for taking me in consideration

jcsim1024 commented 1 year ago

Hello @geoand I am still reading the doc and trying to reproduce

OleKsimov commented 1 year ago

@jcsim1024 The reproducer is present in this issue if it helps.

piyush-1234 commented 1 year ago

@geoand & @OleKsimov, I m working on this parallel. any suggestion?

jcsim1024 commented 1 year ago

Hello @geoand, I am following the "create a config group and then add a property" advice. I am trying to find an elegant way to configure PostgreSQLConfigurationExtension then I'll make the test work. Any suggestion is welcomed https://github.com/quarkusio/quarkus/compare/main...jcsim1024:quarkus:main

geoand commented 1 year ago

@jcsim1024 you should not have to populate the new config group, Quarkus will do that automatically, see this for more information.

jcsim1024 commented 1 year ago

Just to keep you up to date, I have not made a lot of progress this weekend , I've mostly read the documentation I'll try to have something working this sunday

jcsim1024 commented 1 year ago

Update: I now have a working config group

jcsim1024 commented 1 year ago

I added the IT test in a module different than flyway's IT tests as it already has H2 database in it. Is it ok or should I put it in a a specific flyway-postgres IT module? @geoand

I think I should investigate more on the root cause of the stuck migration when there is both a tansaction lock and a concurent operation.

geoand commented 1 year ago

We probably want to add a test like the ones you can see here.

OleKsimov commented 1 year ago

Hi guys! I just wanted to mention that this issue blocks the teams which use Flyway + Postgres. Is there anything that can be done to add priority to this issue? Two months are gone, and it would be critical to wait for another two :(

geoand commented 1 year ago

@jcsim1024 how is your work going? Do you need any help or should we perhaps take over?

Thanks

jcsim1024 commented 1 year ago

Sorry I did not had a lot of free time this last 2 weeks, I'll have look on the tests this weekend

jcsim1024 commented 1 year ago

Hello will add a maven submodule named postgres-extension in "integration-tests/flyway/" folder and move what's in it in h2-extension

OleKsimov commented 1 year ago

@geoand Is it possible to assign this issue to someone?

geoand commented 1 year ago

As this does has the potential to block a lot of users and since we would not want to wait too much longer for a fix, I will handle it

geoand commented 1 year ago

With https://github.com/quarkusio/quarkus/pull/30656, users will now be able to provide arbitrary customization for Flyway, one of which can be the one needed for this issue.

I think this design is cleaner than adding a postgres specific property.