Repository: kudu
Updated Branches:
refs/heads/master e86939654 -> 65b7bf970
dense_node-itest: add extra log output
For yet-unexplained reasons, this itest still sometimes skips outputting
the expected 'Time spent bootstrapping tablets' log statement. This
commit simply adds a few extra log messages to help diagnose this next
time it occurs.
Change-Id: Ic967558e34a8db673a518c37afdb68d86262a443
Reviewed-on: http://gerrit.cloudera.org:8080/7775
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/a6443b2c
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/a6443b2c
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/a6443b2c
Branch: refs/heads/master
Commit: a6443b2cbfa498198fb5a237b5164274f875e8f8
Parents: e869396
Author: Todd Lipcon <to...@apache.org>
Authored: Tue Aug 22 18:34:51 2017 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Wed Aug 23 02:16:25 2017 +0000
----------------------------------------------------------------------
src/kudu/integration-tests/dense_node-itest.cc | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6443b2c/src/kudu/integration-tests/dense_node-itest.cc
----------------------------------------------------------------------
diff --git a/src/kudu/integration-tests/dense_node-itest.cc b/src/kudu/integration-tests/dense_node-itest.cc
index 997e732..5537288 100644
--- a/src/kudu/integration-tests/dense_node-itest.cc
+++ b/src/kudu/integration-tests/dense_node-itest.cc
@@ -218,10 +218,13 @@ TEST_F(DenseNodeTest, RunTest) {
}
if (FLAGS_measure_startup_wait_for_bootstrap) {
LOG_TIMING(INFO, "bootstrapping tablets") {
+ LOG(INFO) << "waiting for tablets running";
cluster_->WaitForTabletsRunning(cluster_->tablet_server(0),
FLAGS_num_tablets,
MonoDelta::FromSeconds(3600));
}
+ } else {
+ LOG(INFO) << "not waiting for bootstrapping tablets (flag disabled)";
}
cluster_->Shutdown();
KUDU-2033 (part 2). Add test for Java client failover support.
New test which validates that that the java client correctly gets
metadata updates after the Master leader is killed.
Change-Id: I228e08429d952f0f5b2657e0b8481366c5c572a4
Reviewed-on: http://gerrit.cloudera.org:8080/7722
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Kudu Jenkins
Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/65b7bf97
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/65b7bf97
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/65b7bf97
Branch: refs/heads/master
Commit: 65b7bf9707e4b893e230b64b5aba89b39905edbb
Parents: a6443b2
Author: efancher <ef...@cloudera.com>
Authored: Fri Aug 18 10:22:32 2017 -0700
Committer: Alexey Serbin <as...@cloudera.com>
Committed: Wed Aug 23 16:13:25 2017 +0000
----------------------------------------------------------------------
.../kudu/client/TestClientFailoverSupport.java | 90 ++++++++++++++++++++
1 file changed, 90 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kudu/blob/65b7bf97/java/kudu-client/src/test/java/org/apache/kudu/client/TestClientFailoverSupport.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestClientFailoverSupport.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestClientFailoverSupport.java
new file mode 100644
index 0000000..b1cb403
--- /dev/null
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestClientFailoverSupport.java
@@ -0,0 +1,90 @@
+// 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.kudu.client;
+
+import static org.apache.kudu.util.AssertHelpers.assertEventuallyTrue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+import java.util.List;
+import org.apache.kudu.util.AssertHelpers.BooleanExpression;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestClientFailoverSupport extends BaseKuduTest {
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ final int NUM_TABLET_SERVERS = 6;
+ BaseKuduTest.doSetup(3, NUM_TABLET_SERVERS);
+ }
+
+ private void waitUntilRowCount(final KuduTable table, final int rowCount, long timeoutMs)
+ throws Exception {
+ assertEventuallyTrue(String.format("Read count should be %s", rowCount),
+ new BooleanExpression() {
+ @Override
+ public boolean get() throws Exception {
+ AsyncKuduScanner scanner = client.newScannerBuilder(table).build();
+ int read_count = countRowsInScan(scanner);
+ return read_count == rowCount;
+ }
+ }, timeoutMs);
+ }
+
+ /**
+ * Tests that the Java client will appropriately failover when a new master leader is elected.
+ * We force a metadata update by killing the active tablet servers.
+ * Then we kill the master leader.
+ * We write some more rows.
+ * If we can successfully read back the rows written, that shows the client handled the failover
+ * correctly.
+ */
+ @Test(timeout = 100000)
+ public void testMultipleFailover() throws Exception {
+ final String TABLE_NAME = TestClientFailoverSupport.class.getName();
+
+ createTable(TABLE_NAME, basicSchema, getBasicCreateTableOptions());
+
+ KuduTable table = openTable(TABLE_NAME);
+ KuduSession session = syncClient.newSession();
+
+ final int TOTAL_ROWS_TO_INSERT = 10;
+ final int TSERVER_LEADERS_TO_KILL = 3;
+
+ for (int i = 0; i < TOTAL_ROWS_TO_INSERT; i++) {
+ session.apply(createBasicSchemaInsert(table, i));
+ }
+
+ waitUntilRowCount(table, TOTAL_ROWS_TO_INSERT, DEFAULT_SLEEP);
+
+ for (int i = 0; i < TSERVER_LEADERS_TO_KILL; i++) {
+ List<LocatedTablet> tablets = table.getTabletsLocations(DEFAULT_SLEEP);
+ assertEquals(1, tablets.size());
+ final int leaderPort = findLeaderTabletServerPort(tablets.get(0));
+ miniCluster.killTabletServerOnPort(leaderPort);
+ }
+ killMasterLeader();
+
+ for (int i = TOTAL_ROWS_TO_INSERT; i < 2*TOTAL_ROWS_TO_INSERT; i++) {
+ session.apply(createBasicSchemaInsert(table, i));
+ }
+ waitUntilRowCount(table, 2*TOTAL_ROWS_TO_INSERT, DEFAULT_SLEEP);
+ syncClient.deleteTable(TABLE_NAME);
+ assertFalse(syncClient.tableExists(TABLE_NAME));
+ }
+}
\ No newline at end of file