Hi Zhen,
Thanks for your response.
Here is a snippet of code that creates HelixManager and registers the
state model factory. As I indicated in my previous email, this code used
to work with 0.6.2-incubating. All I did was to do whatever I had to do
to fix the compilation issues.
hManager = HelixManagerFactory.getZKHelixManager(clusterName, id,
InstanceType.PARTICIPANT, zkAddr);
hManager.getStateMachineEngine().registerStateModelFactory(StateMachineType.MASTER_SLAVE.getStateModelDefId(),
new MasterSlaveStateModelFactory(this));
hManager.connect();
hManager.addExternalViewChangeListener(router);
hManager.addInstanceConfigChangeListener(router);
hManager.addLiveInstanceChangeListener(router);
The state model class looks like this:
public class MasterSlaveStateModel extends TransitionHandler {
@Transition(to = "SLAVE", from = "OFFLINE")
public void onBecomeSlaveFromOffline(Message message,
NotificationContext context) throws Exception {
...
}
@Transition(to = "MASTER", from = "SLAVE")
public void onBecomeMasterFromSlave(Message message,
NotificationContext context) throws Exception {
...
}
@Transition(to = "SLAVE", from = "MASTER")
public void onBecomeSlaveFromMaster(Message message,
NotificationContext context) throws Exception {
...
}
@Transition(to = "OFFLINE", from = "SLAVE")
public void onBecomeOfflineFromSlave(Message message,
NotificationContext context) throws Exception {
...
}
@Transition(to = "DROPPED", from = "OFFLINE")
public void onBecomeDroppedFromOffline(Message message,
NotificationContext context) throws Exception {
...
}
@Transition(to = "OFFLINE", from = "ERROR")
public void onBecomeOfflineFromError(Message message,
NotificationContext context) throws Exception {
...
}
...
}
Thanks,
Vinayak
On 12/15/14, 11:52 AM, Zhen Zhang wrote:
Hi Vinayak,
We need to add documentation for upgrading 0.6.x to 0.7.1:
https://issues.apache.org/jira/browse/HELIX-560
0.7.1 provides a new set of API. it's not backward compatible in the
sense that all errors should be exposed in compile time. Regarding the
state machine receiving two OFFLINE->SLAVE transitions, could you please
share how you create helix-manager and register state model. Also what's
your state model look like?
Thanks,
Jason
On Sat, Dec 13, 2014 at 8:37 PM, Vinayak Borkar <[email protected]
<mailto:[email protected]>> wrote:
Hi Guys,
Is there a document/checklist to help upgrade and application from
0.6.x to 0.7.1?
Here are a few things I had to do to get my code to compile:
1. Change StateModelFactory -> StateTransitionHandlerFactory
2. Change StateModel -> TransitionHandler
3. Use PartitionId and StateModelDefId instead of String.
Although the code compiles, it does not work as it used to in 0.6.x.
For example, I am seeing my state machine (Master Slave) receive an
OFFLINE->SLAVE transition twice.
Thanks,
Vinayak