[Geoserver-users] REST API / deleting an imagemosaic with postgres database

Hello,

I have a imagemosaic datastore on Geoserver, that uses a Postgres database to index the granules, with the following datastore.properties :
SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
host=localhost
port=5432
database=geoserver
schema=public
user=user
passwd=passwd

Loose\ bbox=true
Estimated\ extends=false
validate\ connections=true
Connection\ timeout=10
preparedStatements=true

When I try to delete the datastore with the rest API :
DELETE /rest/workspaces/workspace/coveragestores/store.xml?recurse=true&purge=all
I got the following error :
Caused by: java.io.IOException: Failed to drop the target database
at org.geotools.data.postgis.PostgisNGDataStoreFactory.dropDatabase(PostgisNGDataStoreFactory.java:401)
… 118 more
Caused by: org.postgresql.util.PSQLException: ERROR: database “geoserver” is being accessed by other users

I don’t understand why we try to delete the whole database (even with ‘purge=all’). I expected the method to remove only the table in which the index was stored.
I have the same behavior with purge=metadata.

Is there a way to configure the datastore to keep the database and the schema intact, and drop only the underlying table ?

Kind regards,

Joffrey

Dear Joffrey,
unfortunately this is a known issue and so far there’s no official solution for this.

I have created a JIRA for reference. Let’s keep the discussion there.

https://osgeo-org.atlassian.net/browse/GEOS-10554

Alessio.

Il giorno lun 20 giu 2022 alle ore 10:20 Joffrey Schmitz <joffrey.schmitz@anonymised.com> ha scritto:

Hello,

I have a imagemosaic datastore on Geoserver, that uses a Postgres database to index the granules, with the following datastore.properties :
SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
host=localhost
port=5432
database=geoserver
schema=public
user=user
passwd=passwd

Loose\ bbox=true
Estimated\ extends=false
validate\ connections=true
Connection\ timeout=10
preparedStatements=true

When I try to delete the datastore with the rest API :
DELETE /rest/workspaces/workspace/coveragestores/store.xml?recurse=true&purge=all
I got the following error :
Caused by: java.io.IOException: Failed to drop the target database
at org.geotools.data.postgis.PostgisNGDataStoreFactory.dropDatabase(PostgisNGDataStoreFactory.java:401)
… 118 more
Caused by: org.postgresql.util.PSQLException: ERROR: database “geoserver” is being accessed by other users

I don’t understand why we try to delete the whole database (even with ‘purge=all’). I expected the method to remove only the table in which the index was stored.
I have the same behavior with purge=metadata.

Is there a way to configure the datastore to keep the database and the schema intact, and drop only the underlying table ?

Kind regards,

Joffrey


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users