From aee17674a3b40d261de732185317220d02f3621a Mon Sep 17 00:00:00 2001 From: Masahiro Nakagawa Date: Wed, 26 Feb 2020 03:00:57 +0900 Subject: [PATCH] out_file: Revert #1995 changes Recent fluentd doesn't have thread interruption issue. Signed-off-by: Masahiro Nakagawa --- lib/fluent/plugin/out_file.rb | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/fluent/plugin/out_file.rb b/lib/fluent/plugin/out_file.rb index 76dc45fc12..006b74a281 100644 --- a/lib/fluent/plugin/out_file.rb +++ b/lib/fluent/plugin/out_file.rb @@ -17,7 +17,6 @@ require 'fileutils' require 'zlib' require 'time' -require 'tempfile' require 'fluent/plugin/output' require 'fluent/config/error' @@ -232,28 +231,10 @@ def write_without_compression(path, chunk) end def write_gzip_with_compression(path, chunk) - if @append - # This code will be removed after zlib/multithread bug is fixed. - # Use Tempfile to avoid broken gzip files: https://github.com/fluent/fluentd/issues/1903 - Tempfile.create('out_file-gzip-append') { |temp| - begin - writer = Zlib::GzipWriter.new(temp) - chunk.write_to(writer, compressed: :text) - ensure - writer.finish # avoid zlib finalizer warning - end - temp.rewind - - File.open(path, "ab", @file_perm) do |f| - IO.copy_stream(temp, f) - end - } - else - File.open(path, "ab", @file_perm) do |f| - gz = Zlib::GzipWriter.new(f) - chunk.write_to(gz, compressed: :text) - gz.close - end + File.open(path, "ab", @file_perm) do |f| + gz = Zlib::GzipWriter.new(f) + chunk.write_to(gz, compressed: :text) + gz.close end end