From 8ed2003afc7969af48a10e4a5e5d14b4f28bd6a4 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 24 Sep 2016 19:46:14 +1000 Subject: [PATCH] ckdb - completely ignore dup shares, since it can stop workmarker processing --- src/ckdb.h | 2 +- src/ckdb_dbio.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index 73258212..afe5a1e1 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -58,7 +58,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.7" -#define CKDB_VERSION DB_VERSION"-2.509" +#define CKDB_VERSION DB_VERSION"-2.510" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_dbio.c b/src/ckdb_dbio.c index e422f628..ff914504 100644 --- a/src/ckdb_dbio.c +++ b/src/ckdb_dbio.c @@ -4074,8 +4074,12 @@ bool shares_db(PGconn *conn, K_ITEM *s_item) res = PQexecParams(conn, ins, par, NULL, (const char **)params, NULL, NULL, 0, CKPQ_WRITE); rescode = PQresultStatus(res); if (!PGOK(rescode)) { - PGLOGERR("Insert", rescode, conn); - goto unparam; + // If the share is already in the db ignore the error + char *code = PQresultErrorField(res, PG_DIAG_SQLSTATE); + if (!code || strcmp(code, SQL_UNIQUE_VIOLATION)) { + PGLOGERR("Insert", rescode, conn); + goto unparam; + } } ok = true;