broken db: fix assertion in leveldb::InternalKey::Encode, mark base as corrupt
This commit is contained in:
parent
a2fb086d07
commit
7d060117fa
@ -150,7 +150,11 @@ class InternalKey {
|
|||||||
AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t));
|
AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); }
|
bool DecodeFrom(const Slice& s) {
|
||||||
|
rep_.assign(s.data(), s.size());
|
||||||
|
return !rep_.empty();
|
||||||
|
}
|
||||||
|
|
||||||
Slice Encode() const {
|
Slice Encode() const {
|
||||||
assert(!rep_.empty());
|
assert(!rep_.empty());
|
||||||
return rep_;
|
return rep_;
|
||||||
|
@ -88,8 +88,7 @@ void VersionEdit::EncodeTo(std::string* dst) const {
|
|||||||
static bool GetInternalKey(Slice* input, InternalKey* dst) {
|
static bool GetInternalKey(Slice* input, InternalKey* dst) {
|
||||||
Slice str;
|
Slice str;
|
||||||
if (GetLengthPrefixedSlice(input, &str)) {
|
if (GetLengthPrefixedSlice(input, &str)) {
|
||||||
dst->DecodeFrom(str);
|
return dst->DecodeFrom(str);
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user