After creating a task that calls GarbageCollectorService::inst()->process()
in it's run()
method, the following SQL error occurs both for mysqld Ver 10.5.9-MariaDB for osx10.16 on x86_64 (Homebrew)
as well as on Silverstripe Cloud. I can't recall the MySQL version running on our stack but will work to track that down.
Config
---
Name: website-GarbageCollectors
---
SilverStripe\GarbageCollector\Collectors\VersionedCollector:
# Increase Versioned keep limit to 10 records
keep_limit: 10
# Define base classes to collect versions for
base_classes:
- SilverStripe\CMS\Model\SiteTree
SilverStripe\GarbageCollector\Collectors\ChangeSetCollector:
# Reduce Changeset Lifetime to 10 days
deletion_lifetime: 10
# Register collectors with service
SilverStripe\GarbageCollector\GarbageCollectorService:
collectors:
- 'SilverStripe\GarbageCollector\Collectors\VersionedCollector'
- 'SilverStripe\GarbageCollector\Collectors\ChangeSetCollector'
Task
class GarbageCollectionTask extends BuildTask
{
/**
* @var string
*/
private static $segment = 'GarbageCollectionTask';
/**
* {@inheritDoc}
* @return string
*/
public function getDescription()
{
return _t(
__CLASS__ . '.Description',
'A task used to trim Change Sets, Versions, and any other configured objects'
);
}
/**
* @param HTTPRequest $request
* @throws \Exception
*/
public function run($request)
{
GarbageCollectorService::inst()->process();
}
}
MariaDB
2021-10-05 09:53:37][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) 42000-1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID"...' at line 2" [] []
[2021-10-05 09:53:37][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) 42000-1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID"...' at line 2" [] []
[2021-10-05 09:53:37][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) 42000-1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID"...' at line 2" [] []
[2021-10-05 09:53:37][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) 42000-1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID"...' at line 2" [] []
[2021-10-05 09:53:37][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) 42000-1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID"...' at line 2" [] []
MySQL
[2021-10-05 09:57:46][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LE' at line 1" [] []
[2021-10-05 09:57:46][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LE' at line 1" [] []
[2021-10-05 09:57:46][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LE' at line 1" [] []
[2021-10-05 09:57:46][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LE' at line 1" [] []
[2021-10-05 09:57:46][ERROR] Unable to process records: "Couldn't run query: DELETE FROM "ChangeSet" LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LEFT JOIN "ChangeSetItem_ReferencedBy" ON "ChangeSetItem"."ID" = "ChangeSetItem_ReferencedBy"."ChangeSetItemID" WHERE ("ChangeSet"."ID" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN "ChangeSetItem" ON "ChangeSet"."ID" = "ChangeSetItem"."ChangeSetID" LE' at line 1" [] []