From 5d2c62822e0feb4620b4c68194a2a1d43bf7ca6f Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Tue, 28 Jan 2014 16:02:51 -0800 Subject: [PATCH] Only get the manifest file size if there is no error Summary: I came across this while working on column families. CorruptionTest::RecoverWriteError threw a SIGSEG because the descriptor_log_->file() was nullptr. I'm not sure why it doesn't happen in master, but better safe than sorry. @kailiu, can we get this in release, too? Test Plan: make check Reviewers: kailiu, dhruba, haobo Reviewed By: haobo CC: leveldb, kailiu Differential Revision: https://reviews.facebook.net/D15513 --- db/version_set.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index bf778c9a9..18081d748 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -1547,8 +1547,10 @@ Status VersionSet::LogAndApply(VersionEdit* edit, port::Mutex* mu, } } - // find offset in manifest file where this version is stored. - new_manifest_file_size = descriptor_log_->file()->GetFileSize(); + if (s.ok()) { + // find offset in manifest file where this version is stored. + new_manifest_file_size = descriptor_log_->file()->GetFileSize(); + } LogFlush(options_->info_log); mu->Lock();