Problem/Motivation

On a recent project we ran into an issue where Node Revision Delete was not deleting revisions like it should. Despite having an amount limit of 20 revisions, some pieces of content were pushing thousands of revisions.

It turned out that between when a node was added to the queue and when it was processed, some revisions were being omitted. In \Drupal\node_revision_delete\Plugin\QueueWorker\NodeRevisionDelete::processItem(), it calls revisionIds(), which directly queries the database, but the list of revisions can be modified within loadRevision(), causing NULL to be returned.

Steps to reproduce

I am not totally certain what can cause loadRevision() not to successfully load a revision. It may be related to Trash module or the fact that the site is multilingual.

Proposed resolution

Check that a revision exists before attempting to delete it.

User interface changes

None

API changes

None

Data model changes

None

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

quicksketch created an issue. See original summary.

quicksketch’s picture

Status: Active » Closed (outdated)

Welp, turns out that updating to 2.1.1 (from 2.0.0) fixed this problem; although the update hook could not run because of duplicate primary keys. Once clearing out the queue and updating the nodes, they queue and are deleted properly. The code I mentioned in the summary has been completely replaced, so this is no longer relevant.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.