Skip to content

Commit

Permalink
afsql: fixed retry_sql_inserts(1) isssue
Browse files Browse the repository at this point in the history
When an insert failed(after retries), syslog-ng didn't drop the connection
and thus an invalid transaction was kept in open state. When a new message
arrived, syslog-ng wanted to append that to the invalid transaction,
which caused failure and the message was dropped.

The problem occured when retries was set to 1.

if (self->failed_message_counter < self->num_retries - 1) // if (0 < 0)
  {
     // retry AND return false, which means to the caller
     // that the connection should be suspended
  }
else
  {
     // drop msg AND return true, which means to the caller
     // that connection should be kept open
  }

This is why a simple workaround (setting reties to 2) could solve this problem.

fixes syslog-ng#469

Signed-off-by: Laszlo Budai <Laszlo.Budai@balabit.com>
  • Loading branch information
lbudai committed May 26, 2015
1 parent 13b1b9f commit 1e60e63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/afsql/afsql.c
Expand Up @@ -1010,7 +1010,7 @@ afsql_dd_insert_db(AFSqlDestDriver *self)
}
else
{
if (self->failed_message_counter < self->num_retries - 1)
if (self->failed_message_counter < self->num_retries)
{
if (!afsql_dd_handle_insert_row_error_depending_on_connection_availability(self, msg, &path_options))
return FALSE;
Expand Down

0 comments on commit 1e60e63

Please sign in to comment.