Use AssumeVersion instead of Unversioned

Which lets us revert the unversioned serilaization of TLogSpillType
This commit is contained in:
Alex Miller 2019-10-03 15:59:09 -07:00
parent 9401a6941a
commit 28f6275f94
2 changed files with 2 additions and 25 deletions

View File

@ -741,7 +741,7 @@ struct TLogSpillType {
operator SpillType() const { return SpillType(type); } operator SpillType() const { return SpillType(type); }
template <class Ar> template <class Ar>
void serialize_unversioned(Ar& ar) { serializer(ar, type); } void serialize(Ar& ar) { serializer(ar, type); }
std::string toString() const { std::string toString() const {
switch( type ) { switch( type ) {
@ -762,29 +762,6 @@ struct TLogSpillType {
uint32_t type; uint32_t type;
}; };
template <class Ar> void load( Ar& ar, TLogSpillType& logSpillType ) { logSpillType.serialize_unversioned(ar); }
template <class Ar> void save( Ar& ar, TLogSpillType const& logSpillType ) { const_cast<TLogSpillType&>(logSpillType).serialize_unversioned(ar); }
template <>
struct struct_like_traits<TLogSpillType> : std::true_type {
using Member = TLogSpillType;
using types = pack<uint32_t>;
template <int i, class Context>
static const index_t<i, types>& get(const Member& m, Context&) {
if constexpr (i == 0) {
return m.type;
}
}
template <int i, class Type, class Context>
static const void assign(Member& m, const Type& t, Context&) {
if constexpr (i == 0) {
m = static_cast<TLogSpillType::SpillType>(t);
}
}
};
//Contains the amount of free and total space for a storage server, in bytes //Contains the amount of free and total space for a storage server, in bytes
struct StorageBytes { struct StorageBytes {
int64_t free; int64_t free;

View File

@ -2424,7 +2424,7 @@ ACTOR Future<Void> restorePersistentState( TLogData* self, LocalityData locality
DUMPTOKEN( recruited.confirmRunning ); DUMPTOKEN( recruited.confirmRunning );
ProtocolVersion protocolVersion = BinaryReader::fromStringRef<ProtocolVersion>( fProtocolVersions.get()[idx].value, Unversioned() ); ProtocolVersion protocolVersion = BinaryReader::fromStringRef<ProtocolVersion>( fProtocolVersions.get()[idx].value, Unversioned() );
TLogSpillType logSpillType = BinaryReader::fromStringRef<TLogSpillType>( fTLogSpillTypes.get()[idx].value, Unversioned() ); TLogSpillType logSpillType = BinaryReader::fromStringRef<TLogSpillType>( fTLogSpillTypes.get()[idx].value, AssumeVersion(protocolVersion) );
//We do not need the remoteTag, because we will not be loading any additional data //We do not need the remoteTag, because we will not be loading any additional data
logData = Reference<LogData>( new LogData(self, recruited, Tag(), true, id_logRouterTags[id1], id_txsTags[id1], UID(), protocolVersion, logSpillType, std::vector<Tag>()) ); logData = Reference<LogData>( new LogData(self, recruited, Tag(), true, id_logRouterTags[id1], id_txsTags[id1], UID(), protocolVersion, logSpillType, std::vector<Tag>()) );