Bulk deletion and connection limit

Feature(s) impacted

Bulk deletion

Observed behavior

We tried to delete dozens of rows at the same time and hit a SequelizeConnectionAcquireTimeoutError.
My guess is that we reached the Sequelize connection limit (options.pool.max) preventing the Forest Admin app to perform any database operation until all the deletion transactions are done.

Context

Liana (forest-express-sequelize) version: 8.0.6
Sequelize version: 6.11.0

The rows we tried to delete have foreign constraints with other tables, so the deletion of one row would cascade to other deletions.
We only have one instance of the Forest Admin server running.
We did not change the Sequelize pool settings. Default max connection limit is 5 according to the Sequelize doc.

Expected behavior

I expected rows to be deleted with no error and without blocking access to the Forest Admin app.

What are the good practices for this use case? Should we develop our own bulk deletion smart action that would serialize the deletion? Should we increase the Sequelize pool max limit?

Hello @AlexisSMT :wave:

Thank you for reporting this issue.
I will look into it and confer with my teammates.

I will keep you posted and hope to come back to you with a solution ASAP :muscle: :christmas_tree:

Hey @AlexisSMT

With the information you gave me, I tried to reproduce the issue, without success.
I even downsized my pool to 1 connection.

In order for me to keep investigating, I need more information from you:

  • Can you get the SQL request that has been executed onto your server? (via debug/logging of Sequelize)
  • What is the name of your project?

What I suspect at this time is the generated request put heavy stress onto your SQL server given the potentially large amount of cascades/relations.

What I can suggest in the meantime:

  • :desktop_computer: Monitor the health of your database server (CPU usage, number of connections)
  • :arrow_upper_right: You can increase the Sequelize pool max limit and see if it changes anything. I personally do not think it will
  • :muscle: You can develop your own smart action to perform the deletion if you feel you can do a better-optimized request given the specificity of your database schema
2 Likes