Replace -1 as VERSION_HEADER constant for serialization

This commit is contained in:
Jingyu Zhou 2019-09-05 11:30:02 -07:00
parent f9357c5ad8
commit 2723922f5f
5 changed files with 10 additions and 7 deletions

View File

@ -24,6 +24,9 @@
#include "fdbclient/FDBTypes.h"
// The versioned message has wire format : -1, version, messages
static const int32_t VERSION_HEADER = -1;
static const char* typeString[] = { "SetValue",
"ClearRange",
"AddValue",

View File

@ -309,7 +309,7 @@ void peekMessagesFromMemory( LogRouterData* self, TLogPeekRequest const& req, Bi
}
currentVersion = it->first;
messages << int32_t(-1) << currentVersion;
messages << VERSION_HEADER << currentVersion;
}
messages << it->second.toStringRef();

View File

@ -70,7 +70,7 @@ void ILogSystem::ServerPeekCursor::nextMessage() {
hasMsg = false;
return;
}
if (*(int32_t*)rd.peekBytes(4) == -1) {
if (*(int32_t*)rd.peekBytes(4) == VERSION_HEADER) {
// A version
int32_t dummy;
Version ver;

View File

@ -1008,7 +1008,7 @@ void peekMessagesFromMemory( Reference<LogData> self, TLogPeekRequest const& req
}
currentVersion = it->first;
messages << int32_t(-1) << currentVersion;
messages << VERSION_HEADER << currentVersion;
}
messages << it->second.toStringRef();
@ -1152,7 +1152,7 @@ ACTOR Future<Void> tLogPeekMessages( TLogData* self, TLogPeekRequest req, Refere
for (auto &kv : kvs) {
auto ver = decodeTagMessagesKey(kv.key);
messages << int32_t(-1) << ver;
messages << VERSION_HEADER << ver;
messages.serializeBytes(kv.value);
}

View File

@ -1267,7 +1267,7 @@ void peekMessagesFromMemory( Reference<LogData> self, TLogPeekRequest const& req
}
currentVersion = it->first;
messages << int32_t(-1) << currentVersion;
messages << VERSION_HEADER << currentVersion;
}
messages << it->second.toStringRef();
@ -1447,7 +1447,7 @@ ACTOR Future<Void> tLogPeekMessages( TLogData* self, TLogPeekRequest req, Refere
for (auto &kv : kvs) {
auto ver = decodeTagMessagesKey(kv.key);
messages << int32_t(-1) << ver;
messages << VERSION_HEADER << ver;
messages.serializeBytes(kv.value);
}
@ -1519,7 +1519,7 @@ ACTOR Future<Void> tLogPeekMessages( TLogData* self, TLogPeekRequest req, Refere
ASSERT( valid == 0x01 );
ASSERT( length + sizeof(valid) == queueEntryData.size() );
messages << int32_t(-1) << entry.version;
messages << VERSION_HEADER << entry.version;
std::vector<StringRef> parsedMessages = wait(parseMessagesForTag(entry.messages, req.tag, logData->logRouterTags));
for (StringRef msg : parsedMessages) {