Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

build forward and backward compatibility into the protocol #871

Closed
rade opened this issue Jun 8, 2015 · 3 comments
Closed

build forward and backward compatibility into the protocol #871

rade opened this issue Jun 8, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@rade
Copy link
Member

rade commented Jun 8, 2015

ATM weave peers must all be running the same version of the protocol; both sides of a new connection will shut it down when detecting that the protocol version of the remote peer differs from their own.

This makes upgrading weave when the protocol version has changed a major event.

We should build some mechanisms into the protocol for handling forward and backward compatibility.

Extracted from #403 (comment)

@rade rade added the feature label Jun 8, 2015
@rade rade added this to the next milestone Jun 8, 2015
@rade
Copy link
Member Author

rade commented Jun 8, 2015

Here's one way to do this...

The basic premise is that a particular version of weave has perfect knowledge of all the previously released versions and may contain special code to speak some such older versions. Peers could announce to each other what protocol versions they support, as part of the initial handshake. They would then pick the highest version supported by both, and communicate using that. If no such version can be found then the connection is closed and a suitable error logged, similar to what happens now when the protocol versions do not match.

@bboreham
Copy link
Contributor

I would normally just have a bracket [oldest supported version, newest supported version], and you have to support everything in-between. Yes, a set is more general, but maybe YAGNI.

@rade
Copy link
Member Author

rade commented Jun 13, 2015

Good point re oldest+newest. Perhaps we could even just stick to transmitting the newest version, as we do now, and leaving it up to the peer with the higher version to close the connection if the other peer's version is too old. I can think of two downsides:

  • the lower-versioned peer won't be able to log an informative error message
  • the higher-versioned peer might receive protocol messages it doesn't understand

@rade rade self-assigned this Jun 15, 2015
@rade rade changed the title build forward and backward compatibilty into the protocol build forward and backward compatibility into the protocol Jun 15, 2015
rade added a commit to rade/weave that referenced this issue Jun 16, 2015
We now first exchange a very minimal header, consisting of just the
name of the protocol ("weave") and the min and max version (encoded as
a byte each) we support. This leaves all other details of the
protocol, including the contents of of the handshake, open.

Peers agree to communicate using the maximum mutually supported
version. We record this in the LocalConnection, though atm nothing is
making use of that information.

We set a shorter than normal deadline (10s instead of 60s) for the
header exchange, so we detect version mismatches, garbage, or
non-responsive remotes quickly.

We reset the protocol version to '1' since this is a fresh start; old
weaves will not be able to parse the header.

Closes weaveworks#871.
@dpw dpw closed this as completed in #920 Jun 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants