Skip to content
Snippets Groups Projects
Commit dbef6e69 authored by David Smith's avatar David Smith
Browse files

Resolve "postgres frequently logging warning "there is no transaction in progress""

parent 491c5916
No related branches found
No related tags found
No related merge requests found
Pipeline #47708 failed
......@@ -13,6 +13,7 @@
- cta/CTA#218 - Do not retry during repack requests
### Bug Fixes
- cta/CTA#181 - cta-statistics-update can fail for catalogues in postgres
- cta/CTA#189 - Avoid postgres logging frequent warnings about no transaction in progress
- cta/CTA#234 - Replace stoi with toUint64 in standalone cli tool
- cta/CTA#238 - Compilation fails when using cta::common::Configuration::getConfEntInt(...)
### Continuous Integration
......
......@@ -105,6 +105,14 @@ void PostgresConn::commit()
throw exception::Exception(std::string(__FUNCTION__) + " can not execute sql, another query is in progress");
}
if (PQTRANS_IDLE == PQtransactionStatus(m_pgsqlConn)) {
// Commit is always called when returning a conneciton to the pool.
// Postgres logs a warning if we commit without a transaction. To avoid
// this a check is made, using client side server status tracking information:
// if we're not in a transaction return, otherwise attempt the commit.
return;
}
Postgres::Result res(PQexec(m_pgsqlConn, "COMMIT"));
throwDBIfNotStatus(res.get(), PGRES_COMMAND_OK, std::string(__FUNCTION__) + " problem committing the DB transaction");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment