From a9a8586ebfddf15dbca699cf862385e2038ececa Mon Sep 17 00:00:00 2001 From: Masahiro Nakagawa Date: Fri, 10 May 2019 10:10:57 +0900 Subject: [PATCH] storage_local: Call fsync for XFS. ref #2373 Signed-off-by: Masahiro Nakagawa --- lib/fluent/plugin/storage_local.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fluent/plugin/storage_local.rb b/lib/fluent/plugin/storage_local.rb index d6107efbb1..9fa88dfcb7 100644 --- a/lib/fluent/plugin/storage_local.rb +++ b/lib/fluent/plugin/storage_local.rb @@ -133,7 +133,7 @@ def save tmp_path = @path + '.tmp' begin json_string = Yajl::Encoder.encode(@store, pretty: @pretty_print) - open(tmp_path, 'w:utf-8', @mode){ |io| io.write json_string } + open(tmp_path, 'w:utf-8', @mode) { |io| io.write json_string; io.fsync } File.rename(tmp_path, @path) rescue => e log.error "failed to save data for plugin storage to file", path: @path, tmp: tmp_path, error: e