This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/master by this push:
new 43626de fix IT and suppress spurious errors on close (#905 follow up)
43626de is described below
commit 43626decef4577e1f38d281a94aa91eab4848852
Author: Keith Turner <[email protected]>
AuthorDate: Sat Jan 26 17:33:43 2019 -0500
fix IT and suppress spurious errors on close (#905 follow up)
---
.../accumulo/core/clientImpl/ScannerIterator.java | 10 ++++++++--
.../accumulo/test/functional/SessionBlockVerifyIT.java | 17 ++++++++---------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/clientImpl/ScannerIterator.java
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ScannerIterator.java
index de65065..e5bb6bc 100644
---
a/core/src/main/java/org/apache/accumulo/core/clientImpl/ScannerIterator.java
+++
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ScannerIterator.java
@@ -37,6 +37,7 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.NamingThreadFactory;
+import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
@@ -124,8 +125,13 @@ public class ScannerIterator implements
Iterator<Entry<Key,Value>> {
readaheadPool.execute(() -> {
synchronized (scanState) {
// this is synchronized so its mutually exclusive with readBatch()
- closed = true;
- ThriftScanner.close(scanState);
+ try {
+ closed = true;
+ ThriftScanner.close(scanState);
+ } catch (Exception e) {
+ LoggerFactory.getLogger(ScannerIterator.class)
+ .debug("Exception when closing scan session", e);
+ }
}
});
}
diff --git
a/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
index ce41366..300b794 100644
---
a/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
+++
b/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
@@ -109,12 +109,11 @@ public class SessionBlockVerifyIT extends
ScanSessionTimeOutIT {
SlowIterator.setSleepTime(setting, Long.MAX_VALUE);
scanner.addScanIterator(setting);
- final Iterator<Entry<Key,Value>> slow = scanner.iterator();
-
final List<Future<Boolean>> callables = new ArrayList<>();
final CountDownLatch latch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
Future<Boolean> callable = service.submit(() -> {
+ Iterator<Entry<Key,Value>> slow = scanner.iterator();
latch.countDown();
while (slow.hasNext()) {
@@ -131,13 +130,13 @@ public class SessionBlockVerifyIT extends
ScanSessionTimeOutIT {
// let's add more for good measure.
for (int i = 0; i < 2; i++) {
- try (Scanner scanner2 = c.createScanner(tableName, new
Authorizations())) {
- scanner2.setRange(new Range(String.format("%08d", 0),
String.format("%08d", 1000)));
- scanner2.setBatchSize(1);
- Iterator<Entry<Key,Value>> iter = scanner2.iterator();
- // call super's verify mechanism
- verify(iter, 0, 1000);
- }
+ // do not close scanner, since all data is consumed it should close
the sessions
+ Scanner scanner2 = c.createScanner(tableName, new Authorizations());
+ scanner2.setRange(new Range(String.format("%08d", 0),
String.format("%08d", 1000)));
+ scanner2.setBatchSize(1);
+ Iterator<Entry<Key,Value>> iter = scanner2.iterator();
+ // call super's verify mechanism
+ verify(iter, 0, 1000);
}
int sessionsFound = 0;