}
// other half of transformation is in DefinitionsUpdateResponseVerbHandler.
private static Message makeMigrationMessage(Collection<IColumn> migrations, int version) throws IOException
{
FastByteArrayOutputStream bout = new FastByteArrayOutputStream();
DataOutputStream dout = new DataOutputStream(bout);
dout.writeInt(migrations.size());
// riddle me this: how do we know that these binary values (which contained serialized row mutations) are compatible
// with the destination? Further, since these migrations may be old, how do we know if they are compatible with
// the current version? The bottom line is that we don't. For this reason, running migrations from a new node
// to an old node will be a crap shoot. Pushing migrations from an old node to a new node should work, so long
// as the oldest migrations are only one version old. We need a way of flattening schemas so that this isn't a
// problem during upgrades.
for (IColumn col : migrations)
{
assert col instanceof Column;
ByteBufferUtil.writeWithLength(col.name(), dout);
ByteBufferUtil.writeWithLength(col.value(), dout);
}
dout.close();
byte[] body = bout.toByteArray();
return new Message(FBUtilities.getBroadcastAddress(), StorageService.Verb.DEFINITIONS_UPDATE, body, version);
}