-
Notifications
You must be signed in to change notification settings - Fork 2k
router_config: wire every route merging into a shared output #12142
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1418,7 +1418,8 @@ static struct flb_output_instance *find_output_instance(struct flb_config *confi | |
| } | ||
|
|
||
| static int input_has_direct_route(struct flb_input_instance *in, | ||
| struct flb_output_instance *out) | ||
| struct flb_output_instance *out, | ||
| struct flb_route *route) | ||
| { | ||
| struct cfl_list *head; | ||
| struct flb_router_path *path; | ||
|
|
@@ -1427,9 +1428,16 @@ static int input_has_direct_route(struct flb_input_instance *in, | |
| return FLB_FALSE; | ||
| } | ||
|
|
||
| /* | ||
| * A direct route is identified by the (route, output) pair, not the output | ||
| * alone: several routes may target the same output (e.g. different | ||
| * conditions merging into one output), and each is evaluated independently | ||
| * at runtime via its own flb_router_path. Deduplicating on the output only | ||
| * would drop all but the first route, so compare the route too. | ||
| */ | ||
| cfl_list_foreach(head, &in->routes_direct) { | ||
| path = cfl_list_entry(head, struct flb_router_path, _head); | ||
| if (path->ins == out) { | ||
| if (path->ins == out && path->route == route) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With filesystem storage and AGENTS.md reference: AGENTS.md:L239-L241 Useful? React with 👍 / 👎. |
||
| return FLB_TRUE; | ||
| } | ||
| } | ||
|
|
@@ -1526,7 +1534,7 @@ int flb_router_apply_config(struct flb_config *config) | |
|
|
||
| route_output->ins = output_ins; | ||
|
|
||
| if (input_has_direct_route(input_ins, output_ins)) { | ||
| if (input_has_direct_route(input_ins, output_ins, route)) { | ||
| continue; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When two conditional routes target the same output and their predicates can both match a record, this route-aware dedupe leaves both
flb_router_paths inroutes_direct, but the later routing mask is only keyed by output id. A route-specific chunk for either route therefore passes both paths inflb_task_create()and creates duplicateflb_task_routeentries for the same output; the task status/data helpers then update only the first matchingroute->out, so delivery, retry, and accounting for that chunk can be duplicated or inconsistent. Please keep the per-route paths for condition evaluation, but collapse matched paths to one task route per output or carry route identity through the mask/task layer.AGENTS.md reference: AGENTS.md:L224-L228
Useful? React with 👍 / 👎.