Repository: helix
Updated Branches:
refs/heads/master a09a18ac5 -> 44d7d2eb8
Allow to stop periodical rebalancer by resetting the clusterconfig. Add additional log for
debug.
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/3721c1fb
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/3721c1fb
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/3721c1fb
Branch: refs/heads/master
Commit: 3721c1fbcfbb3ea40be7d485f341b013753210c6
Parents: a09a18a
Author: Lei Xia <lxia@linkedin.com>
Authored: Wed Oct 3 19:07:30 2018 -0700
Committer: Junkai Xue <jxue@linkedin.com>
Committed: Thu Nov 1 14:38:21 2018 -0700
----------------------------------------------------------------------
.../java/org/apache/helix/HelixProperty.java | 8 ++++++-
.../helix/common/caches/AbstractDataCache.java | 7 ++++++
.../controller/GenericHelixController.java | 23 +++++++++++---------
3 files changed, 27 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/3721c1fb/helix-core/src/main/java/org/apache/helix/HelixProperty.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/HelixProperty.java b/helix-core/src/main/java/org/apache/helix/HelixProperty.java
index 2f3e68d..02e0594 100644
--- a/helix-core/src/main/java/org/apache/helix/HelixProperty.java
+++ b/helix-core/src/main/java/org/apache/helix/HelixProperty.java
@@ -124,6 +124,12 @@ public class HelixProperty {
result = 31 * result + (int) (_modifiedTime ^ (_modifiedTime >>> 32));
return result;
}
+
+ @Override
+ public String toString() {
+ return "Stat {" + "_version=" + _version + ", _creationTime=" + _creationTime
+ + ", _modifiedTime=" + _modifiedTime + '}';
+ }
}
private Stat _stat;
@@ -180,7 +186,7 @@ public class HelixProperty {
@Override
public String toString() {
- return _record.toString();
+ return "ZnRecord=" + _record.toString() + ", Stat=" + _stat.toString() ;
}
/**
http://git-wip-us.apache.org/repos/asf/helix/blob/3721c1fb/helix-core/src/main/java/org/apache/helix/common/caches/AbstractDataCache.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/common/caches/AbstractDataCache.java
b/helix-core/src/main/java/org/apache/helix/common/caches/AbstractDataCache.java
index 4bee84d..a4808b3 100644
--- a/helix-core/src/main/java/org/apache/helix/common/caches/AbstractDataCache.java
+++ b/helix-core/src/main/java/org/apache/helix/common/caches/AbstractDataCache.java
@@ -77,6 +77,8 @@ public abstract class AbstractDataCache {
}
}
+
+
List<T> reloadedProperty = accessor.getProperty(reloadKeys, true);
Iterator<PropertyKey> csKeyIter = reloadKeys.iterator();
for (T property : reloadedProperty) {
@@ -88,6 +90,11 @@ public abstract class AbstractDataCache {
}
}
+ LOG.info(reloadKeys.size() + " properties refreshed from zk.");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("refreshed keys: " + reloadKeys);
+ }
+
return refreshedPropertyMap;
}
http://git-wip-us.apache.org/repos/asf/helix/blob/3721c1fb/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
index eb75286..bd049f8 100644
--- a/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
+++ b/helix-core/src/main/java/org/apache/helix/controller/GenericHelixController.java
@@ -223,14 +223,13 @@ public class GenericHelixController implements IdealStateChangeListener,
eventType, _clusterName));
}
- // TODO who should stop this timer
/**
* Starts the rebalancing timer with the specified period. Start the timer if necessary;
If the
* period is smaller than the current period, cancel the current timer and use the new
period.
*/
- void startRebalancingTimer(long period, HelixManager manager) {
+ void startPeriodRebalance(long period, HelixManager manager) {
if (period != _timerPeriod) {
- logger.info("Controller starting timer at period " + period);
+ logger.info("Controller starting periodical rebalance timer at period " + period);
if (_periodicalRebalanceTimer != null) {
_periodicalRebalanceTimer.cancel();
}
@@ -240,19 +239,21 @@ public class GenericHelixController implements IdealStateChangeListener,
.scheduleAtFixedRate(new RebalanceTask(manager, ClusterEventType.PeriodicalRebalance),
_timerPeriod, _timerPeriod);
} else {
- logger.info("Controller already has timer at period " + _timerPeriod);
+ logger.info("Controller already has periodical rebalance timer at period " + _timerPeriod);
}
}
/**
- * Stops the rebalancing timer
+ * Stops the rebalancing timer.
*/
- void stopRebalancingTimers() {
+ void stopPeriodRebalance() {
+ logger.info("Controller stopping periodical rebalance timer at period " + _timerPeriod);
if (_periodicalRebalanceTimer != null) {
_periodicalRebalanceTimer.cancel();
_periodicalRebalanceTimer = null;
+ _timerPeriod = Long.MAX_VALUE;
+ logger.info("Controller stopped periodical rebalance timer at period " + _timerPeriod);
}
- _timerPeriod = Integer.MAX_VALUE;
}
private static PipelineRegistry createDefaultRegistry(String pipelineName) {
@@ -457,7 +458,7 @@ public class GenericHelixController implements IdealStateChangeListener,
if (context != null) {
if (context.getType() == Type.FINALIZE) {
- stopRebalancingTimers();
+ stopPeriodRebalance();
logger.info("Get FINALIZE notification, skip the pipeline. Event :" + event.getEventType());
return;
} else {
@@ -685,7 +686,9 @@ public class GenericHelixController implements IdealStateChangeListener,
}
if (minPeriod != Long.MAX_VALUE) {
- startRebalancingTimer(minPeriod, manager);
+ startPeriodRebalance(minPeriod, manager);
+ } else {
+ stopPeriodRebalance();
}
}
@@ -885,7 +888,7 @@ public class GenericHelixController implements IdealStateChangeListener,
}
public void shutdown() throws InterruptedException {
- stopRebalancingTimers();
+ stopPeriodRebalance();
terminateEventThread(_eventThread);
terminateEventThread(_taskEventThread);
|