accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-3419 retry on IOException
Date Thu, 25 Jun 2015 13:59:34 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 880e3386c -> bbfa36902


ACCUMULO-3419 retry on IOException


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/70aea932
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/70aea932
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/70aea932

Branch: refs/heads/master
Commit: 70aea932d7654bccc7f744712fe450ab72b208ce
Parents: ee6bea7
Author: Eric Newton <eric.newton@gmail.com>
Authored: Thu Jun 25 09:58:50 2015 -0400
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Thu Jun 25 09:58:50 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/tserver/TabletServer.java   |  8 ++-
 .../accumulo/tserver/tablet/ScanBatch.java      |  2 +-
 .../test/TabletServerHdfsRestartIT.java         | 69 ++++++++++++++++++++
 3 files changed, 77 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/70aea932/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 01c0986..4d0b9f6 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -526,8 +526,14 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
           throw (NotServingTabletException) e.getCause();
         else if (e.getCause() instanceof TooManyFilesException)
           throw new org.apache.accumulo.core.tabletserver.thrift.TooManyFilesException(scanSession.extent.toThrift());
-        else
+        else if (e.getCause() instanceof IOException) {
+          UtilWaitThread.sleep(MAX_TIME_TO_WAIT_FOR_SCAN_RESULT_MILLIS);
+          List<KVEntry> empty = Collections.emptyList();
+          bresult = new ScanBatch(empty, true);
+          scanSession.nextBatchTask = null;
+        } else {
           throw new RuntimeException(e);
+        }
       } catch (CancellationException ce) {
         sessionManager.removeSession(scanID);
         Tablet tablet = onlineTablets.get(scanSession.extent);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/70aea932/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/ScanBatch.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/ScanBatch.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/ScanBatch.java
index 888d6f5..7a29427 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/ScanBatch.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/ScanBatch.java
@@ -22,7 +22,7 @@ final public class ScanBatch {
   private final boolean more;
   private final List<KVEntry> results;
 
-  ScanBatch(List<KVEntry> results, boolean more) {
+  public ScanBatch(List<KVEntry> results, boolean more) {
     this.results = results;
     this.more = more;
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/70aea932/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
new file mode 100644
index 0000000..e48ffe8
--- /dev/null
+++ b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.ConfigurableMacBase;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.Test;
+
+import com.google.common.collect.Iterators;
+
+// ACCUMULO-3914
+public class TabletServerHdfsRestartIT extends ConfigurableMacBase {
+
+  private static final int N = 1000;
+
+  @Override
+  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+    cfg.useMiniDFS(true);
+    cfg.setNumTservers(1);
+    cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "5s");
+  }
+
+  @Test(timeout = 2 * 60 * 1000)
+  public void test() throws Exception {
+    final Connector conn = this.getConnector();
+    // Yes, there's a tabletserver
+    assertEquals(1, conn.instanceOperations().getTabletServers().size());
+    final String tableName = getUniqueNames(1)[0];
+    conn.tableOperations().create(tableName);
+    BatchWriter bw = conn.createBatchWriter(tableName, null);
+    for (int i = 0; i < N; i++) {
+      Mutation m = new Mutation("" + i);
+      m.put("", "", "");
+      bw.addMutation(m);
+    }
+    bw.close();
+    conn.tableOperations().flush(tableName, null, null, true);
+    Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
+
+    // Kill dfs
+    cluster.getMiniDfs().restartNameNode(false);
+
+    assertEquals(N, Iterators.size(conn.createScanner(tableName, Authorizations.EMPTY).iterator()));
+  }
+
+}


Mime
View raw message