DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
@Since(version = "2.19.0")
public class MyMessage {
private int id;
@Until(version = "2.20.0")
private String rmFld;
@Since(version = "2.20.0")
private String newFld;
@Override public boolean writeTo(ByteBuffer buf, MessageWriter writer, IgniteProductVersion destVer) {
if (destVer.lessThan(2, 19, 0))
throw new IgniteException("Must not send the message to destination node");
if (!writer.writeString(id))
return false;
if (destVer.lessThan(2, 20, 0)) {
if (!writer.writeString(rmFld))
return false;
}
if (destVer.greaterThanEqual(2, 20, 0)) {
if (!writer.writeString(newFld))
return false;
}
return true;
}
@Override public boolean readFrom(ByteBuffer buf, MessageReader reader, IgniteProductVersion srcVer) {
id = reader.readString();
if (srcVer.greaterThanEqual(2, 20, 0))
newFld = reader.readString();
else
newFld = null;
return true;
}
} |
Introduce Communication Protocol Version (ProtoVer) that depends on changes in the parts:
Message. Version is updated along with a commit that introduce a change.Message).Rules to support compatibility:
Rules to describe Message (must be automated and validated):
Message class or Message fields, but annotate it with @Until. @Since. All such fields must be optional, default value is null. Handling the nulls is care of Message consumer on the reader side.Removing annotated entities is allowed after current version is greater than (@Until + 1) or (@Since + 1).
FeatureTable. @Since Ignite version. This is required to track all affected places, and for removing the compatible code after Ignite version becomes greater than (@Since + 1)Messages. Only adding new fields is allowed.FeatureTable).Every communication feature must be declared with @since Ignite version.(@since - 1) version. @since version and notify release manager to drop support of old versions....