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

fix not to raise error when out_forward is initialized as secondary #1313

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/fluent/plugin/out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ def configure(conf)
end
end

if @compress == :gzip && @buffer.compress == :text
@buffer.compress = :gzip
elsif @compress == :text && @buffer.compress == :gzip
log.info "buffer is compressed. If you also want to save the bandwidth of a network, Add `compress` configuration in <match>"
unless @as_secondary
if @compress == :gzip && @buffer.compress == :text
@buffer.compress = :gzip
elsif @compress == :text && @buffer.compress == :gzip
log.info "buffer is compressed. If you also want to save the bandwidth of a network, Add `compress` configuration in <match>"
end
end

if @nodes.empty?
Expand Down
19 changes: 19 additions & 0 deletions test/plugin/test_out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -573,4 +573,23 @@ def test_heartbeat_type_udp
timer.disable # call send_heartbeat at just once
timer.on_timer
end

def test_acts_as_secondary
i = Fluent::Plugin::ForwardOutput.new
conf = config_element(
'match',
'primary.**',
{'@type' => 'forward'},
[
config_element('server', '', {'host' => '127.0.0.1'}),
config_element('secondary', '', {}, [
config_element('server', '', {'host' => '192.168.1.2'}),
config_element('server', '', {'host' => '192.168.1.3'})
]),
]
)
assert_nothing_raised do
i.configure(conf)
end
end
end