aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2022-08-10 11:00:11 +0200
committerHarald Musum <musum@yahooinc.com>2022-08-10 11:00:11 +0200
commitba799333cc6cce9ffaee557e81d8161550229636 (patch)
tree61d089bb812081221b840904f39d2c9f34e6ac68
parent04c39c7c801b8a15713424cb40543c1205b47c62 (diff)
Simplify and cleanup
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java6
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/status/LegacyIndexPageRequestHandler.java69
2 files changed, 27 insertions, 48 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java
index 9a6183379d9..d5905f36313 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/FleetController.java
@@ -153,10 +153,8 @@ public class FleetController implements NodeListener, SlobrokListener, SystemSta
new ClusterStateRequestHandler(stateVersionTracker));
this.statusRequestRouter.addHandler(
"^/$",
- new LegacyIndexPageRequestHandler(
- timer, options.showLocalSystemStatesInEventLog, cluster,
- masterElectionHandler, stateVersionTracker,
- eventLog, timer.getCurrentTimeInMillis(), dataExtractor));
+ new LegacyIndexPageRequestHandler(timer, cluster, masterElectionHandler, stateVersionTracker, eventLog,
+ timer.getCurrentTimeInMillis(), dataExtractor));
propagateOptions();
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/status/LegacyIndexPageRequestHandler.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/status/LegacyIndexPageRequestHandler.java
index 6b2b77f1e7d..96dc114c734 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/status/LegacyIndexPageRequestHandler.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/status/LegacyIndexPageRequestHandler.java
@@ -2,13 +2,11 @@
package com.yahoo.vespa.clustercontroller.core.status;
import com.yahoo.vdslib.distribution.ConfiguredNode;
-import com.yahoo.vdslib.distribution.Distribution;
import com.yahoo.vdslib.distribution.Group;
import com.yahoo.vdslib.state.Node;
import com.yahoo.vdslib.state.NodeType;
import com.yahoo.vespa.clustercontroller.core.ClusterStateBundle;
import com.yahoo.vespa.clustercontroller.core.ClusterStateHistoryEntry;
-import com.yahoo.vespa.clustercontroller.core.ClusterStatsAggregator;
import com.yahoo.vespa.clustercontroller.core.ContentCluster;
import com.yahoo.vespa.clustercontroller.core.EventLog;
import com.yahoo.vespa.clustercontroller.core.FleetControllerOptions;
@@ -39,14 +37,15 @@ public class LegacyIndexPageRequestHandler implements StatusPageServer.RequestHa
private final EventLog eventLog;
private final long startedTime;
private final RunDataExtractor data;
- private final boolean showLocalSystemStatesInLog;
- public LegacyIndexPageRequestHandler(Timer timer, boolean showLocalSystemStatesInLog, ContentCluster cluster,
+ public LegacyIndexPageRequestHandler(Timer timer,
+ ContentCluster cluster,
MasterElectionHandler masterElectionHandler,
StateVersionTracker stateVersionTracker,
- EventLog eventLog, long startedTime, RunDataExtractor data) {
+ EventLog eventLog,
+ long startedTime,
+ RunDataExtractor data) {
this.timer = timer;
- this.showLocalSystemStatesInLog = showLocalSystemStatesInLog;
this.cluster = cluster;
this.masterElectionHandler = masterElectionHandler;
this.stateVersionTracker = stateVersionTracker;
@@ -75,17 +74,9 @@ public class LegacyIndexPageRequestHandler implements StatusPageServer.RequestHa
content.append("<tr><td>Cluster controller uptime:</td><td align=\"right\">" + RealTimer.printDuration(currentTime - startedTime) + "</td></tr></table>");
if (masterElectionHandler.isAmongNthFirst(data.getOptions().stateGatherCount)) {
// Table overview of all the nodes
- writeHtmlState(cluster,
- new VdsClusterHtmlRenderer(),
- content,
- timer,
- stateVersionTracker.getVersionedClusterStateBundle(),
- stateVersionTracker.getAggregatedClusterStats(),
- data.getOptions().storageDistribution,
- data.getOptions(),
- eventLog);
+ writeHtmlState(cluster, content, timer, stateVersionTracker, data.getOptions(), eventLog);
// Current cluster state and cluster state history
- writeHtmlState(stateVersionTracker, content, request);
+ writeHtmlState(stateVersionTracker, content);
} else {
// Overview of current config
data.getOptions().writeHtmlState(content);
@@ -102,14 +93,7 @@ public class LegacyIndexPageRequestHandler implements StatusPageServer.RequestHa
return response;
}
- public void writeHtmlState(StateVersionTracker stateVersionTracker, StringBuilder sb, StatusPageServer.HttpRequest request) {
- boolean showLocal = showLocalSystemStatesInLog;
- if (request.hasQueryParameter("showlocal")) {
- showLocal = true;
- } else if (request.hasQueryParameter("hidelocal")) {
- showLocal = false;
- }
-
+ public void writeHtmlState(StateVersionTracker stateVersionTracker, StringBuilder sb) {
sb.append("<h2 id=\"clusterstates\">Cluster states</h2>\n");
writeClusterStates(sb, stateVersionTracker.getVersionedClusterStateBundle());
@@ -169,26 +153,24 @@ public class LegacyIndexPageRequestHandler implements StatusPageServer.RequestHa
}
private void writeHtmlState(ContentCluster cluster,
- VdsClusterHtmlRenderer vdsClusterHtmlRenderer,
StringBuilder sb,
Timer timer,
- ClusterStateBundle state,
- ClusterStatsAggregator statsAggregator,
- Distribution distribution,
+ StateVersionTracker stateVersionTracker,
FleetControllerOptions options,
EventLog eventLog) {
+ VdsClusterHtmlRenderer renderer = new VdsClusterHtmlRenderer();
+ VdsClusterHtmlRenderer.Table table = renderer.createNewClusterHtmlTable(cluster.getName(), cluster.getSlobrokGenerationCount());
- VdsClusterHtmlRenderer.Table table = vdsClusterHtmlRenderer.createNewClusterHtmlTable(cluster.getName(), cluster.getSlobrokGenerationCount());
-
+ ClusterStateBundle state = stateVersionTracker.getVersionedClusterStateBundle();
if (state.clusterFeedIsBlocked()) { // Implies FeedBlock != null
table.appendRaw("<h3 style=\"color: red\">Cluster feeding is blocked!</h3>\n");
table.appendRaw(String.format("<p>Summary: <strong>%s</strong></p>\n",
HtmlTable.escape(state.getFeedBlockOrNull().getDescription())));
}
- final List<Group> groups = LeafGroups.enumerateFrom(distribution.getRootGroup());
+ List<Group> groups = LeafGroups.enumerateFrom(options.storageDistribution.getRootGroup());
- for (final Group group : groups) {
+ for (Group group : groups) {
assert (group != null);
String localName = group.getUnixStylePath();
assert (localName != null);
@@ -198,18 +180,17 @@ public class LegacyIndexPageRequestHandler implements StatusPageServer.RequestHa
storeNodeInfo(cluster, configuredNode.index(), NodeType.STORAGE, storageNodeInfoByIndex);
storeNodeInfo(cluster, configuredNode.index(), NodeType.DISTRIBUTOR, distributorNodeInfoByIndex);
}
- table.renderNodes(
- storageNodeInfoByIndex,
- distributorNodeInfoByIndex,
- timer,
- state,
- statsAggregator,
- options.minMergeCompletionRatio,
- options.maxPrematureCrashes,
- options.clusterFeedBlockLimit,
- eventLog,
- cluster.getName(),
- localName);
+ table.renderNodes(storageNodeInfoByIndex,
+ distributorNodeInfoByIndex,
+ timer,
+ state,
+ stateVersionTracker.getAggregatedClusterStats(),
+ options.minMergeCompletionRatio,
+ options.maxPrematureCrashes,
+ options.clusterFeedBlockLimit,
+ eventLog,
+ cluster.getName(),
+ localName);
}
table.addTable(sb, options.stableStateTimePeriod);
}