You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@helix.apache.org by Kanak Biscuitwala <ka...@hotmail.com> on 2013/10/02 18:57:06 UTC

Feedback on Potential APIs

Hi,

We've been working on some new APIs related to admin-type operations, as well as getting a cluster snapshot. I would really appreciate any feedback you have on the flow in the class below.

https://git-wip-us.apache.org/repos/asf?p=incubator-helix.git;a=blob;f=helix-examples/src/main/java/org/apache/helix/examples/NewModelExample.java;h=804df10aff12150af07742f1210cd9f12a432d94;hb=helix-logical-model

Thanks,
Kanak 		 	   		  

Re: Feedback on Potential APIs

Posted by Kanak Biscuitwala <kb...@linkedin.com>.
I agree with the transition comment. There's currently 2 ways to construct
a transition and that one is more for backwards compatibility.

Compare and swap is certainly a possibility. There's obviously some
starvation-related issues with that and the ability to express a delta is
pretty valuable to get around that issue, though. I'll think about it some
more.

There are a number of "atomic" operations and behavior left to design.
Some ways to do this include versioning and locking. I will work on safe
versions of all these admin operations and will send out a separate email.

Kanak

On 10/2/13 1:35 PM, "kishore g" <g....@gmail.com> wrote:

>Thanks Kanak, it looks very nice. I created a gist on github so that its
>easier to read.
>
>https://gist.github.com/kishoreg/85709d2e0dba9c893e92
>
>   
>clusterBuilder.addTransitionConstraint(Scope.resource(resource.getId()),
>        lockUnlock.getStateModelDefId(),
>Transition.from("RELEASED-LOCKED"), 1);
>
>
>Can we avoid having to parse the transition. Should we not construct
>Transition using two state instances (to and from)
>
>
>userConfig.setMapField("sampleMap", mapField);
>    ResourceConfig.Delta delta =
>        new 
>ResourceConfig.Delta(resource.getId()).setUserConfig(userConfig);
>    accessor.updateResource(resource.getId(), delta);
>
>How can we guarantee that underlying config is not updated by some one
>else. Can we instead have a compare and set api? something like
>currConfig = accessor.read();//return immutable table
>
>newConfig = doSomething(currConfig);
>boolean true = accessor.compareAndSet(currConfig,newConfig);
>
>
>thanks,
>Kishore G
>
>On Wed, Oct 2, 2013 at 9:57 AM, Kanak Biscuitwala
><ka...@hotmail.com>wrote:
>
>> Hi,
>>
>> We've been working on some new APIs related to admin-type operations, as
>> well as getting a cluster snapshot. I would really appreciate any
>>feedback
>> you have on the flow in the class below.
>>
>>
>> 
>>https://git-wip-us.apache.org/repos/asf?p=incubator-helix.git;a=blob;f=he
>>lix-examples/src/main/java/org/apache/helix/examples/NewModelExample.java
>>;h=804df10aff12150af07742f1210cd9f12a432d94;hb=helix-logical-model
>>
>> Thanks,
>> Kanak


Re: Feedback on Potential APIs

Posted by kishore g <g....@gmail.com>.
Thanks Kanak, it looks very nice. I created a gist on github so that its
easier to read.

https://gist.github.com/kishoreg/85709d2e0dba9c893e92

   clusterBuilder.addTransitionConstraint(Scope.resource(resource.getId()),
        lockUnlock.getStateModelDefId(), Transition.from("RELEASED-LOCKED"), 1);


Can we avoid having to parse the transition. Should we not construct
Transition using two state instances (to and from)


userConfig.setMapField("sampleMap", mapField);
    ResourceConfig.Delta delta =
        new ResourceConfig.Delta(resource.getId()).setUserConfig(userConfig);
    accessor.updateResource(resource.getId(), delta);

How can we guarantee that underlying config is not updated by some one
else. Can we instead have a compare and set api? something like
currConfig = accessor.read();//return immutable table

newConfig = doSomething(currConfig);
boolean true = accessor.compareAndSet(currConfig,newConfig);


thanks,
Kishore G

On Wed, Oct 2, 2013 at 9:57 AM, Kanak Biscuitwala <ka...@hotmail.com>wrote:

> Hi,
>
> We've been working on some new APIs related to admin-type operations, as
> well as getting a cluster snapshot. I would really appreciate any feedback
> you have on the flow in the class below.
>
>
> https://git-wip-us.apache.org/repos/asf?p=incubator-helix.git;a=blob;f=helix-examples/src/main/java/org/apache/helix/examples/NewModelExample.java;h=804df10aff12150af07742f1210cd9f12a432d94;hb=helix-logical-model
>
> Thanks,
> Kanak