vertica/vertica-nodejs

If Vertica is not available, backup_server_node is not used.

hulmgulm-at-work opened this issue · 1 comments

To test the backup_server_node configuration, I created a configuration with an invalid host/port but a valid backup_server_node:

const connection = {
    backup_server_node: `vertica.example.com:5433`,
      host: 'invalidhost.example.com',
      port: 9999,
      user: 'user',
      password: 'password',
      database: 'database',
      log(message) {
        console.log(new Date(), message);
      }
}

Then I get a pool with this connection details:
const pool = new Pool(connection);
When I make a query on this pool

pool.connect().then(client => {
        const query = client.query(new Query('SELECT 1'), (result) => {
          console.log(result);
        });
});

the pool tries to make a connection to Vertica (which is not working, because at the given host/port is no Vertica) but does not switch to the backup. I see the following in the log:

2023-01-31T09:51:41.295Z checking client timeout
2023-01-31T09:51:41.296Z connecting new client
2023-01-31T09:53:51.132Z client failed to connect
2023-01-31T09:53:51.132Z pulse queue
2023-01-31T09:53:51.133Z no queued requests

Notice, that it takes the pool more than two minutes to notice, that it is not able to connect.
At the end, I get the following error: Error acquiring a connection from pool: connect ETIMEDOUT 10.168.179.57:9999 +0ms

How can I make vertica-nodejs to use backup_server_node in case of a connection failure?

Beginning investigation into this issue