mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
avoid creating pipeline if fetched config is the same as previous
This commit is contained in:
parent
fb40deee17
commit
c79ca77bd8
2 changed files with 9 additions and 5 deletions
|
@ -189,16 +189,20 @@ class LogStash::Agent
|
|||
# wrapped in @upgrade_mutex in the parent call `reload_state!`
|
||||
def reload_pipeline!(id)
|
||||
old_pipeline = @pipelines[id]
|
||||
if old_pipeline.config_str == fetch_config(old_pipeline.original_settings)
|
||||
@logger.debug("no configuration change for pipeline",
|
||||
:pipeline => id, :config => old_pipeline.config_str)
|
||||
return
|
||||
end
|
||||
|
||||
new_pipeline = create_pipeline(old_pipeline.original_settings)
|
||||
return if new_pipeline.nil?
|
||||
|
||||
if old_pipeline.config_str == new_pipeline.config_str
|
||||
@logger.debug("no configuration change for pipeline",
|
||||
:pipeline => id, :config => old_pipeline.config_str)
|
||||
elsif new_pipeline.non_reloadable_plugins.any?
|
||||
if new_pipeline.non_reloadable_plugins.any?
|
||||
@logger.error(I18n.t("logstash.agent.non_reloadable_config_reload"),
|
||||
:pipeline_id => id,
|
||||
:plugins => new_pipeline.non_reloadable_plugins.map(&:class))
|
||||
return
|
||||
else
|
||||
@logger.warn("fetched new config for pipeline. upgrading..",
|
||||
:pipeline => id, :config => new_pipeline.config_str)
|
||||
|
|
|
@ -179,7 +179,7 @@ describe LogStash::Agent do
|
|||
|
||||
context "when fetching a new state" do
|
||||
it "upgrades the state" do
|
||||
expect(subject).to receive(:fetch_config).and_return(second_pipeline_config)
|
||||
expect(subject).to receive(:fetch_config).twice.and_return(second_pipeline_config)
|
||||
expect(subject).to receive(:upgrade_pipeline).with(pipeline_id, kind_of(LogStash::Pipeline))
|
||||
subject.send(:reload_state!)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue