You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@helix.apache.org by Neutron sharc <ne...@gmail.com> on 2016/04/14 19:45:46 UTC

how to monitor partition state change

Hi Helix team,

I'm testing helix in our environment.  I have an example resource with
4 partitions, each partition has 1 master 2 slaves replicas.  When a
replica state changes (for example, a master demotes to slave, a slave
promotes to master),  my application shall react by updating the
routing logic.  How to get notifications when the state of a partition
changes?

I tried the code snippet from SPECTATOR example
(http://helix.apache.org/0.6.5-docs/tutorial_spectator.html).  That
sample only monitors external view change.  I ran the helix
"quickstart" example to create many state transitions in a test
cluster, so I believe the external view changes multiple times.
However the spectator callback is triggered only once on the external
view change.

Any comments appreciated.


-neutron

Re: how to monitor partition state change

Posted by kishore g <g....@gmail.com>.
Hi,

Yes, that is the expected behavior. If there are N changes to External
View, you can get any where between 1 to N callbacks. But Helix guarantees
that spectator will always receive the last change (its timeline
consistent). This ensures that you will always read the final routing
table.

The reasoning is in most cases, spectator should not care about every
change instead just work on the final state.

Is there any reason why you need to know each and every change. Can you
confirm  external view you read via callback matches the final state (If
not, that would be a bug)



On Thu, Apr 14, 2016 at 10:45 AM, Neutron sharc <ne...@gmail.com>
wrote:

> Hi Helix team,
>
> I'm testing helix in our environment.  I have an example resource with
> 4 partitions, each partition has 1 master 2 slaves replicas.  When a
> replica state changes (for example, a master demotes to slave, a slave
> promotes to master),  my application shall react by updating the
> routing logic.  How to get notifications when the state of a partition
> changes?
>
> I tried the code snippet from SPECTATOR example
> (http://helix.apache.org/0.6.5-docs/tutorial_spectator.html).  That
> sample only monitors external view change.  I ran the helix
> "quickstart" example to create many state transitions in a test
> cluster, so I believe the external view changes multiple times.
> However the spectator callback is triggered only once on the external
> view change.
>
> Any comments appreciated.
>
>
> -neutron
>