Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,19 @@ public enum ScanState {
* Indicates a task is queued in a server side thread pool to fetch the next bach of key/values
* for a scan.
*/
QUEUED
QUEUED,

/**
* Indicate the session is no longer accessible and is in the process of cleaning up resources
*
* @since 3.1.0
*/
CLEANING,
/**
* Indicate the client session is no longer accessible and still has a thread running on the
* server side
*
* @since 3.1.0
*/
ZOMBIE
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions core/src/main/thrift/tabletscan.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enum ScanState {
IDLE
RUNNING
QUEUED
ZOMBIE
CLEANING
}

struct ActiveScan {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,34 +458,37 @@ 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) {
state = ScanState.IDLE;
if (session.getState() == State.REMOVED) {
state = ScanState.CLEANING;
} else {
switch (scanTask.getScanRunState()) {
switch (session.getScanTask().getScanRunState()) {
Comment on lines -472 to +475
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the null check for the scanTask and I think it would still be needed, however, I'm not sure where it would go especially considering my next comment

case QUEUED:
state = ScanState.QUEUED;
break;
case FINISHED:
state = ScanState.IDLE;
break;
case RUNNING:
if (session.getState() == State.REMOVED) {
state = ScanState.ZOMBIE;
}
break;
Comment on lines +483 to +486
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current logic is:

    if (session.getState() == State.REMOVED) {
      state = ScanState.CLEANING;
    } else {
      ...
      if (session.getState() == State.REMOVED) {
        state = ScanState.ZOMBIE;
      }
      ...
    }

state = ScanState.ZOMBIE will never execute in this logic. It seems like either (or both) the logic for identifying ZOMBIE or CLEANING need to be changed (but I'm not sure which or what it should be changed to)

default:
/* do nothing */
break;
}
}

return state;
}

Expand Down