diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java index 010eba95709..5eca87d45bc 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java @@ -78,9 +78,12 @@ import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.util.threads.Threads; import org.apache.accumulo.monitor.next.InformationFetcher; +import org.apache.accumulo.monitor.rest.bulkImports.BulkImport; +import org.apache.accumulo.monitor.rest.bulkImports.BulkImportInformation; import org.apache.accumulo.server.AbstractServer; import org.apache.accumulo.server.ServerContext; import org.apache.accumulo.server.util.TableInfoUtil; +import org.apache.accumulo.server.util.bulkCommand.ListBulk; import org.apache.thrift.transport.TTransportException; import org.apache.zookeeper.KeeperException; import org.eclipse.jetty.ee10.servlet.ResourceServlet; @@ -566,6 +569,9 @@ public static class CompactionStats { Suppliers.memoizeWithExpiration(this::computeExternalCompactionsSnapshot, expirationTimeMinutes, MINUTES); + private final Supplier bulkImportSupplier = + Suppliers.memoizeWithExpiration(this::computeBulkImports, expirationTimeMinutes, MINUTES); + /** * @return active tablet server scans. Values are cached and refresh after * {@link #expirationTimeMinutes}. @@ -610,6 +616,20 @@ public long getCompactorInfoFetchedTimeMillis() { return compactorInfoSupplier.get().fetchedTimeMillis; } + private BulkImport computeBulkImports() { + BulkImport bulkImport = new BulkImport(); + ListBulk.list(getContext(), bulkStatus -> { + bulkImport.addBulkImport( + new BulkImportInformation(bulkStatus.sourceDir(), bulkStatus.lastUpdate().toEpochMilli(), + bulkStatus.state(), bulkStatus.tableId(), bulkStatus.fateId())); + }); + return bulkImport; + } + + public BulkImport getBulkImports() { + return bulkImportSupplier.get(); + } + /** * @return running external compactions keyed by ECID. */ diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportInformation.java index 09197510707..cd84b0b34b8 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportInformation.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportInformation.java @@ -18,6 +18,8 @@ */ package org.apache.accumulo.monitor.rest.bulkImports; +import org.apache.accumulo.core.data.TableId; +import org.apache.accumulo.core.fate.FateId; import org.apache.accumulo.server.util.bulkCommand.ListBulk; /** @@ -28,11 +30,11 @@ public class BulkImportInformation { // Variable names become JSON key - public String filename; - public long age; - public ListBulk.BulkState state; - - public BulkImportInformation() {} + public final String filename; + public final long age; + public final ListBulk.BulkState state; + public final String tableId; + public final String fateId; /** * Creates new bulk import object @@ -41,9 +43,12 @@ public BulkImportInformation() {} * @param age age of the bulk import * @param state state of the bulk import */ - public BulkImportInformation(String filename, long age, ListBulk.BulkState state) { + public BulkImportInformation(String filename, long age, ListBulk.BulkState state, TableId tableId, + FateId fateId) { this.filename = filename; this.age = age; this.state = state; + this.tableId = tableId.canonical(); + this.fateId = fateId.canonical(); } } diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportResource.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportResource.java index 7eea08ed315..2a15b1ec75a 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportResource.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/BulkImportResource.java @@ -25,7 +25,6 @@ import jakarta.ws.rs.core.MediaType; import org.apache.accumulo.monitor.Monitor; -import org.apache.accumulo.server.util.bulkCommand.ListBulk; /** * The BulkImportResource is responsible for obtaining the information of the bulk import, and @@ -47,12 +46,6 @@ public class BulkImportResource { */ @GET public BulkImport getTables() { - BulkImport bulkImport = new BulkImport(); - ListBulk.list(monitor.getContext(), bulkStatus -> { - bulkImport.addBulkImport(new BulkImportInformation(bulkStatus.sourceDir(), - bulkStatus.lastUpdate().toEpochMilli(), bulkStatus.state())); - }); - - return bulkImport; + return monitor.getBulkImports(); } } diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/TabletServerBulkImportInformation.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/TabletServerBulkImportInformation.java deleted file mode 100644 index 168065dc5c8..00000000000 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/bulkImports/TabletServerBulkImportInformation.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 - * - * https://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. - */ -package org.apache.accumulo.monitor.rest.bulkImports; - -import org.apache.accumulo.core.manager.thrift.TabletServerStatus; - -/** - * Stores tserver bulk import information - * - * @since 2.0.0 - */ -public class TabletServerBulkImportInformation { - - // Variable names become JSON key - public String server; - public int importSize; - public long oldestAge; - - public TabletServerBulkImportInformation() {} - - /** - * Creates a new tserver bulk import object - * - * @param server server name - * @param importSize import size - * @param oldestAge tserver bulk import age - */ - public TabletServerBulkImportInformation(TabletServerStatus server, int importSize, - long oldestAge) { - this.server = server.getName(); - this.importSize = importSize; - this.oldestAge = oldestAge; - } -} diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/bulkImport.js b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/bulkImport.js index 735f4595ad2..9b22b6781ac 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/bulkImport.js +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/bulkImport.js @@ -51,12 +51,20 @@ $(function () { "stateSave": true, "autoWidth": false, "columns": [{ + "data": "tableId", + "width": "5%" + }, + { + "data": "fateId", + "width": "25%" + }, + { "data": "filename", - "width": "40%" + "width": "35%" }, { "data": "age", - "width": "45%", + "width": "25%", "render": function (data, type) { var age = Number(data); if (type === 'display') { @@ -67,40 +75,7 @@ $(function () { }, { "data": "state", - "width": "15%" - } - ] - }); - - // Generates the bulkPerServerTable DataTable - bulkPerServerTable = $('#bulkPerServerTable').DataTable({ - "ajax": { - "url": url, - "dataSrc": "tabletServerBulkImport" - }, - "stateSave": true, - "columns": [{ - "data": "server", - "type": "html", - "render": function (data, type) { - if (type === 'display') { - data = `${data}`; - } - return data; - } - }, - { - "data": "importSize" - }, - { - "data": "oldestAge", - "render": function (data, type) { - var age = Number(data); - if (type === 'display') { - return age > 0 ? new Date(age) : "-"; - } - return age > 0 ? age : 0; - } + "width": "10%" } ] }); diff --git a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/bulkImport.ftl b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/bulkImport.ftl index d172fc838ad..8ae6cf9b5e7 100644 --- a/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/bulkImport.ftl +++ b/server/monitor/src/main/resources/org/apache/accumulo/monitor/templates/bulkImport.ftl @@ -29,6 +29,8 @@ Bulk Imports
+ Table ID  + Fate ID  Directory  Age  State  diff --git a/test/src/main/java/org/apache/accumulo/test/MultipleManagerIT.java b/test/src/main/java/org/apache/accumulo/test/MultipleManagerIT.java index 8430ab527b1..5ab94377f84 100644 --- a/test/src/main/java/org/apache/accumulo/test/MultipleManagerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/MultipleManagerIT.java @@ -215,6 +215,8 @@ public void testFate() throws Exception { log.debug("Deleted lock of primary manager"); waitToSeeManagers(ctx, 2, store, true); + getCluster().getProcesses(); + stop.set(true); // Wait for the background operations to complete and ensure that none had errors. Managers // stoppping/starting should not cause any problems for Accumulo API operations.