summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:54:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:54:32 +0000
commitab42b8cfd86a186447528e538ec0ae94751cfc1d (patch)
tree4fa03c118292ab8801a30fc83e53a1958426b54c /plugins
parentAdding upstream version 8.2404.0. (diff)
downloadrsyslog-ab42b8cfd86a186447528e538ec0ae94751cfc1d.tar.xz
rsyslog-ab42b8cfd86a186447528e538ec0ae94751cfc1d.zip
Adding upstream version 8.2406.0.upstream/8.2406.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--plugins/imfile/imfile.c11
-rw-r--r--plugins/ompgsql/ompgsql.c24
2 files changed, 24 insertions, 11 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c
index 3b0bb10..c7572b4 100644
--- a/plugins/imfile/imfile.c
+++ b/plugins/imfile/imfile.c
@@ -857,13 +857,16 @@ detect_updates(fs_edge_t *const edge)
sbool is_file = act->edge->is_file;
if (!is_file || act->time_to_delete + FILE_DELETE_DELAY < ttNow) {
DBGPRINTF("detect_updates obj gone away, unlinking: "
- "'%s', ttDelete: %lds, ttNow:%ld isFile: %d\n",
- act->name, ttNow - (act->time_to_delete + FILE_DELETE_DELAY), ttNow, is_file);
+ "'%s', ttDelete: %"PRId64"s, ttNow:%"PRId64" isFile: %d\n",
+ act->name, (int64_t) ttNow - (act->time_to_delete + FILE_DELETE_DELAY),
+ (int64_t) ttNow, is_file);
act_obj_unlink(act);
restart = 1;
} else {
- DBGPRINTF("detect_updates obj gone away, keep '%s' open: %ld/%ld/%lds!\n",
- act->name, act->time_to_delete, ttNow, ttNow - act->time_to_delete);
+ DBGPRINTF("detect_updates obj gone away, keep '%s' "
+ "open: %"PRId64"/%"PRId64"/%"PRId64"s!\n",
+ act->name, (int64_t) act->time_to_delete, (int64_t) ttNow,
+ (int64_t) ttNow - act->time_to_delete);
pollFile(act);
}
}
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 27248ff..9c27de9 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -255,7 +255,8 @@ tryExec(uchar *pszCmd, wrkrInstanceData_t *pWrkrData)
pgRet = PQexec(pWrkrData->f_hpgsql, (char*)pszCmd);
execState = PQresultStatus(pgRet);
if (execState != PGRES_COMMAND_OK && execState != PGRES_TUPLES_OK) {
- dbgprintf("postgres query execution failed: %s\n", PQresStatus(PQresultStatus(pgRet)));
+ // complain a lot in case any issues with DB communication
+ LogError(0, execState, "postgres query execution failed: %s", PQresStatus(PQresultStatus(pgRet)));
bHadError = 1;
}
PQclear(pgRet);
@@ -352,13 +353,22 @@ CODESTARTcommitTransaction
if (iRet != RS_RET_OK
&& iRet != RS_RET_DEFER_COMMIT
&& iRet != RS_RET_PREVIOUS_COMMITTED) {
- /*if(mysql_rollback(pWrkrData->hmysql) != 0) {
- DBGPRINTF("ommysql: server error: transaction could not be rolled back\n");
- }*/
- // closeMySQL(pWrkrData);
- // FINALIZE;
+ // in case of any error lets retry, writePgSQL should return
+ // iRet = RS_RET_SUSPENDED and we need return it downstream, otherwise
+ // messages gonna be lost
+ LogError(0, iRet, "Failed too execute PG query. Message suspended.");
+
+ // since writePgSQL may close connection in case of errors
+ // no point to issue rollback on new connection
+ // writePgSQL((uchar*) "ROLLBACK", pWrkrData);
+
+ // To be on safe side lets kill connection similar to what
+ // ommysql plugin does.
+ closePgSQL(pWrkrData);
+ // signal mod.om.beginTransaction that we want retry
+ ABORT_FINALIZE(iRet);
+ }
}
- }
CHKiRet(writePgSQL((uchar*) "COMMIT", pWrkrData)); /* TODO: make user-configurable */