From f1afdb3de66275f48ca99ec57dafe4ac8b52bf97 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 14 Nov 2012 20:05:33 +0100 Subject: [PATCH] postgresql plugin: Restart a writer transaction if the writer's query failed. The failed query inside the transaction causes the transaction to be aborted and all subsequent queries to fail as well. --- src/postgresql.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/postgresql.c b/src/postgresql.c index 9b264d9e..8a9fa101 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -886,6 +886,12 @@ static int c_psql_write (const data_set_t *ds, const value_list_t *vl, writer->statement, params[0], params[1], params[2], params[3], params[4], params[5], params[6], params[7]); + + /* this will abort any current transaction -> restart */ + if (db->commit_interval > 0) + if (c_psql_commit (db) == 0) + c_psql_begin (db); + pthread_mutex_unlock (&db->db_lock); return -1; } -- 2.30.2