I am trying to expand the Lockmanager example
http://helix.apache.org/0.6.2-incubating-docs/recipes/lock_manager.html to
introduce delay

tried doing something like this
IdealState state = admin.getResourceIdealState(clusterName, lockGroupName);
     state.setRebalanceDelay(100000);
     state.setDelayRebalanceEnabled(true);
     state.setRebalancerClassName(DelayedAutoRebalancer.class.getName());
     admin.setResourceIdealState(clusterName, lockGroupName, state);
     admin.rebalance(clusterName, lockGroupName, 1);

On killing a node there is immediate rebalancing which takes place. I was
hoping for a delay of 100 seconds before rebalancing but i am not seeing
that behavior


On Stopping localhost_12000 the locks are acquired immediately by
localhost_12001 and localhost_12002

on STARTING localhost_12000 the rebalance is again immediate.

localhost_12000 acquired lock:lock-group_11
localhost_12000 acquired lock:lock-group_7
localhost_12000 acquired lock:lock-group_0
localhost_12000 acquired lock:lock-group_4
STARTED localhost_12000
localhost_12001 releasing lock:lock-group_0
localhost_12001 releasing lock:lock-group_11
localhost_12002 releasing lock:lock-group_4
localhost_12002 releasing lock:lock-group_7


Here is the output
=========================================

STARTING localhost_12000
STARTING localhost_12001
STARTING localhost_12002
STARTED localhost_12001
STARTED localhost_12002
STARTED localhost_12000
localhost_12000 acquired lock:lock-group_11
localhost_12002 acquired lock:lock-group_10
localhost_12002 acquired lock:lock-group_9
localhost_12002 acquired lock:lock-group_3
localhost_12001 acquired lock:lock-group_2
localhost_12001 acquired lock:lock-group_1
localhost_12001 acquired lock:lock-group_8
localhost_12002 acquired lock:lock-group_6
localhost_12000 acquired lock:lock-group_4
localhost_12000 acquired lock:lock-group_0
localhost_12000 acquired lock:lock-group_7
localhost_12001 acquired lock:lock-group_5
lockName acquired By
======================================
lock-group_0 localhost_12000
lock-group_1 localhost_12001
lock-group_10 localhost_12002
lock-group_11 localhost_12000
lock-group_2 localhost_12001
lock-group_3 localhost_12002
lock-group_4 localhost_12000
lock-group_5 localhost_12001
lock-group_6 localhost_12002
lock-group_7 localhost_12000
lock-group_8 localhost_12001
lock-group_9 localhost_12002
Stopping localhost_12000
localhost_12000Interrupted
localhost_12002 acquired lock:lock-group_4
localhost_12001 acquired lock:lock-group_11
localhost_12002 acquired lock:lock-group_7
localhost_12001 acquired lock:lock-group_0
lockName acquired By
======================================
lock-group_0 localhost_12001
lock-group_1 localhost_12001
lock-group_10 localhost_12002
lock-group_11 localhost_12001
lock-group_2 localhost_12001
lock-group_3 localhost_12002
lock-group_4 localhost_12002
lock-group_5 localhost_12001
lock-group_6 localhost_12002
lock-group_7 localhost_12002
lock-group_8 localhost_12001
lock-group_9 localhost_12002
===Starting localhost_12000
STARTING localhost_12000
localhost_12000 acquired lock:lock-group_11
localhost_12000 acquired lock:lock-group_7
localhost_12000 acquired lock:lock-group_0
localhost_12000 acquired lock:lock-group_4
STARTED localhost_12000
localhost_12001 releasing lock:lock-group_0
localhost_12001 releasing lock:lock-group_11
localhost_12002 releasing lock:lock-group_4
localhost_12002 releasing lock:lock-group_7
lockName acquired By
======================================
lock-group_0 localhost_12000
lock-group_1 localhost_12001
lock-group_10 localhost_12002
lock-group_11 localhost_12000
lock-group_2 localhost_12001
lock-group_3 localhost_12002
lock-group_4 localhost_12000
lock-group_5 localhost_12001
lock-group_6 localhost_12002
lock-group_7 localhost_12000
lock-group_8 localhost_12001
lock-group_9 localhost_12002

Attachment: LockManagerCustomerStrategyDemo.java
Description: Binary data

Reply via email to