It is possible that queue table does not exist

Created on 27 March 2024, 8 months ago
Updated 10 April 2024, 8 months ago

Problem/Motivation

I understand that the queue table is created on demand, it is possible that this table will not be created during the installation procedure.
In such cases, the system tries to create a "queue" table when the "createItem" function is called.
Please see https://git.drupalcode.org/project/drupal/-/blob/10.2.x/core/lib/Drupal/...

The problem is that we call nodeExistsInQueue function before createItem, we try to query "queue" table but at this point, this table does not exist yet.

Steps to reproduce

I have enabled the module and configured deletion for one node type, when I edited the selected node and pressed update I got the following error:
Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.queue' doesn't exist: SELECT "q"."item_id" AS "item_id" FROM "queue" "q" WHERE ("name" = :db_condition_placeholder_0) AND ("data" = :db_condition_placeholder_1) AND ("expire" = :db_condition_placeholder_2); Array ( [:db_condition_placeholder_0] => node_revision_delete [:db_condition_placeholder_1] => i:1; [:db_condition_placeholder_2] => 0 ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php) [c766dc57-a9dc-46f5-813b-45007079810a].

Proposed resolution

Extend nodeExistsInQueue, if the queue table does not exist, return 0.

We should not use any direct queries as it is possible that Drupal does not use a database to store queue items. I will ignore this problem as it requires more thought.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇵🇱Poland alorenc Wolsztyn, 🇵🇱

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024