You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@helix.apache.org by Vinayak Borkar <vi...@gmail.com> on 2014/12/14 05:37:00 UTC
Upgrade to 0.7.1
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
RE: Upgrade to 0.7.1
Posted by Zhen Zhang <zz...@linkedin.com>.
Hi Vinayak,
I created a simple test case using you code snippet, but couldn't repo the problem:
https://issues.apache.org/jira/browse/HELIX-561
Let's use this jira for further discussion.
Thanks,
Zhen
________________________________________
From: Vinayak Borkar [vinayakb@gmail.com]
Sent: Monday, December 15, 2014 12:22 PM
To: user@helix.apache.org
Subject: Re: Upgrade to 0.7.1
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 <vinayakb@gmail.com
> <ma...@gmail.com>> 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
>
Re: Upgrade to 0.7.1
Posted by Vinayak Borkar <vi...@gmail.com>.
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 <vinayakb@gmail.com
> <ma...@gmail.com>> 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
>
Re: Upgrade to 0.7.1
Posted by Zhen Zhang <ne...@gmail.com>.
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 <vi...@gmail.com> 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
>