[GeoNetwork-users] Set up multinode with postgres/postgis

Hi there,

We recently started to explore using multimode and were having problems with the spatial index in PostGIS database. I am wondering if anyone had the same problem or know what is wrong.

I followed user manual and manually registered the node

<beans default-lazy-init="true"
  xmlns="http://www.springframework.org/schema/beans&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xmlns:context="http://www.springframework.org/schema/context&quot;&gt;

    <import resource="classpath*:/config-spring-geonetwork.xml"/>
    <import resource="../config-db/database_migration.xml"/>

    <context:property-override properties-ref="newnode-configuration-overrides" />

    <bean id="nodeInfo" class="org.fao.geonet.NodeInfo">
        <property name="id" value="newnode" />
        <property name="defaultNode" value="false" />
    </bean>

   <bean id="newnode-configuration-overrides"
        class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="properties">
            <props>
                <prop key="jdbcDataSource.username">username</prop>
                <prop key="jdbcDataSource.password">password</prop>
                <prop key="jdbcDataSource.maxActive">10</prop>
                <prop key="jdbcDataSource.maxIdle">10</prop>
                <prop key="jdbcDataSource.initialSize">10</prop>
                <prop key="jdbcDataSource.Url">jdbc:postgresql_postGIS://localhost:5432/geonetwork_newnode</prop>
            </props>
        </property>
    </bean>

    <import resource="../config-db/postgres-postgis.xml"/>
</beans>

I have different databases ready
Node

Database

srv

geonetwork

newnode

geonetwork_newnode

After restart geonetwork (version 3.4.2), 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 for "srv" node (geonetwork DB). 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<mailto:jiabin.heng@anonymised.com>

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.