helix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zhen Zhang <zzh...@linkedin.com>
Subject Re: Prevent failback to MASTER after failover
Date Wed, 24 Apr 2013 18:07:58 GMT
Hi Ming, to set the constraint so that only one transition message at a
time, you can take a look at the test example of TestMessageThrottle. You
need to add a message constraint as follows:

// build a message constraint
ConstraintItemBuilder builder = new ConstraintItemBuilder();
builder.addConstraintAttribute("MESSAGE_TYPE", "STATE_TRANSITION")
   .addConstraintAttribute("INSTANCE", ".*")
   .addConstraintAttribute("CONSTRAINT_VALUE", "1");

// add the constraint to the cluster
helixAdmin.setConstraint(clusterName, ConstraintType.MESSAGE_CONSTRAINT,
"constraint1", builder.build());


Message constraint is separate from ideal state and is not specified in
the JSON file of the ideal state.

Thanks,
Jason




On 4/23/13 2:40 PM, "Ming Fang" <mingfang@mac.com> wrote:

>Kishore 
>
>It sounds like the solution is to set the constraints so that only one
>transition at a time.
>Can you point me to an example of how to do this?
>Also is this something I can set in the JSON file?
>
>Sent from my iPad
>
>On Apr 1, 2013, at 11:32 AM, kishore g <g.kishore@gmail.com> wrote:
>
>> Hi Ming,
>> 
>> Thanks for the detailed explanation. Actually 5 & 6  happen in
>>parallel, Helix tries to parallelize the transitions as much as possible.
>> 
>> There is another feature in Helix that allows you to sort the
>>transitions based on some priority.See STATE_TRANSITION_PRIORITY_LIST in
>>state model definition. But after sorting Helix will send as many as
>>possible in parallel without violating constraints.
>> 
>> In your case you want the priority to be S-M, O-S, M-S but that is not
>>sufficient since O-S and M-S will be sent in parallel.
>> 
>> Additionally, what you need to do is set contraint on transition that
>>there should be only one transition per partition at any time. This will
>>basically make the order 6 5 7 and they will be executed sequentially
>>per partition.
>> 
>> We will try this  out and let you know, you dont need to change any
>>code in Helix or your app. You should be able to tweak the configuration
>>dynamically.
>> 
>> We will try to think of solving this in a more elegant way. I will file
>>a jira and add more info.
>> 
>> I also want to ask this question, when a node comes up if it is
>>mandatory to talk to MASTER what happens when the nodes are started for
>>the first time or when all nodes crash and come back.
>> 
>> thanks,
>> Kishore G
>> 
>> 
>> 
>> 
>> 
>> 
>> 


Mime
View raw message