0

We are using a stack on SpringBoot, Hibernate and Liquibase. I have a sql file with 24000 inserts. When I converted it into yaml (for versioning purposes), I got a huge yaml file which I split into 16 yamls. Insertion using the master file using the liquibase command line option is pretty quick. But with Spring and Hibernate, it gets stuck. Upto 5 files is fine. Anything more than this dosn't work. I tried with 4 files each from the 16 files and it works too. So it is not an issue with any malformed yaml files. I also tried with the following properties in my application.yml.

 spring:
      datasource:
        hikari:
          maximum-pool-size: 100


     properties:
          hibernate:
            jdbc:
              batch_size: 200

        Basically, it gets stuck at the changelog lock. This is what the log shows:

        2019-10-17 18:10:26.375  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
        2019-10-17 18:10:26.387  WARN 1 --- [           main] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
        2019-10-17 18:10:26.927  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
        2019-10-17 18:10:27.760  INFO 1 --- [           main] liquibase.executor.jvm.JdbcExecutor      : SELECT COUNT(*) FROM pbr.DATABASECHANGELOGLOCK
        2019-10-17 18:10:27.794  INFO 1 --- [           main] liquibase.executor.jvm.JdbcExecutor      : SELECT COUNT(*) FROM pbr.DATABASECHANGELOGLOCK
        2019-10-17 18:10:27.804  INFO 1 --- [           main] liquibase.executor.jvm.JdbcExecutor      : SELECT `LOCKED` FROM pbr.DATABASECHANGELOGLOCK WHERE ID=1
        2019-10-17 18:10:27.812  INFO 1 --- [           main] l.lockservice.StandardLockService        : Waiting for changelog lock....
        2019-10-17 18:10:37.816  INFO 1 --- [           main] liquibase.executor.jvm.JdbcExecutor      : SELECT `LOCKED` FROM pbr.DATABASECHANGELOGLOCK WHERE ID=1
        2019-10-17 18:10:37.821  INFO 1 --- [           main] l.lockservice.StandardLockService        : Waiting for changelog lock..

It did not work. Please help me.

The inserts are like this: databaseChangeLog: - changeSet: id: 15706644546-4 author: pbr-admin changes: - insert: columns: - column: name: model_id value: xxxxx - column: name: category_id value: ALL_TRANSACTIONS - column: name: afpr_indexed valueBoolean: false - column: name: score valueNumeric: xxx

The changelog is liquibase specific.

javagirl
  • 41
  • 1
  • 7
  • can you print an example of your insert statement. are you using locks ? or it's liquibase native code – CodeIsLife Oct 17 '19 at 20:53
  • you can consider https://github.com/liquibase/liquibase-nochangeloglock as well, which completely disables the lock support – CodeIsLife Oct 17 '19 at 20:54
  • It seems like something is trying to do four operations in parallel, and each is getting the databasechangeloglock and then preventing the others from continuing - classic deadlock. If you could limit it to a single thread you'd probably be fine. Not sure where that 4 parallel threads is coming from though - spring boot or hibernate. – SteveDonie Oct 17 '19 at 23:10

0 Answers0