Skip to content

Commit

Permalink
logthrdestdrv: add seqnum and no-seqnum flags
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Jan 30, 2024
1 parent 17d95cc commit 197383c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/logthrdest/logthrdestdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ CfgFlagHandler log_threaded_dest_driver_flag_handlers[] =
{
{ "seqnum-all", CFH_SET, offsetof(LogThreadedDestDriver, flags), LTDF_SEQNUM_ALL },
{ "no-seqnum-all", CFH_CLEAR, offsetof(LogThreadedDestDriver, flags), LTDF_SEQNUM_ALL },
{ "seqnum", CFH_SET, offsetof(LogThreadedDestDriver, flags), LTDF_SEQNUM },
{ "no-seqnum", CFH_CLEAR, offsetof(LogThreadedDestDriver, flags), LTDF_SEQNUM },
{ NULL },
};

Expand Down Expand Up @@ -1460,6 +1462,7 @@ log_threaded_dest_driver_init_instance(LogThreadedDestDriver *self, GlobalConfig
self->batch_timeout = -1;
self->num_workers = 1;
self->last_worker = 0;
self->flags = LTDF_SEQNUM;

self->retries_on_error_max = MAX_RETRIES_ON_ERROR_DEFAULT;
self->retries_max = MAX_RETRIES_BEFORE_SUSPEND_DEFAULT;
Expand Down
4 changes: 3 additions & 1 deletion lib/logthrdest/logthrdestdrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef enum
enum
{
LTDF_SEQNUM_ALL = 0x0001,
LTDF_SEQNUM = 0x0002,
/* NOTE: everything >= 0x1000 is driver specific */
};

Expand Down Expand Up @@ -230,7 +231,8 @@ log_threaded_dest_worker_disconnect(LogThreadedDestWorker *self)
static inline LogThreadedResult
log_threaded_dest_worker_insert(LogThreadedDestWorker *self, LogMessage *msg)
{
if ((self->owner->flags & LTDF_SEQNUM_ALL) || (msg->flags & LF_LOCAL))
if ((self->owner->flags & LTDF_SEQNUM) &&
((self->owner->flags & LTDF_SEQNUM_ALL) || (msg->flags & LF_LOCAL)))
{
if (self->owner->num_workers > 1)
self->seq_num = step_sequence_number_atomic(&self->owner->shared_seq_num);
Expand Down

0 comments on commit 197383c

Please sign in to comment.