Skip to content

New version change of behaviour, Integresql is not waiting for DB to finish creating #17

Open
@bartoszhernas

Description

Hi, after we upgraded to newest IntegreSQL we noticed tests started failing randomly with error that the DB we try to use doesn't exist.

I pinpointed the issue to query creating DB in PostgreSQL and not waiting for it to finish, while the client libraries would continue executing and trying to not (yet) existing DB.

postgres-1  | 2024-02-09 12:18:27.531 UTC [3827] LOG:  statement: CREATE DATABASE "integresql_test_00bd369da024925dba2efdb4ce82cffc421b349d_020" WITH OWNER "fym" TEMPLATE "integresql_template_00bd369da024925dba2efdb4ce82cffc421b349d"
postgres-1  | 2024-02-09 12:18:27.531 UTC [3833] FATAL:  database "integresql_test_00bd369da024925dba2efdb4ce82cffc421b349d_020" does not exist
postgres-1  | 2024-02-09 12:18:27.531 UTC [3833] DETAIL:  It seems to have just been dropped or renamed.

It was working just fine with previous version, so I am guessing there was some change in IntegreSQL?

The fix for us right now was to try to connect to DB multiple times until it works

  let retriesConnectMain = 0;
  while (retriesConnectMain < 10) {
    try {
      // eslint-disable-next-line no-await-in-loop
      await prismaMain.$connect();
      break;
    } catch (e) {
      retriesConnectMain += 1;
      // eslint-disable-next-line no-await-in-loop
      await wait(100);
    }
  }

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions