Using the REST API to purge NetCDF granules causes a seemingly infinite loop

Description

Trying to delete all the granules related to a given NetCDF files, like this:

curl -XDELETE -u admin:geoserver "http://localhost:8080/geoserver/rest/workspaces/rm/coveragestores/hsf_ita/coverages/mycoverage/index/granules?filter=$filter&purge=metadata"

Seems to end up with an infinite loop of sorts once the last coverage of the NetCDF file is being purged (assuming there are multiple ones), with the NetCDF file re-populating its index as the granule is processed for deletion:

The purging code goes through the granule descriptor which in turn initializes the store, which I guess finds the database empty and re-initializes itself… we probably need to either avoid going through the granule descriptor (just to find the raster URL really) or have hints that avoid re-initialization of the NetCDF.

Also noticing, the code is assuming granule==file but for NetCDF one file maps to many granules, it should probably be processed once only.

As a further notice, the NetCDF index is stored in a postgis database, just like the mosaic index…. may not be relevant, but just in case.

Environment

None

Activity

Fixed

Details

Assignee

Reporter

Triage

Fix versions

Priority

Created May 19, 2022 at 10:21 AM
Updated June 1, 2022 at 1:01 PM
Resolved June 1, 2022 at 1:01 PM