mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-01 02:37:02 +08:00
Merge pull request #7132 from sfc-gh-vgasiunas/vgasiunas-fix-version-check-for-downgrades
Fixing the problem with client getting stuck on server downgrades
This commit is contained in:
commit
b55863d958
@ -819,7 +819,7 @@ ACTOR Future<Void> connectionKeeper(Reference<Peer> self,
|
||||
.detail("PeerAddr", self->destination);
|
||||
|
||||
// Since the connection has closed, we need to check the protocol version the next time we connect
|
||||
self->incompatibleProtocolVersionNewer = false;
|
||||
self->compatible = true;
|
||||
}
|
||||
|
||||
if (self->destination.isPublic() &&
|
||||
@ -889,9 +889,9 @@ ACTOR Future<Void> connectionKeeper(Reference<Peer> self,
|
||||
Peer::Peer(TransportData* transport, NetworkAddress const& destination)
|
||||
: transport(transport), destination(destination), compatible(true), outgoingConnectionIdle(true),
|
||||
lastConnectTime(0.0), reconnectionDelay(FLOW_KNOBS->INITIAL_RECONNECTION_TIME), peerReferences(-1),
|
||||
incompatibleProtocolVersionNewer(false), bytesReceived(0), bytesSent(0), lastDataPacketSentTime(now()),
|
||||
outstandingReplies(0), pingLatencies(destination.isPublic() ? FLOW_KNOBS->PING_SAMPLE_AMOUNT : 1),
|
||||
lastLoggedTime(0.0), lastLoggedBytesReceived(0), lastLoggedBytesSent(0), timeoutCount(0),
|
||||
bytesReceived(0), bytesSent(0), lastDataPacketSentTime(now()), outstandingReplies(0),
|
||||
pingLatencies(destination.isPublic() ? FLOW_KNOBS->PING_SAMPLE_AMOUNT : 1), lastLoggedTime(0.0),
|
||||
lastLoggedBytesReceived(0), lastLoggedBytesSent(0), timeoutCount(0),
|
||||
protocolVersion(Reference<AsyncVar<Optional<ProtocolVersion>>>(new AsyncVar<Optional<ProtocolVersion>>())),
|
||||
connectOutgoingCount(0), connectIncomingCount(0), connectFailedCount(0),
|
||||
connectLatencies(destination.isPublic() ? FLOW_KNOBS->NETWORK_CONNECT_SAMPLE_AMOUNT : 1) {
|
||||
@ -1261,7 +1261,6 @@ ACTOR static Future<Void> connectionReader(TransportData* transport,
|
||||
state bool expectConnectPacket = true;
|
||||
state bool compatible = false;
|
||||
state bool incompatiblePeerCounted = false;
|
||||
state bool incompatibleProtocolVersionNewer = false;
|
||||
state NetworkAddress peerAddress;
|
||||
state ProtocolVersion peerProtocolVersion;
|
||||
state Reference<AuthorizedTenants> authorizedTenants = makeReference<AuthorizedTenants>();
|
||||
@ -1327,7 +1326,6 @@ ACTOR static Future<Void> connectionReader(TransportData* transport,
|
||||
uint64_t connectionId = pkt.connectionId;
|
||||
if (!pkt.protocolVersion.hasObjectSerializerFlag() ||
|
||||
!pkt.protocolVersion.isCompatible(g_network->protocolVersion())) {
|
||||
incompatibleProtocolVersionNewer = pkt.protocolVersion > g_network->protocolVersion();
|
||||
NetworkAddress addr = pkt.canonicalRemotePort
|
||||
? NetworkAddress(pkt.canonicalRemoteIp(), pkt.canonicalRemotePort)
|
||||
: conn->getPeerAddress();
|
||||
@ -1387,7 +1385,6 @@ ACTOR static Future<Void> connectionReader(TransportData* transport,
|
||||
.suppressFor(1.0)
|
||||
.detail("PeerAddr", NetworkAddress(pkt.canonicalRemoteIp(), pkt.canonicalRemotePort));
|
||||
peer->compatible = compatible;
|
||||
peer->incompatibleProtocolVersionNewer = incompatibleProtocolVersionNewer;
|
||||
if (!compatible) {
|
||||
peer->transport->numIncompatibleConnections++;
|
||||
incompatiblePeerCounted = true;
|
||||
@ -1405,7 +1402,6 @@ ACTOR static Future<Void> connectionReader(TransportData* transport,
|
||||
}
|
||||
peer = transport->getOrOpenPeer(peerAddress, false);
|
||||
peer->compatible = compatible;
|
||||
peer->incompatibleProtocolVersionNewer = incompatibleProtocolVersionNewer;
|
||||
if (!compatible) {
|
||||
peer->transport->numIncompatibleConnections++;
|
||||
incompatiblePeerCounted = true;
|
||||
@ -1745,8 +1741,7 @@ static ReliablePacket* sendPacket(TransportData* self,
|
||||
|
||||
// If there isn't an open connection, a public address, or the peer isn't compatible, we can't send
|
||||
if (!peer || (peer->outgoingConnectionIdle && !destination.getPrimaryAddress().isPublic()) ||
|
||||
(peer->incompatibleProtocolVersionNewer &&
|
||||
destination.token != Endpoint::wellKnownToken(WLTOKEN_PING_PACKET))) {
|
||||
(!peer->compatible && destination.token != Endpoint::wellKnownToken(WLTOKEN_PING_PACKET))) {
|
||||
TEST(true); // Can't send to private address without a compatible open connection
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -159,7 +159,6 @@ struct Peer : public ReferenceCounted<Peer> {
|
||||
double lastConnectTime;
|
||||
double reconnectionDelay;
|
||||
int peerReferences;
|
||||
bool incompatibleProtocolVersionNewer;
|
||||
int64_t bytesReceived;
|
||||
int64_t bytesSent;
|
||||
double lastDataPacketSentTime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user