[GeoNetwork-devel] [GeoNetwork opensource Developer website] #1258: Helthcheck using wrong query for database healthcheck

#1258: Helthcheck using wrong query for database healthcheck
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.8.1
Component: General | Version: v2.8.0
Keywords: |
-----------------------+----------------------------------------------------
As pointed out by Montse in http://osgeo-org.1560.n6.nabble.com/Oracle-
Database-health-check-issues-td5044740.html

DatabaseHealthCheck.java is using query "SELECT id from Metadata LIMIT 1"
which is not compatible with other databases.

As this is a simple check to see if the database is responding, I believe
it should be using the query that was identified in the config.xml
"validationQuery" as this query should be compatible with the database.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1258&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1258: Healthcheck using wrong query for database healthcheck
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.8.1
Component: General | Version: v2.8.0
Keywords: |
-----------------------+----------------------------------------------------

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1258#comment:1&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#1258: Healthcheck using wrong query for database healthcheck
-----------------------+----------------------------------------------------
Reporter: ianwallen | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.8.1
Component: General | Version: v2.8.0
Keywords: |
-----------------------+----------------------------------------------------

Comment(by drh):

My sense is that the validationQuery is to test the JDBC connection, but
the DatabaseHealthCheck should be a query (queries) aimed at checking the
status of the database as well as the connection. In 2.8.0, the
DatabaseHealthCheck fails on Oracle:

{{{
* Csw GetCapabilities: OK
* Csw GetRecords: OK
! Database Connection: ERROR
! ORA-00933: SQL command not properly ended

java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly
ended

         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
         at
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
         at
oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)
         at
oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
         at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
         at
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
         at
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3620)
         at
oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
         at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
         at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
         at jeeves.resources.dbms.Dbms.selectFull(Dbms.java:213)
         at jeeves.resources.dbms.Dbms.select(Dbms.java:176)
         at
org.fao.geonet.monitor.health.DatabaseHealthCheck$1.check(DatabaseHealthCheck.java:25)
         at
com.yammer.metrics.core.HealthCheck.execute(HealthCheck.java:165)
         at
com.yammer.metrics.core.HealthCheckRegistry.runHealthChecks(HealthCheckRegistry.java:53)
         at
com.yammer.metrics.reporting.HealthCheckServlet.doGet(HealthCheckServlet.java:61)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at
com.yammer.metrics.reporting.AdminServlet.doGet(AdminServlet.java:103)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at
org.fao.geonet.monitor.webapp.WebappMetricsFilter.doFilter(WebappMetricsFilter.java:96)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)
         at
org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
         at
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
         at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at
org.fao.geonet.monitor.MonitorSecurityFilter.doFilter(MonitorSecurityFilter.java:51)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at
org.fao.geonet.monitor.webapp.MetricsRegistryInitializerFilter.doFilter(MetricsRegistryInitializerFilter.java:31)
         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
         at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
         at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
         at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
         at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
         at java.lang.Thread.run(Thread.java:662)

* Lucene Index: OK
* Metadata Index Errors: OK
}}}

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/1258#comment:2&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.