From 34704d5c7bfb1dbcfeb4986bc8eb42f1f78481a0 Mon Sep 17 00:00:00 2001 From: Mike Kolupaev Date: Tue, 19 Jan 2016 11:46:52 -0800 Subject: [PATCH] [easy] Fixed a crash in LogAndApply() when CF creation failed Summary: That line used to dereference `column_family_data`, which is nullptr if we're creating a column family. Test Plan: `make -j check` Reviewers: sdong Reviewed By: sdong Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D52881 --- db/version_set.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index ba62177a7..193f1076f 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -758,7 +758,7 @@ uint64_t VersionStorageInfo::GetEstimatedActiveKeys() const { if (current_num_samples_ < file_count) { // casting to avoid overflowing - return + return static_cast( (est * static_cast(file_count) / current_num_samples_) ); @@ -2282,7 +2282,8 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data, Log(InfoLogLevel::ERROR_LEVEL, db_options_->info_log, "Error in committing version %lu to [%s]", (unsigned long)v->GetVersionNumber(), - column_family_data->GetName().c_str()); + column_family_data ? column_family_data->GetName().c_str() + : ""); delete v; if (new_descriptor_log) { Log(InfoLogLevel::INFO_LEVEL, db_options_->info_log, -- GitLab