dlmarion commented on code in PR #4871: URL: https://github.com/apache/accumulo/pull/4871#discussion_r1754665017
########## server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java: ########## @@ -453,83 +453,73 @@ public List<ActiveScan> getActiveScans() { final Set<Entry<Long,Session>> copiedIdleSessions = new HashSet<>(); /** - * Add sessions so that get the list returned in the active scans call + * Add sessions that get the list returned in the active scans call */ for (Session session : deferredCleanupQueue) { copiedIdleSessions.add(Maps.immutableEntry(expiredSessionMarker, session)); } List.of(sessions.entrySet(), copiedIdleSessions).forEach(s -> s.forEach(entry -> { Session session = entry.getValue(); - if (session instanceof SingleScanSession) { - SingleScanSession ss = (SingleScanSession) session; - - ScanState state = ScanState.RUNNING; - - ScanTask<ScanBatch> nbt = ss.getScanTask(); - if (nbt == null) { - state = ScanState.IDLE; - } else { - switch (nbt.getScanRunState()) { - case QUEUED: - state = ScanState.QUEUED; - break; - case FINISHED: - state = ScanState.IDLE; - break; - case RUNNING: - default: - /* do nothing */ - break; - } - } - - var params = ss.scanParams; - ActiveScan activeScan = new ActiveScan(ss.client, ss.getUser(), - ss.extent.tableId().canonical(), ct - ss.startTime, ct - ss.lastAccessTime, - ScanType.SINGLE, state, ss.extent.toThrift(), - params.getColumnSet().stream().map(Column::toThrift).collect(Collectors.toList()), - params.getSsiList(), params.getSsio(), params.getAuthorizations().getAuthorizationsBB(), - params.getClassLoaderContext()); - - // scanId added by ACCUMULO-2641 is an optional thrift argument and not available in - // ActiveScan constructor - activeScan.setScanId(entry.getKey()); - activeScans.add(activeScan); + if (session instanceof SingleScanSession) { + final SingleScanSession ss = (SingleScanSession) session; + final KeyExtent extent = ss.extent; + final ScanType scanType = ScanType.SINGLE; + final ScanParameters params = ss.scanParams; + final ScanState state = computeScanState(ss.getScanTask()); + final long scanId = entry.getKey(); + + addActiveScan(activeScans, ss, extent, ct, scanType, state, params, scanId); } else if (session instanceof MultiScanSession) { - MultiScanSession mss = (MultiScanSession) session; + final MultiScanSession mss = (MultiScanSession) session; + final KeyExtent extent = mss.threadPoolExtent; + final ScanType scanType = ScanType.BATCH; + final ScanParameters params = mss.scanParams; + final ScanState state = computeScanState(mss.getScanTask()); + final long scanId = entry.getKey(); + + addActiveScan(activeScans, mss, extent, ct, scanType, state, params, scanId); + } Review Comment: Yep, you are right, I was looking at the wrong thing. -- 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: notifications-unsubscr...@accumulo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org