This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 767a68ada5 fixes exception for canceled scan task (#5093)
767a68ada5 is described below
commit 767a68ada50131317e3420dc14780505c523789f
Author: Keith Turner <[email protected]>
AuthorDate: Fri Nov 22 13:58:24 2024 -0500
fixes exception for canceled scan task (#5093)
An exception was happening when a scan task was canceled before it ever
ran. This was caused by transitionFromRunning() executing when
transitoinToRunning() had never executed. When this happened a
precondition check that the scanThread was non-null would fail. These
changes only execute transitionFromRunning() when transitionToRunning()
has executed.
---
.../main/java/org/apache/accumulo/tserver/scan/LookupTask.java | 9 +++++----
.../java/org/apache/accumulo/tserver/scan/NextBatchTask.java | 9 +++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git
a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
index 351946bb8c..8eb15ea6bb 100644
---
a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
+++
b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java
@@ -64,15 +64,16 @@ public class LookupTask extends ScanTask<MultiScanResult> {
MultiScanSession session = (MultiScanSession) server.getSession(scanID);
String oldThreadName = Thread.currentThread().getName();
+ if (!transitionToRunning()) {
+ return;
+ }
+ // Do not add any code here. Need to ensure that transitionFromRunning()
runs in the finally
+ // block when transitionToRunning() returns true.
try {
if (isCancelled() || session == null) {
return;
}
- if (!transitionToRunning()) {
- return;
- }
-
TableConfiguration acuTableConf =
server.getTableConfiguration(session.threadPoolExtent);
long maxResultsSize =
acuTableConf.getAsBytes(Property.TABLE_SCAN_MAXMEM);
diff --git
a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/NextBatchTask.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/NextBatchTask.java
index 9d601f4342..96251bd59b 100644
---
a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/NextBatchTask.java
+++
b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/NextBatchTask.java
@@ -54,15 +54,16 @@ public class NextBatchTask extends ScanTask<ScanBatch> {
final SingleScanSession scanSession = (SingleScanSession)
server.getSession(scanID);
String oldThreadName = Thread.currentThread().getName();
+ if (!transitionToRunning()) {
+ return;
+ }
+ // Do not add any code here. Need to ensure that transitionFromRunning()
runs in the finally
+ // block when transitionToRunning() returns true.
try {
if (isCancelled() || scanSession == null) {
return;
}
- if (!transitionToRunning()) {
- return;
- }
-
Thread.currentThread()
.setName("User: " + scanSession.getUser() + " Start: " +
scanSession.startTime
+ " Client: " + scanSession.client + " Tablet: " +
scanSession.extent);