I have a cluster using Infinispan in embedded + replication mode. Cluster size is just 2 systems which work in a active-standby mode.
I have a requirement to support rolling-upgrade of my application. I also have to not lose any cached data in the process.
To illustrate, Consider a simple class User in my application version v1:
public class User {
private String role;
private String firstName;
}
In version v2 I add an attribute to the User class:
public class User {
private String role;
private String firstName;
private String lastName;
}
My application gets upgraded as below:
- Cluster created with nodes n1(active) and n2(standby) with my application version v1 running on both those nodes. 10 user objects created and that forms a part of my key or value of an infinispan cache c1.
- Upgrade initiated on active node n1.
- n1 completes the pre-checks and invokes an upgrade on standby node n2.
- n2 disconnects itself from the cluster, reboots with the new version v2.
- n2 connects back to the cluster and this in-turn triggers the upgrade of node n1.
- n1 completes upgrade, comes up with the version v2 and joins the cluster.
- upgrade complete.
At step-5, when n2 connects back to the cluster, the User class in version v1 on node n1 is different from User class in version v2 on node n2.
Neither can I upgrade node n1, as that would result in a loss of data, before I sync up with node n2 nor can I expect node n2 to fetch all data and update its caches because of the model changes in c1's key/value.
So how do I handle such a scenario. The User class might also undergo changes such as deletion/change in data type of an attribute or removal of the class itself.
Are there any best practices or well known methods to handle rolling upgrade with infinispan caches?
I need to also handle cache updates on node n1 during the upgrade activity and make sure the node n2's caches(already in version v2) get these updates.
Note: I use 5.3.0 of Infinispan in embedded mode.