Skip to content

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

Closed

Description

@sommarlabs

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

Activity

  1. snicoll commented on Dec 17, 2021

    @snicoll
    Member

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

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

  2. added
    type: regressionA regression from a previous release
    and removed
    status: waiting-for-triageAn issue that has not yet been triaged. Contributions will not be accepted.
    on Dec 17, 2021
  3. added this to the 2.6.x milestone on Dec 17, 2021
  4. sommarlabs commented on Dec 17, 2021

    @sommarlabs
    Author

    @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.

  5. self-assigned this
    on Dec 17, 2021
  6. added a commit that references this issue on Dec 17, 2021
    1973789
  7. snicoll commented on Dec 17, 2021

    @snicoll
    Member

    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.

  8. removed
    for: team-meetingAn issue we'd like to discuss as a team to make progress
    on Dec 20, 2021
  9. modified the milestones: 2.6.x, 2.6.2 on Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions