diff options
author | Luis Fernando Muñoz Mejías <Luis.Fernando.Munoz.Mejias@cern.ch> | 2009-04-28 21:14:53 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-29 17:10:19 +0200 |
commit | 9823c73d1d07e50e6bec7f7c02c88d61d6955526 (patch) | |
tree | fe45b83508fb906ae79163849b5d62937ad39b88 /plugins/omoracle | |
parent | c35ce31aed4d873ed9564332374fbf82d7ff187d (diff) | |
download | rsyslog-9823c73d1d07e50e6bec7f7c02c88d61d6955526.tar.gz rsyslog-9823c73d1d07e50e6bec7f7c02c88d61d6955526.tar.xz rsyslog-9823c73d1d07e50e6bec7f7c02c88d61d6955526.zip |
Make it recover from errors on insertions.
If the database rejected some entry, making the statement fail on it,
the batch was not cleaned and the same values were retried over and
over, causing a cascade of failures and a denial of service.
We use now OCI_BATCH_ERRORS so that everything valid in the batch is
inserted, and rejected values can be discarded.
Diffstat (limited to 'plugins/omoracle')
-rw-r--r-- | plugins/omoracle/omoracle.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/plugins/omoracle/omoracle.c b/plugins/omoracle/omoracle.c index d1b3b955..331b7dd4 100644 --- a/plugins/omoracle/omoracle.c +++ b/plugins/omoracle/omoracle.c @@ -342,13 +342,12 @@ static int insert_to_db(instanceData* pData) OCIStmtExecute(pData->service, pData->statement, pData->error, - pData->batch.n, 0, NULL, NULL, OCI_DEFAULT)); + pData->batch.n, 0, NULL, NULL, + OCI_BATCH_ERRORS)); - CHECKERR(pData->error, - OCITransCommit(pData->service, pData->error, 0)); - - pData->batch.n = 0; finalize_it: + pData->batch.n = 0; + OCITransCommit(pData->service, pData->error, 0); dbgprintf ("omoracle insertion to DB %s\n", iRet == RS_RET_OK ? "succeeded" : "did not succeed"); RETiRet; |