Skip to content

Commit 2014915

Browse files
committed
Fix ASAN issue
1 parent e9ed28f commit 2014915

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

db/version_set.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ Status VersionSet::Recover(
18221822
// keeps track of column families in manifest that were not found in
18231823
// column families parameters. if those column families are not dropped
18241824
// by subsequent manifest records, Recover() will return failure status
1825-
std::set<int> column_families_not_found;
1825+
std::unordered_map<int, std::string> column_families_not_found;
18261826

18271827
// Read "CURRENT" file, which contains a pointer to the current manifest file
18281828
std::string manifest_filename;
@@ -1924,7 +1924,8 @@ Status VersionSet::Recover(
19241924
}
19251925
auto cf_options = cf_name_to_options.find(edit.column_family_name_);
19261926
if (cf_options == cf_name_to_options.end()) {
1927-
column_families_not_found.insert(edit.column_family_);
1927+
column_families_not_found.insert(
1928+
{edit.column_family_, edit.column_family_name_});
19281929
} else {
19291930
cfd = CreateColumnFamily(cf_options->second, &edit);
19301931
builders.insert({edit.column_family_, new Builder(cfd)});
@@ -2038,13 +2039,13 @@ Status VersionSet::Recover(
20382039
// in the argument. This is OK in read_only mode
20392040
if (read_only == false && column_families_not_found.size() > 0) {
20402041
std::string list_of_not_found;
2041-
for (auto cf : column_families_not_found) {
2042-
list_of_not_found += ", " + cf;
2042+
for (const auto& cf : column_families_not_found) {
2043+
list_of_not_found += ", " + cf.second;
20432044
}
20442045
list_of_not_found = list_of_not_found.substr(2);
20452046
s = Status::InvalidArgument(
2046-
"You have to open all column families. Column families not opened: %s",
2047-
list_of_not_found.c_str());
2047+
"You have to open all column families. Column families not opened: " +
2048+
list_of_not_found);
20482049
}
20492050

20502051
if (s.ok()) {

0 commit comments

Comments
 (0)