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

output: Add MessagePack::UnpackError to unrecoverable case #2301

Merged
merged 1 commit into from
Feb 21, 2019
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
2 changes: 1 addition & 1 deletion lib/fluent/plugin/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ def next_flush_time
end
end

UNRECOVERABLE_ERRORS = [Fluent::UnrecoverableError, TypeError, ArgumentError, NoMethodError]
UNRECOVERABLE_ERRORS = [Fluent::UnrecoverableError, TypeError, ArgumentError, NoMethodError, MessagePack::UnpackError]

def try_flush
chunk = @buffer.dequeue_chunk
Expand Down
9 changes: 7 additions & 2 deletions test/plugin/test_output_as_buffered_backup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ def wait_flush(target_file)
}
end

test 'backup chunk without secondary' do
data('unrecoverable error' => Fluent::UnrecoverableError,
'type error' => TypeError,
'argument error' => ArgumentError,
'no method error' => NoMethodError,
'msgpack unpack error' => MessagePack::UnpackError)
test 'backup chunk without secondary' do |error_class|
Fluent::SystemConfig.overwrite_system_config('root_dir' => TMP_DIR) do
id = 'backup_test'
hash = {
Expand All @@ -188,7 +193,7 @@ def wait_flush(target_file)
@i.configure(config_element('ROOT', '', {'@id' => id}, [config_element('buffer', 'tag', hash)]))
@i.register(:write) { |chunk|
chunk_id = chunk.unique_id;
raise Fluent::UnrecoverableError, "yay, your #write must fail"
raise error_class, "yay, your #write must fail"
}

flush_chunks
Expand Down