Return-Path: X-Original-To: apmail-helix-user-archive@minotaur.apache.org Delivered-To: apmail-helix-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8DBD5F092 for ; Wed, 8 May 2013 23:18:53 +0000 (UTC) Received: (qmail 21841 invoked by uid 500); 8 May 2013 23:18:53 -0000 Delivered-To: apmail-helix-user-archive@helix.apache.org Received: (qmail 21779 invoked by uid 500); 8 May 2013 23:18:53 -0000 Mailing-List: contact user-help@helix.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@helix.incubator.apache.org Delivered-To: mailing list user@helix.incubator.apache.org Received: (qmail 21771 invoked by uid 99); 8 May 2013 23:18:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 23:18:53 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nehzgnahz@gmail.com designates 209.85.223.169 as permitted sender) Received: from [209.85.223.169] (HELO mail-ie0-f169.google.com) (209.85.223.169) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 23:18:49 +0000 Received: by mail-ie0-f169.google.com with SMTP id u16so4353616iet.14 for ; Wed, 08 May 2013 16:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=lalq/jas+W7KdaF8acjAeqQ8y7eMd9+Qfq4q1kvR+NQ=; b=Ibm7RZrrhFpDkzOnWdXTK5bPf6EHy3EXbp4U6/Jq2pslzAIEq437ryobYAAe84DHKp /fEDYKuO6pRrptZe+qN3D6cKHSmAP/D0RVmJzg2hfZ2fX/Q/UcFbwxWVdGha0MDGBvlC JmGibo4NmaMjFry7CaKY5ePaxqsli/Ag/B+M20KdOZYbWCRMlspcZA+FQ1e+sfFxPrtU qYqnewjK6bmGDkxhtYEl7zccz1hcz7zmpN7GPUKwy13Uxtp1BgJqcYUPG/KF7N+TM2+6 aTWHLdMr9dXpy0eScqNo0qtzNusuMrPug8/rXUZ+K4hMK4V6TMdyf6KAJ55+up6G36uL juHA== MIME-Version: 1.0 X-Received: by 10.50.115.100 with SMTP id jn4mr3452270igb.92.1368055108672; Wed, 08 May 2013 16:18:28 -0700 (PDT) Received: by 10.42.117.136 with HTTP; Wed, 8 May 2013 16:18:28 -0700 (PDT) In-Reply-To: <690D8DFE-B50B-4989-AC74-C1E11B2ECD25@mac.com> References: <23CA11DC8830BA44A37C6B44B14D013C51A424D8@ESV4-MBX01.linkedin.biz> <1E039A17-5C5C-431B-9FE0-ED707697E5E6@mac.com> <690D8DFE-B50B-4989-AC74-C1E11B2ECD25@mac.com> Date: Wed, 8 May 2013 16:18:28 -0700 Message-ID: Subject: Re: Prevent failback to MASTER after failover From: Zhen Zhang To: user@helix.incubator.apache.org Content-Type: multipart/alternative; boundary=089e0116057cc9248404dc3d26ba X-Virus-Checked: Checked by ClamAV on apache.org --089e0116057cc9248404dc3d26ba Content-Type: text/plain; charset=ISO-8859-1 Hi Ming, I've added a test case for this, see TestMessageThrottle2.java. It is just a copy of your example with minor changes. https://github.com/apache/incubator-helix/blob/master/helix-core/src/test/java/org/apache/helix/integration/TestMessageThrottle2.java At step 3) when you are adding Node-1, there are three state transition messages need to be sent: T1) Offline->Slave for Node-1 T2) Master->Slave for Node-2 T3) Slave->Master for Node-1 Note that T1 and T2 can be sent together. If you are using instance level constraint like this: // limit one transition message at a time for each instance builder.addConstraintAttribute("MESSAGE_TYPE", "STATE_TRANSITION") .addConstraintAttribute("INSTANCE", ".*") .addConstraintAttribute("CONSTRAINT_VALUE", "1"); Then T1 and T2 will be sent together in the first round since T1 and T2 are sent to two different nodes. And T3 will be sent in the next round. If you are specifying a cluster level constraint like this: // limit one transition message at a time for the entire cluster builder.addConstraintAttribute("MESSAGE_TYPE", "STATE_TRANSITION") .addConstraintAttribute("CONSTRAINT_VALUE", "1"); Then helix controller will send T1 in the first round; then send T2; then T3. The reason why T1 is sent before T2 is because in the state model definition, you specified that Offline->Slave transition has a higher priority than Master->Slave. The test runs without problem. Here is the output: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Start zookeeper at localhost:2183 in thread main START TestMessageThrottle2 at Wed May 08 15:57:21 PDT 2013 Creating cluster: TestMessageThrottle2 Starting Controller{Cluster:TestMessageThrottle2, Port:12000, Zookeeper:localhost:2183} StatusPrinter.onIdealStateChange:state = MyResource, {IDEAL_STATE_MODE=AUTO, NUM_PARTITIONS=1, REPLICAS=2, STATE_MODEL_DEF_REF=MasterSlave}{}{MyResource=[node1, node2]} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{}{} StatusPrinter.onControllerChange:org.apache.helix.NotificationContext@6e3404f StatusPrinter.onInstanceConfigChange:instanceConfig = node2, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onLiveInstanceChange:liveInstance = node2, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60006}{}{} StatusPrinter.onIdealStateChange:state = MyResource, {IDEAL_STATE_MODE=AUTO, NUM_PARTITIONS=1, REPLICAS=2, STATE_MODEL_DEF_REF=MasterSlave}{}{MyResource=[node1, node2]} StatusPrinter.onInstanceConfigChange:instanceConfig = node2, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{}{} StatusPrinter.onLiveInstanceChange:liveInstance = node2, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60006}{}{} StatusPrinter.onControllerChange:org.apache.helix.NotificationContext@76d3046 StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node2=MASTER}}{} StatusPrinter.onInstanceConfigChange:instanceConfig = node1, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onInstanceConfigChange:instanceConfig = node2, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node2=MASTER}}{} StatusPrinter.onInstanceConfigChange:instanceConfig = node1, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onInstanceConfigChange:instanceConfig = node2, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onLiveInstanceChange:liveInstance = node1, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60008}{}{} StatusPrinter.onLiveInstanceChange:liveInstance = node2, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60006}{}{} StatusPrinter.onIdealStateChange:state = MyResource, {IDEAL_STATE_MODE=AUTO, NUM_PARTITIONS=1, REPLICAS=2, STATE_MODEL_DEF_REF=MasterSlave}{}{MyResource=[node1, node2]} StatusPrinter.onInstanceConfigChange:instanceConfig = node1, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onInstanceConfigChange:instanceConfig = node2, {HELIX_ENABLED=true, HELIX_HOST=localhost}{}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node2=MASTER}}{} StatusPrinter.onLiveInstanceChange:liveInstance = node1, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60008}{}{} StatusPrinter.onLiveInstanceChange:liveInstance = node2, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60006}{}{} StatusPrinter.onControllerChange:org.apache.helix.NotificationContext@b9deddb StatusPrinter.onLiveInstanceChange:liveInstance = node1, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60008}{}{} StatusPrinter.onLiveInstanceChange:liveInstance = node2, {HELIX_VERSION=${project.version}, LIVE_INSTANCE=11881@zzhang-mn1, SESSION_ID=13e865cfca60006}{}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node1=SLAVE, node2=MASTER}}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node1=SLAVE, node2=MASTER}}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node1=MASTER, node2=SLAVE}}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node1=MASTER, node2=SLAVE}}{} StatusPrinter.onExternalViewChange:externalView = MyResource, {BUCKET_SIZE=0}{MyResource={node1=MASTER, node2=SLAVE}}{} true: wait 489ms, ClusterStateVerifier$BestPossAndExtViewZkVerifier(TestMessageThrottle2@localhost :2183) END TestMessageThrottle2 at Wed May 08 15:57:30 PDT 2013 Thanks, Jason On Tue, May 7, 2013 at 8:25 PM, Ming Fang wrote: > Here is the code that I'm using to test > https://github.com/mingfang/apache-helix/tree/master/helix-example > > In ZAC.java line 134 is where I'm adding the constraint. > Line 204 is where I'm setting the state transition priority list. > > The steps I'm using is > 1-Run ZAC and wait for the StatusPrinter printouts > 2-Run Node2 and wait for it to transition to MASTER > 3-Run Node1 > At this point we see the problem where the external view will say > node1=SLAVE and node2=SLAVE. > > I can get the MessageThrottleStage to work by replacing line 205 with this > String key=item.toString(); > But even with message throttle working I can can't get the transition > sequence I need. > > > On May 7, 2013, at 11:43 AM, kishore g wrote: > > Can you give provide the code snippet you used to add the constraint. > Looks like you are setting constraint at INSTANCE level. > > > > > On Mon, May 6, 2013 at 9:52 PM, Ming Fang wrote: > >> I almost have this working. >> However I'm experiencing a potential bug in MessageThrottleStage line 205. >> The problem is that the throttleMap's key contains the INSTANCE= in >> it. >> This effectively makes trying to throttle across the entire cluster >> impossible. >> >> On Apr 24, 2013, at 2:07 PM, Zhen Zhang wrote: >> >> > 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" 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 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 >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> > >> >> > > --089e0116057cc9248404dc3d26ba Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Ming, I've added a test case for this, see TestMess= ageThrottle2.java. It is just a copy of your example with minor changes.


At step 3) when you are adding Node-1, there a= re three state transition messages need to be sent:
T1) Offline-&= gt;Slave for Node-1
T2) Master->Slave for Node-2
T3) Slave->Master for Node-1

Note that T1 and T= 2 can be sent together. If you are using instance level constraint like thi= s:
=A0 =A0// limit one transition message at a time for each= instance
=A0 =A0 builder.addConstraintAttribute("MESSAGE_TYPE", "= ;STATE_TRANSITION")
=A0 =A0 .addConstraintAttribute("INSTANCE", ".*&= quot;)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.addConstraintAttribute("C= ONSTRAINT_VALUE", "1");

Then T1 and T2 will be sent together in the first round since T1 and T2 ar= e sent to two different nodes. And T3 will be sent in the next round.

If you are specifying a cluster level const= raint like this:
=A0 =A0 // limit one transition messa= ge at a time for the entire cluster
=A0 =A0 builder.addConstraint= Attribute("MESSAGE_TYPE", "STATE_TRANSITION")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 .addConstraintAttribute("CONSTRAINT_V= ALUE", "1");

Then helix contr= oller will send T1 in the first round; then send T2; then T3. The reason wh= y T1 is sent before T2 is because in the state model definition, you specif= ied that Offline->Slave transition has a higher priority than Master->= ;Slave.

The test runs without problem. Here is the = output:

------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ------------------------
Start zookeeper at localhost:2183 in thread main
= START TestMessageThrottle2 at Wed May 08 15:57:21 PDT 2013
Creati= ng cluster: TestMessageThrottle2
Starting Controller{Cluster:Test= MessageThrottle2, Port:12000, Zookeeper:localhost:2183}
StatusPrinter.onIdealStateChange:state =3D MyResource, {IDEAL_STATE_MO= DE=3DAUTO, NUM_PARTITIONS=3D1, REPLICAS=3D2, STATE_MODEL_DEF_REF=3DMasterSl= ave}{}{MyResource=3D[node1, node2]}
StatusPrinter.onExternalViewC= hange:externalView =3D MyResource, {BUCKET_SIZE=3D0}{}{}
StatusPrinter.onControllerChange:org.apache.helix.NotificationContext@= 6e3404f
StatusPrinter.onInstanceConfigChange:instanceConfig =3D n= ode2, {HELIX_ENABLED=3Dtrue, HELIX_HOST=3Dlocalhost}{}{}
StatusPr= inter.onLiveInstanceChange:liveInstance =3D node2, {HELIX_VERSION=3D${proje= ct.version}, LIVE_INSTANCE=3D11881@zzhang-mn1, SESSION_ID=3D13e865cfca60006= }{}{}
StatusPrinter.onIdealStateChange:state =3D MyResource, {IDEAL_STATE_MO= DE=3DAUTO, NUM_PARTITIONS=3D1, REPLICAS=3D2, STATE_MODEL_DEF_REF=3DMasterSl= ave}{}{MyResource=3D[node1, node2]}
StatusPrinter.onInstanceConfi= gChange:instanceConfig =3D node2, {HELIX_ENABLED=3Dtrue, HELIX_HOST=3Dlocal= host}{}{}
StatusPrinter.onExternalViewChange:externalView =3D MyResource, {BUCKE= T_SIZE=3D0}{}{}
StatusPrinter.onLiveInstanceChange:liveInstance = =3D node2, {HELIX_VERSION=3D${project.version}, LIVE_INSTANCE=3D11881@zzhan= g-mn1, SESSION_ID=3D13e865cfca60006}{}{}
StatusPrinter.onControllerChange:org.apache.helix.NotificationContext@= 76d3046
StatusPrinter.onExternalViewChange:externalView =3D MyRes= ource, {BUCKET_SIZE=3D0}{MyResource=3D{node2=3DMASTER}}{}
StatusP= rinter.onInstanceConfigChange:instanceConfig =3D node1, {HELIX_ENABLED=3Dtr= ue, HELIX_HOST=3Dlocalhost}{}{}
StatusPrinter.onInstanceConfigChange:instanceConfig =3D node2, {HELIX_= ENABLED=3Dtrue, HELIX_HOST=3Dlocalhost}{}{}
StatusPrinter.onExter= nalViewChange:externalView =3D MyResource, {BUCKET_SIZE=3D0}{MyResource=3D{= node2=3DMASTER}}{}
StatusPrinter.onInstanceConfigChange:instanceConfig =3D node1, {HELIX_= ENABLED=3Dtrue, HELIX_HOST=3Dlocalhost}{}{}
StatusPrinter.onInsta= nceConfigChange:instanceConfig =3D node2, {HELIX_ENABLED=3Dtrue, HELIX_HOST= =3Dlocalhost}{}{}
StatusPrinter.onLiveInstanceChange:liveInstance =3D node1, {HELIX_VERS= ION=3D${project.version}, LIVE_INSTANCE=3D11881@zzhang-mn1, SESSION_ID=3D13= e865cfca60008}{}{}
StatusPrinter.onLiveInstanceChange:liveInstanc= e =3D node2, {HELIX_VERSION=3D${project.version}, LIVE_INSTANCE=3D11881@zzh= ang-mn1, SESSION_ID=3D13e865cfca60006}{}{}
StatusPrinter.onIdealStateChange:state =3D MyResource, {IDEAL_STATE_MO= DE=3DAUTO, NUM_PARTITIONS=3D1, REPLICAS=3D2, STATE_MODEL_DEF_REF=3DMasterSl= ave}{}{MyResource=3D[node1, node2]}
StatusPrinter.onInstanceConfi= gChange:instanceConfig =3D node1, {HELIX_ENABLED=3Dtrue, HELIX_HOST=3Dlocal= host}{}{}
StatusPrinter.onInstanceConfigChange:instanceConfig =3D node2, {HELIX_= ENABLED=3Dtrue, HELIX_HOST=3Dlocalhost}{}{}
StatusPrinter.onExter= nalViewChange:externalView =3D MyResource, {BUCKET_SIZE=3D0}{MyResource=3D{= node2=3DMASTER}}{}
StatusPrinter.onLiveInstanceChange:liveInstance =3D node1, {HELIX_VERS= ION=3D${project.version}, LIVE_INSTANCE=3D11881@zzhang-mn1, SESSION_ID=3D13= e865cfca60008}{}{}
StatusPrinter.onLiveInstanceChange:liveInstanc= e =3D node2, {HELIX_VERSION=3D${project.version}, LIVE_INSTANCE=3D11881@zzh= ang-mn1, SESSION_ID=3D13e865cfca60006}{}{}
StatusPrinter.onControllerChange:org.apache.helix.NotificationContext@= b9deddb
StatusPrinter.onLiveInstanceChange:liveInstance =3D node1= , {HELIX_VERSION=3D${project.version}, LIVE_INSTANCE=3D11881@zzhang-mn1, SE= SSION_ID=3D13e865cfca60008}{}{}
StatusPrinter.onLiveInstanceChange:liveInstance =3D node2, {HELIX_VERS= ION=3D${project.version}, LIVE_INSTANCE=3D11881@zzhang-mn1, SESSION_ID=3D13= e865cfca60006}{}{}
StatusPrinter.onExternalViewChange:externalVie= w =3D MyResource, {BUCKET_SIZE=3D0}{MyResource=3D{node1=3DSLAVE, node2=3DMA= STER}}{}
StatusPrinter.onExternalViewChange:externalView =3D MyResource, {BUCKE= T_SIZE=3D0}{MyResource=3D{node1=3DSLAVE, node2=3DMASTER}}{}
Statu= sPrinter.onExternalViewChange:externalView =3D MyResource, {BUCKET_SIZE=3D0= }{MyResource=3D{node1=3DMASTER, node2=3DSLAVE}}{}
StatusPrinter.onExternalViewChange:externalView =3D MyResource, {BUCKE= T_SIZE=3D0}{MyResource=3D{node1=3DMASTER, node2=3DSLAVE}}{}
Statu= sPrinter.onExternalViewChange:externalView =3D MyResource, {BUCKET_SIZE=3D0= }{MyResource=3D{node1=3DMASTER, node2=3DSLAVE}}{}
true: wait 489ms, ClusterStateVerifier$BestPossAndExtViewZkVerifier(Te= stMessageThrottle2@localhost:2183)
END TestMessageThrottle2 at We= d May 08 15:57:30 PDT 2013

Thank= s,
Jason




On Tue, May = 7, 2013 at 8:25 PM, Ming Fang <mingfang@mac.com> wrote:
Here is = the code that I'm using to test

In ZAC.java line 134 is where I'm adding the constr= aint.
Line 204 is where I'm setting the state transition prio= rity list.

The steps I'm using is
1-Run ZAC and wait for the StatusPrinter printouts
2-Run Node2 an= d wait for it to transition to MASTER
3-Run Node1
At th= is point we see the problem where the external view will say node1=3DSLAVE = and node2=3DSLAVE.

I can get the MessageThrottleStage to work by replacing= line 205 with this
=A0 =A0 =A0 =A0 =A0 String key=3Ditem.to= String();
But even with message throttle working I can can&= #39;t get the transition sequence I need.


On May 7, 2013, at= 11:43 AM, kishore g <g.kishore@gmail.com> wrote:

Can you give provide the code snippet you used to add the constraint. Looks= like you are setting constraint at INSTANCE level.


=


On Mon, May 6, 2013 at 9:52 PM, Ming Fang <mingfang@mac.com> = wrote:
I almost have this working.
However I'm experiencing a potential bug in MessageThrottleStage line 2= 05.
The problem is that the throttleMap's key contains the INSTANCE=3D<i= d> in it.
This effectively makes trying to throttle across the entire cluster impossi= ble.

On Apr 24, 2013, at 2:07 PM, Zhen Zhang <zzhang@linkedin.com> wrote:

> 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 =3D new ConstraintItemBuilder();
> builder.addConstraintAttribute("MESSAGE_TYPE", "STATE_T= RANSITION")
> =A0 .addConstraintAttribute("INSTANCE", ".*")
> =A0 .addConstraintAttribute("CONSTRAINT_VALUE", "1"= ;);
>
> // add the constraint to the cluster
> helixAdmin.setConstraint(clusterName, ConstraintType.MESSAGE_CONSTRAIN= T,
> "constraint1", builder.build());
>
>
> Message constraint is separate from ideal state and is not specified i= n
> 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 =A0hap= pen in
>>> parallel, Helix tries to parallelize the transitions as much a= s possible.
>>>
>>> There is another feature in Helix that allows you to sort the<= br> >>> transitions based on some priority.See STATE_TRANSITION_PRIORI= TY_LIST in
>>> state model definition. But after sorting Helix will send as m= any as
>>> possible in parallel without violating constraints.
>>>
>>> In your case you want the priority to be S-M, O-S, M-S but tha= t is not
>>> sufficient since O-S and M-S will be sent in parallel.
>>>
>>> Additionally, what you need to do is set contraint on transiti= on 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 seque= ntially
>>> per partition.
>>>
>>> We will try this =A0out and let you know, you dont need to cha= nge any
>>> code in Helix or your app. You should be able to tweak the con= figuration
>>> 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 i= s
>>> mandatory to talk to MASTER what happens when the nodes are st= arted for
>>> the first time or when all nodes crash and come back.
>>>
>>> thanks,
>>> Kishore G
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>




--089e0116057cc9248404dc3d26ba--