From 2e3d407778ac3ee3e6fd7ad73e7b77540b78407c Mon Sep 17 00:00:00 2001 From: Sagar Vemuri Date: Thu, 22 Mar 2018 17:34:52 -0700 Subject: [PATCH] Fsync after writing global seq number in ExternalSstFileIngestionJob Summary: Fsync after writing global sequence number to the ingestion file in ExternalSstFileIngestionJob. Otherwise the file metadata could be incorrect. Closes https://github.com/facebook/rocksdb/pull/3644 Differential Revision: D7373813 Pulled By: sagar0 fbshipit-source-id: 4da2c9e71a8beb5c08b4ac955f288ee1576358b8 --- HISTORY.md | 2 +- db/external_sst_file_ingestion_job.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 4e9e4ca6e..824582713 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -5,7 +5,7 @@ ### New Features ### Bug Fixes - +* Fsync after writing global seq number to the ingestion file in ExternalSstFileIngestionJob. ## 5.13.0 (3/20/2018) ### Public API Change diff --git a/db/external_sst_file_ingestion_job.cc b/db/external_sst_file_ingestion_job.cc index 89b977ce0..b37440e47 100644 --- a/db/external_sst_file_ingestion_job.cc +++ b/db/external_sst_file_ingestion_job.cc @@ -510,6 +510,9 @@ Status ExternalSstFileIngestionJob::AssignGlobalSeqnoForIngestedFile( std::string seqno_val; PutFixed64(&seqno_val, seqno); status = rwfile->Write(file_to_ingest->global_seqno_offset, seqno_val); + if (status.ok()) { + status = rwfile->Fsync(); + } if (status.ok()) { file_to_ingest->assigned_seqno = seqno; }