From 87944b8677a46226b15faff52a436558970b164d Mon Sep 17 00:00:00 2001 From: Yuta Iwama Date: Wed, 21 Aug 2019 16:46:54 +0900 Subject: [PATCH] Use File#size File#pos returns 0 since File#seek(0, IO::SEEK_SET) is called before Signed-off-by: Yuta Iwama --- lib/fluent/plugin/buffer/file_single_chunk.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fluent/plugin/buffer/file_single_chunk.rb b/lib/fluent/plugin/buffer/file_single_chunk.rb index 2a08ce5740..9d2dc7c08b 100644 --- a/lib/fluent/plugin/buffer/file_single_chunk.rb +++ b/lib/fluent/plugin/buffer/file_single_chunk.rb @@ -266,7 +266,7 @@ def create_new_chunk(path, metadata, perm) # If other cases are possible, we will change erorr handling with proper classes. raise BufferOverflowError, "can't create buffer file for #{path}. Stop creating buffer files: error = #{e}" end - + @state = :unstaged @bytesize = 0 @commit_position = @chunk.pos # must be 0 @@ -306,7 +306,7 @@ def load_existing_enqueued_chunk(path) @state = :queued @bytesize = @chunk.size - @commit_position = @chunk.pos + @commit_position = @chunk.size end end end