You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/01/10 10:16:50 UTC
[1/3] git commit: Fixing LB cluster monitor handling at health stat
events
Updated Branches:
refs/heads/master 4e159ce1c -> bb5b4bf2b
Fixing LB cluster monitor handling at health stat events
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/9f312981
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/9f312981
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/9f312981
Branch: refs/heads/master
Commit: 9f31298145c9c0c658540dcdc1e7c6e29c008391
Parents: 9a6dd17
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Fri Jan 10 14:41:00 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Fri Jan 10 14:41:00 2014 +0530
----------------------------------------------------------------------
.../health/AutoscalerHealthStatReceiver.java | 217 +++++++++++++------
1 file changed, 149 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9f312981/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
index 35a5e1d..53c2541 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/AutoscalerHealthStatReceiver.java
@@ -462,7 +462,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Avg load avg event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -473,11 +486,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -497,7 +505,21 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Avg Memory Consumption event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
+
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -508,11 +530,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -531,8 +548,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Average Rif event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
-
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -543,11 +572,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -565,7 +589,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Grad of load avg event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -576,11 +613,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -599,7 +631,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Grad of Memory Consumption event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ };
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -610,11 +655,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -632,7 +672,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Gradient of Rif event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -643,11 +696,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -737,7 +785,7 @@ public class AutoscalerHealthStatReceiver implements Runnable {
memoryConsumption.setGradient(floatValue);
if (log.isDebugEnabled()) {
- log.debug(String.format("Meber grad of Memory Consumption event: [member] %s [value] %s", e.getMemberId(),
+ log.debug(String.format("Member grad of Memory Consumption event: [member] %s [value] %s", e.getMemberId(),
floatValue));
}
}
@@ -783,7 +831,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Second Derivation of load avg event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -794,11 +855,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -817,7 +873,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
log.debug(String.format("Second Derivation of Memory Consumption event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -828,11 +897,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -847,10 +911,23 @@ public class AutoscalerHealthStatReceiver implements Runnable {
Float floatValue = e.getValue();
if (log.isDebugEnabled()) {
- log.debug(String.format("Second dericvative of Rif event: [cluster] %s [network-partition] %s [value] %s",
+ log.debug(String.format("Second derivative of Rif event: [cluster] %s [network-partition] %s [value] %s",
clusterId, networkPartitionId, floatValue));
}
- AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(clusterId);
+ AutoscalerContext asCtx = AutoscalerContext.getInstance();
+ AbstractMonitor monitor;
+
+ if(asCtx.moniterExist(clusterId)){
+ monitor = asCtx.getMonitor(clusterId);
+ }else if(asCtx.lbMoniterExist(clusterId)){
+ monitor = asCtx.getLBMonitor(clusterId);
+ }else{
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
+ throw new RuntimeException(errMsg);
+ }
if(null != monitor){
NetworkPartitionContext networkPartitionContext = monitor.getNetworkPartitionCtxt(networkPartitionId);
if(null != networkPartitionContext){
@@ -861,11 +938,6 @@ public class AutoscalerHealthStatReceiver implements Runnable {
" [network partition] %s", networkPartitionId));
}
}
- } else {
-
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [cluster] %s", clusterId));
- }
}
}
@@ -881,16 +953,20 @@ public class AutoscalerHealthStatReceiver implements Runnable {
if(null == member){
if(log.isErrorEnabled()) {
- log.error(String.format("Member not found: [member] %s", memberId));
+ log.error(String.format("Member not found in the Topology: [member] %s", memberId));
}
return null;
}
AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(member.getClusterId());
if(null == monitor){
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [member] %s", memberId));
+ monitor = AutoscalerContext.getInstance().getLBMonitor(member.getClusterId());
+ if(null == monitor){
+
+ if(log.isErrorEnabled()) {
+ log.error(String.format("Cluster monitor is not available for : [member] %s", memberId));
+ }
+ return null;
}
- return null;
}
String networkPartitionId = findNetworkPartitionId(memberId);
MemberStatsContext memberStatsContext = monitor.getNetworkPartitionCtxt(networkPartitionId)
@@ -920,20 +996,23 @@ public class AutoscalerHealthStatReceiver implements Runnable {
if(null == member){
if(log.isErrorEnabled()) {
- log.error(String.format("Member not found: [member] %s", memberId));
+ log.error(String.format("Member not found in the Topology : [member] %s", memberId));
}
return null;
}
AbstractMonitor monitor = AutoscalerContext.getInstance().getMonitor(member.getClusterId());
if(null == monitor){
- if(log.isErrorEnabled()) {
- log.error(String.format("Cluster monitor is not available for : [member] %s", memberId));
+
+ monitor = AutoscalerContext.getInstance().getLBMonitor(member.getClusterId());
+ if(null == monitor){
+ if(log.isErrorEnabled()) {
+ log.error(String.format("Cluster monitor is not available for : [member] %s", memberId));
+ }
}
return null;
}
-
-
+
String networkPartitionId = findNetworkPartitionId(memberId);
MemberStatsContext memberStatsContext = monitor.getNetworkPartitionCtxt(networkPartitionId)
.getPartitionCtxt(member.getPartitionId())
@@ -993,8 +1072,10 @@ public class AutoscalerHealthStatReceiver implements Runnable {
}else if(asCtx.lbMoniterExist(clusterId)){
monitor = asCtx.getLBMonitor(clusterId);
}else{
- String errMsg = "A monitor is not found for this custer";
- log.error(errMsg);
+ String errMsg = "A monitor is not found for this cluster";
+ if(log.isErrorEnabled()){
+ log.error(String.format("A cluster monitor is not found in autoscaler context [cluster] %s", clusterId));
+ }
throw new RuntimeException(errMsg);
}
[3/3] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by la...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/bb5b4bf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/bb5b4bf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/bb5b4bf2
Branch: refs/heads/master
Commit: bb5b4bf2b8541418093cf9141bf2a1dbb2bf3d02
Parents: d0e944c 4e159ce
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Fri Jan 10 14:50:22 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Fri Jan 10 14:50:22 2014 +0530
----------------------------------------------------------------------
.../org.apache.stratos.autoscaler/pom.xml | 7 ++
.../apache/stratos/autoscaler/Constants.java | 9 +++
.../controller/InstanceNotificationClient.java | 71 ++++++++++++++++++++
3 files changed, 87 insertions(+)
----------------------------------------------------------------------
[2/3] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by la...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/d0e944cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/d0e944cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/d0e944cb
Branch: refs/heads/master
Commit: d0e944cbb8404983f9b3a907e6161a31abd5295f
Parents: 9f31298 a440e8d
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Fri Jan 10 14:41:18 2014 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Fri Jan 10 14:41:18 2014 +0530
----------------------------------------------------------------------
.../stratos/manager/deploy/service/Service.java | 19 ++++-
.../service/ServiceDeploymentManager.java | 79 ++++++++++++++++----
.../service/multitenant/MultiTenantService.java | 5 --
.../multitenant/lb/MultiTenantLBService.java | 5 --
.../ServiceAlreadyDeployedException.java | 49 ++++++++++++
.../listener/InstanceStatusListener.java | 7 ++
.../InstanceNotificationPublisher.java | 13 +++-
.../InstanceCleanupNotificationService.java | 9 ++-
.../notifier/InstanceCleanupClusterEvent.java | 38 ++++++++++
.../instance/notifier/InstanceCleanupEvent.java | 47 ------------
.../notifier/InstanceCleanupMemberEvent.java | 38 ++++++++++
...InstanceCleanupNotifierMessageProcessor.java | 6 +-
.../rest/endpoint/services/ServiceUtils.java | 28 ++++++-
.../rest/endpoint/services/StratosAdmin.java | 14 +++-
.../pom.xml | 1 +
service-stubs/pom.xml | 1 +
16 files changed, 273 insertions(+), 86 deletions(-)
----------------------------------------------------------------------