-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
CKAN version
2.10.5
Describe the bug
When purging a dataset that contains uploaded resources, the associated resource files are not deleted from the local file storage directory (/var/lib/ckan/default/resources/).
This causes the disk usage to grow over time, as files remain on the server even though the datasets and resources have been fully removed from the CKAN database.
The issue occurs when using the CKAN API endpoint POST /api/3/action/dataset_purge.
After the purge, the dataset and resources are no longer visible in the UI, but their corresponding files remain on disk.
Steps to reproduce
- Create a new dataset.
- Upload one or more resource files (using the UI or API).
- Purge the dataset using:
curl -X POST \ -H "Authorization: <API_KEY>" \ -d '{"id": "<dataset_id>"}' \ https://<ckan_url>/api/3/action/dataset_purge```
- Check the local file storage directory (default: /var/lib/ckan/default/resources/).
- Observe that the resource files are still present on disk even though the dataset was purged.
Expected behavior
Purging a dataset should also delete all associated resource files from the local storage directory, freeing up disk space.
Additional details
CKAN installation type: system installation from .deb package
Storage backend: Local FileStore (/var/lib/ckan/default/resources/)
Database: PostgreSQL 14
Python version: 3.10.6
Solr version: 9.6.1