dlmarion commented on a change in pull request #2318:
URL: https://github.com/apache/accumulo/pull/2318#discussion_r730940298



##########
File path: 
server/compaction-coordinator/src/main/java/org/apache/accumulo/coordinator/CompactionCoordinator.java
##########
@@ -548,32 +551,64 @@ void compactionFailed(Map<ExternalCompactionId,KeyExtent> 
compactions) {
    *          tcredentials object
    * @param externalCompactionId
    *          compaction id
-   * @param state
-   *          compaction state
-   * @param message
-   *          informational message
+   * @param update
+   *          compaction status update
    * @param timestamp
    *          timestamp of the message
    * @throws ThriftSecurityException
    *           when permission error
    */
   @Override
   public void updateCompactionStatus(TInfo tinfo, TCredentials credentials,
-      String externalCompactionId, TCompactionState state, String message, 
long timestamp)
+      String externalCompactionId, TCompactionStatusUpdate update, long 
timestamp)
       throws ThriftSecurityException {
     // do not expect users to call this directly, expect other tservers to 
call this method
     if (!security.canPerformSystemActions(credentials)) {
       throw new AccumuloSecurityException(credentials.getPrincipal(),
           SecurityErrorCode.PERMISSION_DENIED).asThriftException();
     }
-    LOG.debug("Compaction status update, id: {}, timestamp: {}, state: {}, 
message: {}",
-        externalCompactionId, timestamp, state, message);
+    LOG.debug("Compaction status update, id: {}, timestamp: {}, update: {}", 
externalCompactionId,
+        timestamp, update);
     final RunningCompaction rc = 
RUNNING.get(ExternalCompactionId.of(externalCompactionId));
     if (null != rc) {
-      rc.addUpdate(timestamp, message, state);
+      rc.addUpdate(timestamp, update);
     }
   }
 
+  /**
+   * Return information about running compactions
+   *
+   * @param tinfo
+   *          trace info
+   * @param credentials
+   *          tcredentials object
+   * @return list of TRunningCompaction objects
+   * @throws ThriftSecurityException
+   *           when permission error
+   */
+  @Override
+  public TRunningCompactions getRunningCompactions(TInfo tinfo, TCredentials 
credentials)
+      throws ThriftSecurityException {
+    // do not expect users to call this directly, expect other tservers to 
call this method
+    if (!security.canPerformSystemActions(credentials)) {
+      throw new AccumuloSecurityException(credentials.getPrincipal(),
+          SecurityErrorCode.PERMISSION_DENIED).asThriftException();
+    }
+    final TRunningCompactions result = new TRunningCompactions();
+    RUNNING.forEach((ecid, rc) -> {

Review comment:
       The 
[javadoc](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ConcurrentHashMap.html)
 says that all operations are thread-safe.




-- 
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]


Reply via email to