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' }.firstThe 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 <abe@enzou.tokyo>
6438674 to
b3a3aef
Compare
Signed-off-by: abetomo <abe@enzou.tokyo>
b3a3aef to
74c0a86
Compare
Signed-off-by: abetomo <abe@enzou.tokyo>
7b3315d to
d691d6f
Compare
* Change of order * Use `conf.for_every_workers?` instead of `conf.target_worker_ids.empty?`. Signed-off-by: abetomo <abe@enzou.tokyo>
daipom
left a comment
There was a problem hiding this comment.
LGTM.
Thanks for fixing this difficult issue!
|
Thanks! |
Which issue(s) this PR fixes:
Fixes #4051
What this PR does / why we need it:
Override
system_configonly ifconf.target_worker_ids.size >= 1.<worker N>or<worker 0-N>is not set,conf.target_worker_idsis empty.<system> workers N </system>is not set,system_config.workersdefaults to 1.Docs Changes:
Release Note:
system_config.workersatrun_configuresystem_config.workersvalue can be wrongly1at config check at startup.)Fluent::Plugin::Base::configure()toFluent::Config::Elementonly.Fluent::Config::Elementcould be passed toFluent::Plugin::Base::configure().)