Hi GeoNetwork developers,
We recently started to explore using multi nodes and were having problems with spatial index in PostGIS. I asked the question a few days ago in user list but didn’t get a response, so I post it here to see if developers have any ideas.
We are running GeoNetwork 3.4.2, Java 8, Tomcat 8, Postgres 9.4, PostGIS (2.2.7 & 2.3.2), after configuring the new node, “spatialindex” table is missing from the database for new node, instead, new node is writing spatial index into the “spatialindex” table in the database for srv node. And I am not able to delete any record on the new node due to a ObjectOptimisticLockingFailureException.
I followed user manual and manually registered the node
<beans default-lazy-init=“true”
xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=“http://www.springframework.org/schema/context”>
<context:property-override properties-ref=“newnode-configuration-overrides” />
<bean id=“newnode-configuration-overrides”
class=“org.springframework.beans.factory.config.PropertiesFactoryBean”>
username
password
10
10
10
jdbc:postgresql_postGIS://localhost:5432/geonetwork_newnode
I have different databases ready
srv: geonetwork
newnode: geonetwork_newnode
After restart geonetwork, the new node is running and 60 tables were created in the new database (geonetwork_newnode), but I didn’t find the “spatialindex” table. After spending a lot of time trying to figure out why “spatialindex” was not created in the new database, I finally discovered that the new node is also writing spatial index into the “spatialindex” table in the database (geonetwork) for “srv” node. Every time a new record is imported on “newnode”, it is inserted into “public.metadata” table in geonetwork_newnode DB, but spatial index goes to “public.spatialindex” table in geonetwork DB.
I tried to delete a record on “newnode” to see if its spatial index will be removed from the “srv” database, but found that I couldn’t delete any records on “newnode” (while the default “srv” node is working fine), delete request returns 400.
DELETE http://localhost:8080/geonetwork/newnode/api/records/124
Response:
{“message”:“ObjectOptimisticLockingFailureException”,“code”:“runtime_exception”,“description”:“Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1”}
This may be related to the misplaced spatial index, but I am not sure.
If anyone has any ideas about this issue, we would greatly appreciate it.
Best,
Jiabin Heng
Geospatial Information Specialist
Email: jiabin.heng@anonymised.com