diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexCachingIteratorJexl.java b/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexCachingIteratorJexl.java index 9d7b8a4875..e3af3acc8f 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexCachingIteratorJexl.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/DatawaveFieldIndexCachingIteratorJexl.java @@ -367,6 +367,9 @@ public B withIvaratorSourcePool(GenericObjectPool (startTime + scanTimeout)) { + // mark as timed out + this.timedOut = true; + // and cancel the query + this.setControl.setCancelled(); + } + } + + /** + * Was the timed out flag set. + * + * @return a boolean if timed out + */ + protected boolean isTimedOut() { + return this.timedOut; + } + /** * Get a source copy. This is only used when retrieving unsorted values. * @@ -1184,6 +1227,8 @@ protected IvaratorFuture fillSet(final Range boundingFiRange, final TotalResults : null; while (source.hasTop()) { + checkTiming(); + Key top = source.getTopKey(); // if we are setup for composite seeking, seek if we are out of range @@ -1355,6 +1400,7 @@ protected boolean copyRowBasedHdfsBackedSetFromPreviousCall() { this.threadSafeSet = previousIvarator.threadSafeSet; this.set = previousIvarator.set; this.setControl = previousIvarator.setControl; + this.startTime = previousIvarator.startTime; return true; } diff --git a/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java b/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java index a183c3b795..944f84aed7 100644 --- a/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java +++ b/warehouse/query-core/src/main/java/datawave/core/iterators/IteratorThreadPoolManager.java @@ -98,7 +98,7 @@ private IteratorThreadPoolManager(IteratorEnvironment env) { DatawaveFieldIndexCachingIteratorJexl ivarator = future.getIvarator(); long elapsed = now - ivarator.getStartTime(); long ivaratorScanTimeout = ivarator.getScanTimeout(); - if (!ivarator.isRunning() && ((elapsed > ivaratorScanTimeout) || (elapsed > ivaratorMaxScanTimeout))) { + if (ivarator.isRunning() && ((elapsed > ivaratorScanTimeout) || (elapsed > ivaratorMaxScanTimeout))) { removeIvaratorFuture(taskName, env); } }