Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring boot 2.6.0 Quartz mysql/mariadb tables are not created #29095

Closed
chrisdev0 opened this issue Dec 17, 2021 · 3 comments
Closed

Spring boot 2.6.0 Quartz mysql/mariadb tables are not created #29095

chrisdev0 opened this issue Dec 17, 2021 · 3 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@chrisdev0
Copy link

In spring boot 2.6.1 the creation of the Quartz tables for (at least) mysql and mariadb have stopped working.

The cause is that the spring.quartz.jdbc.comment-prefix property isn't used on the way to the runScripts method in DataSourceScriptDatabaseInitializer so the ResourceDatabasePopulator is never configured with these comment-prefixes.

This causes the default comment-prefixes to be used (which is --) and since the org.quartz-scheduler:quartz:2.3.2 dependency mysql/mariadb sql files (in org.quartz.impl.jdbcjobstore) have non -- prefixed comments the results is broken sql.

The exception is then silently ignored (unless debug log level) due to continueOnError being true.

A temporary solution is to extract the .sql-file in the org.quartz-scheduler:quartz dependency, remove the # comments on top and then overriding the schema used to initialize the quartz tables by using the property spring.quartz.jdbc.schema

I've created a small example of the bug here https://github.com/chrisdev0/quartz-bug
run with default profile results in error on startup due to
Caused by: java.sql.SQLException: Table 'quartz_bug.qrtz_locks' doesn't exist
run with workaround profile and it will start since it's using the extracted schema sql file with the comments removed

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 17, 2021
@snicoll
Copy link
Member

snicoll commented Dec 17, 2021

@chrisdev0 thank you so much for the detailed report and sample.

Can you share why you've overridden the integration initializer?

@snicoll snicoll added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 17, 2021
@snicoll snicoll added this to the 2.6.x milestone Dec 17, 2021
@chrisdev0
Copy link
Author

chrisdev0 commented Dec 17, 2021

@chrisdev0 thank you so much for the detailed report and sample.

Can you share why you've overridden the integration initializer?

Sorry, I forgot to remove that bean when copy pasting from my other project. I've removed that bean in the example now.

@snicoll snicoll self-assigned this Dec 17, 2021
snicoll added a commit to snicoll/spring-boot that referenced this issue Dec 17, 2021
This commit improves the database initializer to support comment
prefixes. The Quartz initializer uses this feature and that setting
was ignored prior to this commit.

Closes spring-projectsgh-29095
@snicoll
Copy link
Member

snicoll commented Dec 17, 2021

I've pushed a fix on my fork but it breaks a protected method and I can see ourselves breaking this some more as new settings are added. DatabaseInitializationSettings contains both the scripts and the settings to run them and we want to isolate the former from the actual implementation as we're giving it the scripts to run.

The previous implementation had a way to customize the DatabaseResourcePopulator. Adding that would fix the Quartz use case without breaking the API but it wouldn't permit to use this feature by just using the settings and decoupling it from the properties was a goal.

I am not sure what to do at this point so I've flagged it so that someone else on the team can have a look.

@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Dec 17, 2021
@bclozel bclozel removed the for: team-meeting An issue we'd like to discuss as a team to make progress label Dec 20, 2021
@snicoll snicoll modified the milestones: 2.6.x, 2.6.2 Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

5 participants