To quickly reduce the database size, add a command to delete revisions of any any revisionable entity type.

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

mkalkbrenner created an issue. See original summary.

mkalkbrenner changed the visibility of the branch 1.0.x to hidden.

mkalkbrenner’s picture

Status: Active » Needs review
mkalkbrenner’s picture

Status: Needs review » Needs work

I get an error during queue:run. I'll check that ...

mkalkbrenner’s picture

Status: Needs work » Needs review

The issue was with profile entities. That had to be handled in #3525215: Support all entity types.
So I decided to combine both merge requests here.

mkalkbrenner’s picture

Title: Allow to delete revisions of any revisionable enitity type at once » Allow to delete revisions of any revisionable entity type at once

I noticed two critical issues during testing:

  1. The keep parameter had no effect.
  2. The performance is really bad on big databases.

The first one is a bug introduced in the dev branch.

The second is caused by the fact that all entities of a requested type or bundle are queued regardless how many revisions exist in database. In case of one million nodes, that takes a significant amount of time, CPU and memory to load all of them to count the number of revisions.
It is way better to only put those into the queue that have more revisions than to keep.

I fixed both issues within the MR instead of opening new ones because the code changed too much.

BTW, I implemented getting the entity IDs as SQL. Loading entities would quickly run out of memory.

j-barnes’s picture

Thanks for the work on this, this is looking great. Going to do some testing on it and we will get it in.

mkalkbrenner’s picture

I did some more tests and found a minor issue that counting revisions per language needs to be done on the data table.

j-barnes’s picture

@mkalkbrenner - this is working much better now! Do you think it's worth adding some extra logic in the getRevisionableEntityTypes() to filter out some of the entity types that might not be applicable like paragraphs or unique ones like menu_link_content where the entity_type_id might differ?

mkalkbrenner’s picture

I already thought about exclude lists.
But I suggest to commit this one first as it contains bug fixes and performance improvements without breaking any existing functinality. And maybe another beta release.
Then we could think about the next steps.

j-barnes’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.