Simplify MemTable::Update

Summary:
As suggested by testn in #1650

The Add is at the end of the function. Having a fallthough
will result in it being added twice.
Closes https://github.com/facebook/rocksdb/pull/1676

Differential Revision: D4331906

Pulled By: yiwu-arbug

fbshipit-source-id: 895c4a0
This commit is contained in:
Daniel Black 2016-12-17 00:05:05 -08:00 committed by Facebook Github Bot
parent 1a136c1f13
commit 342370f1d3

View file

@ -717,8 +717,7 @@ void MemTable::Update(SequenceNumber seq,
ValueType type;
SequenceNumber unused;
UnPackSequenceAndType(tag, &unused, &type);
switch (type) {
case kTypeValue: {
if (type == kTypeValue) {
Slice prev_value = GetLengthPrefixedSlice(key_ptr + key_length);
uint32_t prev_size = static_cast<uint32_t>(prev_value.size());
uint32_t new_size = static_cast<uint32_t>(value.size());
@ -735,13 +734,6 @@ void MemTable::Update(SequenceNumber seq,
return;
}
}
// fallthrough
default:
// If the latest value is kTypeDeletion, kTypeMerge or kTypeLogData
// we don't have enough space for update inplace
Add(seq, kTypeValue, key, value);
return;
}
}
}