-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix value of system_config.workers
at run_configure
#4066
Fix value of system_config.workers
at run_configure
#4066
Conversation
Thanks for the fix! The status of this PR is Draft. Please let me know which part is TODO. |
Thanks for your comments! |
Thanks! We need tests for this issue! In addition, this problem is difficult. Hard to know what was wrong and how we should fix it. The specification history related to this is as follows.
What went wrong in which process? |
#2651 is related. If there is no Since |
Thanks so much! There was nothing wrong at the point of #1507 and #2292. I will see #2651! |
It is hard to understand the purpose of code changes in #2651... I'm concerned about the following points.
I don't think all the points should be solved now. The current fix may be enough to solve the issue #4051, but it may be better to leave some code comments for the future. |
Thanks for your comment! |
Thanks!
I have checked this, and I understand this fix allows us to validate the config with the correct I used this config. <system>
workers 8
</system>
<worker 0>
<source>
@id A
@type sample
tag test
</source>
</worker>
<worker 1-2>
<source>
@id B
@type sample
tag test
</source>
</worker>
<source>
@id C
@type sample
tag test
</source>
<match test.**>
@type stdout
</match> I added a log for debugging to --- a/lib/fluent/plugin/in_sample.rb
+++ b/lib/fluent/plugin/in_sample.rb
@@ -63,6 +63,7 @@ module Fluent::Plugin
def configure(conf)
super
+ log.info id: @id, workers: system_config.workers
@sample_index = 0
config = conf.elements.select{|e| e.name == 'storage' }.first The result of master branch:
Before starting Fluentd, The expected
When applying this fix, these values are as expected! |
Summarize what we've learned so far.
fluentd/lib/fluent/config/element.rb Lines 256 to 258 in 6c649d1
fluentd/lib/fluent/plugin/base.rb Lines 56 to 61 in 6c649d1
Originally, there was no need to overwrite Lines 213 to 216 in 6c649d1
fluentd/lib/fluent/plugin/base.rb Line 56 in 6c649d1
We need However, with After starting Fluentd, the This PR completely fixes this problem. |
355ca5f
to
6438674
Compare
|
Thanks for the fix and adding tests! I will see this soon. |
Thanks for the review! |
Override `system_config` only if `conf.target_worker_ids.size >= 1`. * If `<worker N>` or `<worker 0-N>` is not set, `conf.target_worker_ids` is empty. * If `<system> workers N </system>` is not set, `system_config.workers` defaults to 1. Signed-off-by: abetomo <[email protected]>
6438674
to
b3a3aef
Compare
Signed-off-by: abetomo <[email protected]>
b3a3aef
to
74c0a86
Compare
Signed-off-by: abetomo <[email protected]>
7b3315d
to
d691d6f
Compare
* Change of order * Use `conf.for_every_workers?` instead of `conf.target_worker_ids.empty?`. Signed-off-by: abetomo <[email protected]>
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.
LGTM.
Thanks for fixing this difficult issue!
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.
LGTM
Thanks! |
Which issue(s) this PR fixes:
Fixes #4051
What this PR does / why we need it:
Override
system_config
only ifconf.target_worker_ids.size >= 1
.<worker N>
or<worker 0-N>
is not set,conf.target_worker_ids
is empty.<system> workers N </system>
is not set,system_config.workers
defaults to 1.Docs Changes:
Release Note:
system_config.workers
atrun_configure
system_config.workers
value can be wrongly1
at config check at startup.)Fluent::Plugin::Base::configure()
toFluent::Config::Element
only.Fluent::Config::Element
could be passed toFluent::Plugin::Base::configure()
.)