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

Allow 0 as Retry_Limit to disable retrying #3219

Merged
merged 5 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/fluent-bit/flb_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ struct flb_output_plugin {
struct mk_list _head;
};

// constants for retry_limit
#define FLB_OUT_RETRY_UNLIMITED -1
#define FLB_OUT_RETRY_NONE 0

/*
* Each initialized plugin must have an instance, same plugin may be
* loaded more than one time.
Expand Down
11 changes: 11 additions & 0 deletions src/flb_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,17 @@ static inline int handle_output_event(flb_pipefd_t fd, struct flb_config *config
flb_task_users_dec(task, FLB_TRUE);
}
else if (ret == FLB_RETRY) {
if (ins->retry_limit == FLB_OUT_RETRY_NONE) {
flb_info("[engine] chunk '%s' is not retried (no retry config): "
"task_id=%i, input=%s > output=%s (out_id=%i)",
flb_input_chunk_get_name(task->ic),
task_id,
flb_input_name(task->i_ins),
flb_output_name(ins), out_id);
flb_task_users_dec(task, FLB_TRUE);
return 0;
}

/* Create a Task-Retry */
retry = flb_task_retry_create(task, ins);
if (!retry) {
Expand Down
4 changes: 2 additions & 2 deletions src/flb_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,15 +601,15 @@ int flb_output_set_property(struct flb_output_instance *ins,
if (strcasecmp(tmp, "false") == 0 ||
strcasecmp(tmp, "off") == 0) {
/* No limits for retries */
ins->retry_limit = -1;
ins->retry_limit = FLB_OUT_RETRY_UNLIMITED;
}
else {
ins->retry_limit = atoi(tmp);
}
flb_sds_destroy(tmp);
}
else {
ins->retry_limit = 0;
ins->retry_limit = 1;
}
}
else if (strncasecmp("net.", k, 4) == 0 && tmp) {
Expand Down
2 changes: 1 addition & 1 deletion src/flb_sosreport.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ int flb_sosreport(struct flb_config *config)
ins_out->tls_key_passwd ? "*****" : "(not set)");
}
#endif
if (ins_out->retry_limit == -1) {
if (ins_out->retry_limit == FLB_OUT_RETRY_UNLIMITED) {
printf(" Retry Limit\t\tno limit\n");
}
else {
Expand Down