Copilot commented on code in PR #6875: URL: https://github.com/apache/hbase/pull/6875#discussion_r2035552789
########## hbase-server/src/main/resources/hbase-webapps/master/peerConfigs.jsp: ########## @@ -0,0 +1,86 @@ +<%-- +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--%> + +<%@ page contentType="text/html;charset=UTF-8" + import="java.util.*" + import="org.apache.hadoop.hbase.master.HMaster" + import="org.apache.hadoop.hbase.replication.ReplicationPeerDescription" + import="org.apache.hadoop.hbase.replication.ReplicationPeerConfig" + import="org.apache.hadoop.hbase.client.replication.ReplicationPeerConfigUtil" + import="org.apache.hadoop.hbase.util.Strings" %> + +<% + HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER); + + List<ReplicationPeerDescription> peers = null; + if (master.getReplicationPeerManager() != null) { + peers = master.getReplicationPeerManager().listPeers(null); + } +%> + <table class="table table-striped"> + <tr> + <th>Peer Id</th> + <th>Cluster Key</th> + <th>Endpoint</th> + <th>State</th> + <th>IsSerial</th> + <th>Remote WAL</th> + <th>Sync Replication State</th> + <th>Bandwidth</th> + <th>ReplicateAll</th> + <th>Namespaces</th> + <th>Exclude Namespaces</th> + <th>Table Cfs</th> + <th>Exclude Table Cfs</th> + </tr> +<% if (peers != null && peers.size() > 0) { %> + <% for (ReplicationPeerDescription peer : peers) { %> + <% + String peerId = peer.getPeerId(); + ReplicationPeerConfig peerConfig = peer.getPeerConfig(); + %> + <tr> + <td><%= peerId %></td> + <td><%= peerConfig.getClusterKey() %></td> + <td><%= peerConfig.getReplicationEndpointImpl() %></td> + <td><%= peer.isEnabled() ? "ENABLED" : "DISABLED" %></td> + <td><%= peerConfig.isSerial() %></td> + <td><%= peerConfig.getRemoteWALDir() == null ? "" : peerConfig.getRemoteWALDir() %> + <td><%= peer.getSyncReplicationState() %> Review Comment: The table cell for the Remote WAL column is missing a closing </td> tag, which could break the HTML layout. Add the missing closing tag to ensure proper table structure. ```suggestion <td><%= peerConfig.getRemoteWALDir() == null ? "" : peerConfig.getRemoteWALDir() %></td> <td><%= peer.getSyncReplicationState() %></td> ``` ########## hbase-server/src/main/resources/hbase-webapps/master/catalogTables.jsp: ########## @@ -0,0 +1,82 @@ +<%-- +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--%> + +<%@ page contentType="text/html;charset=UTF-8" + import="java.util.*" + import="org.apache.hadoop.hbase.NamespaceDescriptor" + import="org.apache.hadoop.hbase.TableName" + import="org.apache.hadoop.hbase.master.HMaster" + import="org.apache.hadoop.hbase.quotas.QuotaUtil" + import="org.apache.hadoop.hbase.security.access.PermissionStorage" + import="org.apache.hadoop.hbase.security.visibility.VisibilityConstants" + import="org.apache.hadoop.hbase.tool.CanaryTool" + import="org.apache.hadoop.hbase.client.*" + import="org.apache.hadoop.hbase.util.MasterStatusConstants" %> + +<% + HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER); + + Map<String, Integer> frags = (Map<String, Integer>) request.getAttribute(MasterStatusConstants.FRAGS); + + List<TableDescriptor> sysTables = master.isInitialized() ? + master.listTableDescriptorsByNamespace(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR) : null; +%> + +<%if (sysTables != null && sysTables.size() > 0) { %> +<table class="table table-striped"> + <tr> + <th>Table Name</th> + <% if (frags != null) { %> + <th title="Fragmentation - Will be 0% after a major compaction and fluctuate during normal usage.">Frag.</th> + <% } %> + <th>Description</th> + </tr> + <% for (TableDescriptor systemTable : sysTables) { %> + <tr> + <% TableName tableName = systemTable.getTableName();%> + <td><a href="table.jsp?name=<%= tableName %>"><%= tableName %></a></td> + <% if (frags != null) { %> + <td align="center"><%= frags.get(tableName.getNameAsString()) != null ? frags.get(tableName.getNameAsString()) + "%" : "n/a" %></td> + <% } %> + <% String description = null; + if (tableName.equals(TableName.META_TABLE_NAME)){ + description = "The hbase:meta table holds references to all User Table regions."; + } else if (tableName.equals(CanaryTool.DEFAULT_WRITE_TABLE_NAME)){ + description = "The hbase:canary table is used to sniff the write availbility of" Review Comment: There is a spelling error: 'availbility' should be corrected to 'availability'. ```suggestion description = "The hbase:canary table is used to sniff the write availability of" ``` ########## hbase-server/src/main/resources/hbase-webapps/master/regionServerList_baseStats.jsp: ########## @@ -0,0 +1,127 @@ +<%-- +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--%> +<%@ page contentType="text/html;charset=UTF-8" + import="org.apache.hadoop.hbase.ServerName" + import="org.apache.hadoop.hbase.master.HMaster" + import="org.apache.hadoop.hbase.rsgroup.RSGroupUtil" + import="org.apache.hadoop.hbase.util.VersionInfo" + import="org.apache.hadoop.hbase.rsgroup.RSGroupInfo" + import="org.apache.hadoop.hbase.net.Address" + import="java.util.*" + import="org.apache.hadoop.hbase.ServerMetrics" + import="org.apache.hadoop.util.StringUtils" + import="org.apache.hadoop.hbase.util.MasterStatusConstants" + import="org.apache.hadoop.hbase.util.MasterStatusUtil" %> +<% + ServerName[] serverNames = (ServerName[]) request.getAttribute(MasterStatusConstants.SERVER_NAMES); + HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER); +%> + +<table id="baseStatsTable" class="tablesorter table table-striped"> + <thead> + <tr> + <th>ServerName</th> + <th>State</th> + <th>Start time</th> + <th>Last contact</th> + <th>Version</th> + <th>Requests Per Second</th> + <th>Num. Regions</th> + <% if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null) { %> + <% if (RSGroupUtil.isRSGroupEnabled(master.getConfiguration())) { %> + <th style="vertical-align: middle;" rowspan="2">RSGroup</th> + <% } %> + <% } %> + </tr> + </thead> + <tbody> + <% + int totalRegions = 0; + int totalRequestsPerSecond = 0; + int inconsistentNodeNum = 0; + String state = "Normal"; + String masterVersion = VersionInfo.getVersion(); + Set<ServerName> decommissionedServers = new HashSet<>(master.listDecommissionedRegionServers()); + String rsGroupName = "default"; + List<RSGroupInfo> groups; + Map<Address, RSGroupInfo> server2GroupMap = new HashMap<>(); + if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null + && RSGroupUtil.isRSGroupEnabled(master.getConfiguration())) { + groups = master.getRSGroupInfoManager().listRSGroups(); + groups.forEach(group -> { + group.getServers().forEach(address -> server2GroupMap.put(address, group)); + }); + } + for (ServerName serverName: serverNames) { + if (decommissionedServers.contains(serverName)) { + state = "Decommissioned"; + } + ServerMetrics sl = master.getServerManager().getLoad(serverName); + String version = master.getRegionServerVersion(serverName); + if (!masterVersion.equals(version)) { + inconsistentNodeNum ++; + } + + double requestsPerSecond = 0.0; + int numRegionsOnline = 0; + long lastContact = 0; + + if (sl != null) { + requestsPerSecond = sl.getRequestCountPerSecond(); + numRegionsOnline = sl.getRegionMetrics().size(); + totalRegions += sl.getRegionMetrics().size(); + totalRequestsPerSecond += sl.getRequestCountPerSecond(); + lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000; + } + long startcode = serverName.getStartcode(); + if (!master.isInMaintenanceMode() && master.getMasterCoprocessorHost() != null + && RSGroupUtil.isRSGroupEnabled(master.getConfiguration())) { + rsGroupName = server2GroupMap.get(serverName.getAddress()).getName(); + } Review Comment: This line assumes that server2GroupMap.get(serverName.getAddress()) is non-null. Add a null check before calling getName() to avoid a possible NullPointerException. ```suggestion RSGroupInfo groupInfo = server2GroupMap.get(serverName.getAddress()); if (groupInfo != null) { rsGroupName = groupInfo.getName(); } else { rsGroupName = "default"; } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
