Fix rocksdb->levledb BytewiseComparator and inverted order of error in db/version_set.cc

Summary:
This is needed to make existing dbs be able to open and also because BytewiseComparator was not changed since leveldb.
The inverted order in the error message caused confusion prebiously

Test Plan: make; open existing db

Reviewers: leveldb, dhruba

Reviewed By: dhruba

Differential Revision: https://reviews.facebook.net/D13449
This commit is contained in:
Mayank Agarwal 2013-10-14 11:22:52 -07:00
parent fe3713961e
commit da2fd001a6
2 changed files with 7 additions and 7 deletions

View file

@ -1430,9 +1430,9 @@ Status VersionSet::Recover() {
if (s.ok()) {
if (edit.has_comparator_ &&
edit.comparator_ != icmp_.user_comparator()->Name()) {
s = Status::InvalidArgument(
edit.comparator_ + "does not match existing comparator ",
icmp_.user_comparator()->Name());
s = Status::InvalidArgument(icmp_.user_comparator()->Name(),
"does not match existing comparator " +
edit.comparator_);
}
}
@ -1548,9 +1548,9 @@ Status VersionSet::DumpManifest(Options& options, std::string& dscname,
if (s.ok()) {
if (edit.has_comparator_ &&
edit.comparator_ != icmp_.user_comparator()->Name()) {
s = Status::InvalidArgument(
edit.comparator_ + "does not match existing comparator ",
icmp_.user_comparator()->Name());
s = Status::InvalidArgument(icmp_.user_comparator()->Name(),
"does not match existing comparator " +
edit.comparator_);
}
}

View file

@ -19,7 +19,7 @@ class BytewiseComparatorImpl : public Comparator {
BytewiseComparatorImpl() { }
virtual const char* Name() const {
return "rocksdb.BytewiseComparator";
return "leveldb.BytewiseComparator";
}
virtual int Compare(const Slice& a, const Slice& b) const {