diff --git a/fdbrpc/FlowTransport.actor.cpp b/fdbrpc/FlowTransport.actor.cpp index caba4077dc..175688f35c 100644 --- a/fdbrpc/FlowTransport.actor.cpp +++ b/fdbrpc/FlowTransport.actor.cpp @@ -967,11 +967,7 @@ ACTOR static void deliver(TransportData* self, } auto receiver = self->endpoints.get(destination.token); - if (receiver) { - if (!authorizedTenants->trusted && !receiver->isPublic()) { - TraceEvent(SevWarnAlways, "AttemptedRPCToPrivatePrevented").detail("From", peerAddress); - throw connection_failed(); - } + if (receiver && (authorizedTenants->trusted || receiver->isPublic())) { if (!checkCompatible(receiver->peerCompatibilityPolicy(), reader.protocolVersion())) { return; } @@ -996,6 +992,9 @@ ACTOR static void deliver(TransportData* self, } } else if (destination.token.first() & TOKEN_STREAM_FLAG) { // We don't have the (stream) endpoint 'token', notify the remote machine + if (receiver) { + TraceEvent(SevWarnAlways, "AttemptedRPCToPrivatePrevented").detail("From", peerAddress); + } if (destination.token.first() != -1) { if (self->isLocalAddress(destination.getPrimaryAddress())) { sendLocal(self, diff --git a/fdbserver/CMakeLists.txt b/fdbserver/CMakeLists.txt index 3d11057800..912137a015 100644 --- a/fdbserver/CMakeLists.txt +++ b/fdbserver/CMakeLists.txt @@ -233,6 +233,7 @@ set(FDBSERVER_SRCS workloads/MiniCycle.actor.cpp workloads/MutationLogReaderCorrectness.actor.cpp workloads/PrivateEndpoints.actor.cpp + workloads/GetRangeStream.actor.cpp workloads/ParallelRestore.actor.cpp workloads/Performance.actor.cpp workloads/Ping.actor.cpp diff --git a/flow/ObjectSerializer.h b/flow/ObjectSerializer.h index c320aeb1a3..2e9f6c064d 100644 --- a/flow/ObjectSerializer.h +++ b/flow/ObjectSerializer.h @@ -31,9 +31,9 @@ using ContextVariableMap = std::unordered_map; template struct LoadContext { Ar* ar; - std::shared_ptr variables = nullptr; - LoadContext(Ar* ar, ContextVariableMap* variables = nullptr) : ar(ar), variables(variables) {} + LoadContext(Ar* ar) : ar(ar) {} + Arena& arena() { return ar->arena(); } ProtocolVersion protocolVersion() const { return ar->protocolVersion(); } @@ -53,24 +53,6 @@ struct LoadContext { void addArena(Arena& arena) { arena = ar->arena(); } LoadContext& context() { return *this; } - - template - bool variable(std::string_view name, T* val) { - auto p = variables->insert(std::make_pair(name, val)); - return p.second; - } - - template - T& variable(std::string_view name) { - auto res = variables->at(name); - return *reinterpret_cast(res); - } - - template - T const& variable(std::string_view name) const { - auto res = variables->at(name); - return *reinterpret_cast(res); - } }; template @@ -93,22 +75,22 @@ template class _ObjectReader { protected: Optional mProtocolVersion; - bool versionSet = false; - LoadContext context; + std::shared_ptr variables; public: - _ObjectReader() : context(static_cast(this)) {} ProtocolVersion protocolVersion() const { return mProtocolVersion.get(); } void setProtocolVersion(ProtocolVersion v) { mProtocolVersion = v; } - void setContextVariableMap(std::shared_ptr cvm) { context.variables = cvm; } + void setContextVariableMap(std::shared_ptr const& cvm) { variables = cvm; } template void deserialize(FileIdentifier file_identifier, Items&... items) { + LoadContext context(static_cast(this)); const uint8_t* data = static_cast(this)->data(); if (read_file_identifier(data) != file_identifier) { // Some file identifiers are changed in 7.0, so file identifier mismatches // are expected during a downgrade from 7.0 to 6.3 - bool expectMismatch = mProtocolVersion.get() >= ProtocolVersion(0x0FDB00B070000000LL); + bool expectMismatch = mProtocolVersion.get() >= ProtocolVersion(0x0FDB00B070000000LL) && + currentProtocolVersion < ProtocolVersion(0x0FDB00B070000000LL); { TraceEvent te(expectMismatch ? SevInfo : SevError, "MismatchedFileIdentifier"); if (expectMismatch) { @@ -130,17 +112,20 @@ public: template bool variable(std::string_view name, T* val) { - return context.template variable(name, val); + auto p = variables->insert(std::make_pair(name, val)); + return p.second; } template T& variable(std::string_view name) { - return context.template variable(name); + auto res = variables->at(name); + return *reinterpret_cast(res); } template T const& variable(std::string_view name) const { - return context.template variable(name); + auto res = variables->at(name); + return *reinterpret_cast(res); } };