0

The code is reaching the "Populating migrations to be executed" log. Yet none of the AAA, EEE and CCC logs are being reached so no code inside the doOnSuccess is being run. Any help on how I can solve this problem will be appreciated.

databaseClient.execute().sql("CREATE TABLE IF NOT EXISTS " + TRACKING_TABLE +" ("+PROPERTY_SERVICE+ " varchar(255) NOT NULL, " + PROPERTY_VERSION+" float(4) NOT NULL, " +PROPERTY_SCRIPT+" varchar(255) NOT NULL);")
                .then()
                .concatWith(databaseClient.execute().sql("CREATE TABLE IF NOT EXISTS " + TRACKING_SEAL_TABLE+" ("+PROPERTY_SERVICE+ " varchar(255) NOT NULL, "+ PROPERTY_VERSION+" float(4) NOT NULL);")
                        .then())
                .doOnComplete(() -> {
                    log.info("Populating migrations to be executed");// reaches here
                    databaseClient.select().from(TRACKING_SEAL_TABLE).as(MigrationSealDetails.class).fetch().all()       .collectList()
                            .map()//mapping function
                            .doOnError(e -> log.log(Level.SEVERE, "EEE", e))
                            .doOnSuccess(highestSealPerService -> {
                                log.info("AAA");
                                databaseClient.select().from(TRACKING_TABLE).as(MigrationDetails.class).fetch().all()
                                        .collectList()
                                        .doOnSuccess(migrationsExecuted -> {
                                            // other code
                                        }).block();
                            }).block();
                }).blockLast();
        log.info("CCC");
Brian Clozel
  • 56,583
  • 15
  • 167
  • 176

1 Answers1

0

log.info("CCC");

It should be called in any case because it's the last operation after all reactive calls. I think the problem that your code is deadlocked. You are in a reactive thread in doOnComplete. Then you make another blocking operation that blocks the current reactive thread and you receive the deadlock as no operation can be finished.

Don't use R2DBC if you write .block() just use plain JDBC.

Max Grigoriev
  • 1,021
  • 2
  • 13
  • 29