Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralised retries() for LogThrDestDriver #204

Merged
merged 6 commits into from
Aug 18, 2014
Merged

Centralised retries() for LogThrDestDriver #204

merged 6 commits into from
Aug 18, 2014

Conversation

algernon
Copy link
Contributor

Moves the retries() functionality into LogThrDestDriver, and updates all modules that use the class so that they will now support retries() too.

@algernon algernon added this to the syslog-ng 3.6.1 milestone Aug 15, 2014
@algernon algernon self-assigned this Aug 15, 2014
@algernon algernon added this to the syslog-ng 3.6.1 milestone Aug 17, 2014
log_threaded_dest_driver_stop_watches(self);
if (log_queue_check_items(self->queue, &timeout_msec,
log_threaded_dest_driver_message_became_available_in_the_queue,
self, NULL))
{
if (!self->worker.insert(self))
LogMessage *msg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part should be moved into a separated function.
And this function should use a loop, which loop running while we get message from the queue and the insert method is success. I think it should be more efficient.

@juhaszviktor
Copy link
Contributor

Seems good, but please find my comments inline

@algernon
Copy link
Contributor Author

Added two more commits that implement the improvements suggested. Can I you review the result again, @juhaszviktor? Thanks!

Instead of implementing retries() for each driver, implement it once, in
LogThrDestDriver. This changes the API of worker->insert: it now
receives the message, and must return one of a number of resulting
states. The parent class will handle it from there. All derived drivers
were updated.

This fixes #201, and due to centralization and common behaviour, also
fixes #202 too.

As a side effect, this adds retries() functionality to amqp(), stomp()
and redis().

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This new rule in the grammar will hold all the options that are
centrally implemented by LogThrDestDriver. Currently, this is the
retries() option.

With the function moved to that class, the setter was moved there too,
and all copies were removed from the various drivers.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Now that "retries" is implemented by something in core too, move
associated things to cfg-parser.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
In log_threaded_dest_driver_do_insert(), loop while log_queue_pop_head()
returns TRUE (or we need to suspend), so that we don't do a sleep/wakeup
cycle for every single message. We can do this without blocking anyone
else, because this function is running in a dedicated thread.

Thanks to Viktor Juhasz for the suggestion!

Suggested-by: Viktor Juhasz <viktor.juhasz@balabit.com>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Instead of locally keeping track of suspension, move that to
LogThrDestDriver->suspended, and set that to TRUE in
_disconnect_and_suspend(), and back to FALSE in _do_work().

This way the control flow is easier to follow, and re-registering can be
moved to _do_work() from _do_insert().

Requested-by: Viktor Juhasz <viktor.juhasz@balabit.com>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
algernon added a commit that referenced this pull request Aug 18, 2014
Centralised retries() for LogThrDestDriver
@algernon algernon merged commit 132814d into syslog-ng:3.6/master Aug 18, 2014
@algernon algernon deleted the f/3.6/central-retries branch August 18, 2014 12:43
kovgeri01 pushed a commit to kovgeri01/syslog-ng that referenced this pull request Aug 13, 2024
ci: enable indexing and testing stable packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants