From c48764ba4709c1f7825fb317043cd6ab51779ed2 Mon Sep 17 00:00:00 2001 From: Anand Ananthabhotla Date: Fri, 15 Jun 2018 17:53:12 -0700 Subject: [PATCH] Don't generate a notification for a 0 size SST (#4003) Summary: Don't call the OnTableFileCreated listener callback when a 0 size SST file gets created by Flush. Doing so causes an assertion failure in db_stress. It is also not correct behavior as we call env->DeleteFile() for such files right before the notification. Closes https://github.com/facebook/rocksdb/pull/4003 Differential Revision: D8461385 Pulled By: anand1976 fbshipit-source-id: ae92d4f921c2e2cff981ad58f4929ed8b609f35d --- db/builder.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/builder.cc b/db/builder.cc index 8e944983d..e57ad0208 100644 --- a/db/builder.cc +++ b/db/builder.cc @@ -222,9 +222,11 @@ Status BuildTable( } // Output to event logger and fire events. - EventHelpers::LogAndNotifyTableFileCreationFinished( - event_logger, ioptions.listeners, dbname, column_family_name, fname, - job_id, meta->fd, tp, reason, s); + if (!s.ok() || meta->fd.GetFileSize() > 0) { + EventHelpers::LogAndNotifyTableFileCreationFinished( + event_logger, ioptions.listeners, dbname, column_family_name, fname, + job_id, meta->fd, tp, reason, s); + } return s; }