This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Database

Can’t Change Permissions on Extension

Error

… could not execute query: ERROR:  must be owner of extension lo
Command was: COMMENT ON EXTENSION …

Cause

pg_restore skips creation of the object itself, in this case lo, because it already exists. However, it still tries to change the comment but doesn’t have the permissions.

Solution - Remove Comment

Remove the comments from the affected extensions to ensure future dumps won’t contain COMMENT ON … statements.

Usually these two are affected:

COMMENT ON EXTENSION lo IS NULL;
COMMENT ON EXTENSION plpgsql IS NULL;

Hint

Remove the comment in database template1 to ensure new databases don’t contain it. (A CREATE DATABASE xy copies that DB.)

Workaround - Don’t Restore Comments

Use pg_restore’s --no-comments to skip restore of comments.

Postgres Connection Timeout

Error

HikariPool-1 - Connection is not available, request timed out after 30001ms.

often seen in connection with:

PersistenceException: org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection

Cause

HikariCP, the connection pool used by Nice, has a fixed number of connections available. The error tells us that no connection could be obtained within the given time. This could be because all connections are in use, because connecting to the server failed, or some other other issue lead to delays.

Analysis

Low Memory

In the vast majority of cases, this error is printed because the application is low on memory. In such a scenario, the GC is using most of the available resources, slowing down everything to a near-halt delaying the return of DB connections.

Solutions:

Too Few Connections

  1. First, check how the connections are used …:

    $ tco db-queries ${installation}
    
  2. … and check how many DB connections are available:

    $ tco config ${installation}
    14: agogis:
    …
    34:   installations:
    35:     agogis:
    36:       branch: releases/3.6
    37:       env: !merge
    38:         hibernate.main.hikari.maximumPoolSize: 15    # <---
    41:       db_server: db3.tocco.cust.vshn.net
    42:       enable_performance_monitoring: true
    …
    

    hibernate.main.hikari.maximumPoolSize is the maximum number of connections available. The value currently defaults to 6.

    Take a look at HikariCP’s github page.

  3. Take a look at how the connections are used

tco db-queries ${installation}