Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Resource files not deleted from local storage after dataset purge via API - CKAN 2.10 #9141

@Antoine81

Description

@Antoine81

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

  1. Create a new dataset.
  2. Upload one or more resource files (using the UI or API).
  3. Purge the dataset using:
    curl -X POST \
      -H "Authorization: <API_KEY>" \
      -d '{"id": "<dataset_id>"}' \
      https://<ckan_url>/api/3/action/dataset_purge```
  4. Check the local file storage directory (default: /var/lib/ckan/default/resources/).
  5. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions