From 4d2150d538b93310fbb72df72ad8bc1905f9cf7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 26 Apr 2018 17:35:12 +0200 Subject: [PATCH] Commit registry writes to stable storage to avoid corrupt registry files (#6877) * fsync contents of registry file to storage --- CHANGELOG.asciidoc | 1 + filebeat/registrar/registrar.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 4d42ea598c51..3af0a2e7f5fa 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -65,6 +65,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di - Fix panic when log prospector configuration fails to load. {issue}6800[6800] - Fix memory leak in log prospector when files cannot be read. {issue}6797[6797] - Add raw JSON to message field when JSON parsing fails. {issue}6516[6516] +- Commit registry writes to stable storage to avoid corrupt registry files. {pull}6877[6877] *Heartbeat* - Fix race due to updates of shared a map, that was not supposed to be shared between multiple go-routines. {issue}6616[6616] diff --git a/filebeat/registrar/registrar.go b/filebeat/registrar/registrar.go index 5177b51a32d1..0492d07dd735 100644 --- a/filebeat/registrar/registrar.go +++ b/filebeat/registrar/registrar.go @@ -280,6 +280,8 @@ func (r *Registrar) writeRegistry() error { return err } + // Commit the changes to storage to avoid corrupt registry files + f.Sync() // Directly close file because of windows f.Close()