Merge pull request #2513 from etschannen/feature-efficient-single-keyrange
do not serialize the begin key for single key ranges
This commit is contained in:
commit
ea59021d86
|
@ -110,8 +110,18 @@ struct MutationRef {
|
|||
|
||||
template <class Ar>
|
||||
void serialize( Ar& ar ) {
|
||||
if (!ar.isDeserializing && type == ClearRange && equalsKeyAfter(param1, param2)) {
|
||||
StringRef empty;
|
||||
serializer(ar, type, param2, empty);
|
||||
} else {
|
||||
serializer(ar, type, param1, param2);
|
||||
}
|
||||
if (ar.isDeserializing && type == ClearRange && param2 == StringRef() && param1 != StringRef()) {
|
||||
ASSERT(param1[param1.size()-1] == '\x00');
|
||||
param2 = param1;
|
||||
param1 = param2.substr(0, param2.size()-1);
|
||||
}
|
||||
}
|
||||
|
||||
// These masks define which mutation types have particular properties (they are used to implement isSingleKeyMutation() etc)
|
||||
enum {
|
||||
|
|
|
@ -282,7 +282,18 @@ struct KeyRangeRef {
|
|||
|
||||
template <class Ar>
|
||||
force_inline void serialize(Ar& ar) {
|
||||
if (!ar.isDeserializing && equalsKeyAfter(begin, end)) {
|
||||
StringRef empty;
|
||||
serializer(ar, const_cast<KeyRef&>(end), empty);
|
||||
} else {
|
||||
serializer(ar, const_cast<KeyRef&>(begin), const_cast<KeyRef&>(end));
|
||||
}
|
||||
if (ar.isDeserializing && end == StringRef() && begin != StringRef()) {
|
||||
ASSERT(begin[begin.size()-1] == '\x00');
|
||||
const_cast<KeyRef&>(end) = begin;
|
||||
const_cast<KeyRef&>(begin) = end.substr(0, end.size()-1);
|
||||
}
|
||||
|
||||
if( begin > end ) {
|
||||
TraceEvent("InvertedRange").detail("Begin", begin).detail("End", end);
|
||||
throw inverted_range();
|
||||
|
|
Loading…
Reference in New Issue