keith-turner commented on code in PR #4983:
URL: https://github.com/apache/accumulo/pull/4983#discussion_r1815502610
##########
server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java:
##########
@@ -458,28 +458,36 @@ public List<ActiveScan> getActiveScans() {
addActiveScan(activeScans, scanSession,
isSingle ? ((SingleScanSession) scanSession).extent
: ((MultiScanSession) scanSession).threadPoolExtent,
- ct, isSingle ? ScanType.SINGLE : ScanType.BATCH,
- computeScanState(scanSession.getScanTask()),
scanSession.scanParams, entry.getKey());
+ ct, isSingle ? ScanType.SINGLE : ScanType.BATCH,
computeScanState(scanSession),
+ scanSession.scanParams, entry.getKey());
}
}));
return activeScans;
}
- private ScanState computeScanState(ScanTask<?> scanTask) {
+ private ScanState computeScanState(ScanSession<?> session) {
ScanState state = ScanState.RUNNING;
- if (scanTask == null) {
+ if (session.getScanTask() == null) {
state = ScanState.IDLE;
} else {
- switch (scanTask.getScanRunState()) {
+ switch (session.getScanTask().getScanRunState()) {
case QUEUED:
state = ScanState.QUEUED;
break;
case FINISHED:
state = ScanState.IDLE;
break;
case RUNNING:
+ if (zombieCountConsumer != null) {
+ state = ScanState.ZOMBIE;
+ handleZombieScan(session);
+ } else if (session.getScanTask() == null) {
+ state = ScanState.CLEANING;
+ handleCleaningScan(session);
+ }
+ break;
Review Comment:
If a session is in the removed state where its no longer accessible to
clients and it still has a thread running, then it could be considered a
zombie. The `zombieCountConsumer` instance variable is related to metrics and
it being set or not does mean anything for a specific session. The two handle
methods seem to have a lot of side effects that should not happen while
computing the current state of the session and should be removed.
```suggestion
if(session.getState() == State.REMOVED){
state = ScanState.ZOMBIE;
}
break;
```
--
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]