You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by la...@apache.org on 2022/04/25 06:17:34 UTC

[kudu] branch master updated (42fbe6b2e -> 66923d9ed)

This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


    from 42fbe6b2e [unit test] Fix a unit test problem from code review.
     new 88148d37a [disk_failure-itest] fix premature return from AllowRecovery()
     new 285e26a0c [unit test] make ToolTest.TestRebuildTserverByLocalReplicaCopy skip tsan
     new 66923d9ed [unit test] Modify the return value of the test function 'CreateTable'.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/kudu/client/client-test.cc                   | 56 ++++++++++++------------
 src/kudu/integration-tests/disk_failure-itest.cc |  2 +-
 src/kudu/tools/kudu-tool-test.cc                 |  1 +
 3 files changed, 30 insertions(+), 29 deletions(-)


[kudu] 02/03: [unit test] make ToolTest.TestRebuildTserverByLocalReplicaCopy skip tsan

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 285e26a0cce308d2fff8859e6bc593b0b0d41f61
Author: shenxingwuying <sh...@gmail.com>
AuthorDate: Wed Apr 20 19:58:21 2022 +0800

    [unit test] make ToolTest.TestRebuildTserverByLocalReplicaCopy skip tsan
    
    tsan is slow, and case ToolTest.TestRebuildTserverByLocalReplicaCopy
    maybe fail.
    
    Change-Id: I4da90d728c9fbd34c9c3c4de3fe7089c07e25b42
    Reviewed-on: http://gerrit.cloudera.org:8080/18432
    Reviewed-by: Yingchun Lai <ac...@gmail.com>
    Tested-by: Yingchun Lai <ac...@gmail.com>
---
 src/kudu/tools/kudu-tool-test.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index 8956c1d90..c87d39c55 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -7969,6 +7969,7 @@ TEST_F(ToolTest, TestLocalReplicaCopyLocal) {
 }
 
 TEST_F(ToolTest, TestRebuildTserverByLocalReplicaCopy) {
+  SKIP_IF_SLOW_NOT_ALLOWED();
   // Create replicas and fill some data.
   const int kNumTserver = 3;
   InternalMiniClusterOptions opts;


[kudu] 03/03: [unit test] Modify the return value of the test function 'CreateTable'.

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 66923d9ed55b43637f4d9d08519619188fba2bc0
Author: kedeng <kd...@gmail.com>
AuthorDate: Mon Apr 25 10:51:19 2022 +0800

    [unit test] Modify the return value of the test function 'CreateTable'.
    
    I'm going to submit a soft delete function. In relevant unit
    tests, we need to judge the function results of 'CreateTable'.
    Commit is mentioned separately here to implement this modification.
    
    Change-Id: I114adce22a631b88de30943738a7356d4a451828
    Reviewed-on: http://gerrit.cloudera.org:8080/18445
    Reviewed-by: Yingchun Lai <ac...@gmail.com>
    Tested-by: Yingchun Lai <ac...@gmail.com>
---
 src/kudu/client/client-test.cc | 56 +++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/kudu/client/client-test.cc b/src/kudu/client/client-test.cc
index c8597bd29..a7c7e9835 100644
--- a/src/kudu/client/client-test.cc
+++ b/src/kudu/client/client-test.cc
@@ -277,7 +277,7 @@ class ClientTest : public KuduTest {
         .add_master_server_addr(cluster_->mini_master()->bound_rpc_addr().ToString())
         .Build(&client_));
 
-    NO_FATALS(CreateTable(kTableName, 1, GenerateSplitRows(), {}, &client_table_));
+    ASSERT_OK(CreateTable(kTableName, 1, GenerateSplitRows(), {}, &client_table_));
   }
 
   // Looks up the remote tablet entry for a given partition key in the meta cache.
@@ -709,22 +709,22 @@ class ClientTest : public KuduTest {
 
   // Creates a table with 'num_replicas', split into tablets based on
   // 'split_rows' and 'range_bounds' (or single tablet if both are empty).
-  void CreateTable(const string& table_name,
-                   int num_replicas,
-                   vector<unique_ptr<KuduPartialRow>> split_rows,
-                   vector<pair<unique_ptr<KuduPartialRow>,
-                               unique_ptr<KuduPartialRow>>> range_bounds,
-                   shared_ptr<KuduTable>* table) {
+  Status CreateTable(const string& table_name,
+                     int num_replicas,
+                     vector<unique_ptr<KuduPartialRow>> split_rows,
+                     vector<pair<unique_ptr<KuduPartialRow>,
+                                 unique_ptr<KuduPartialRow>>> range_bounds,
+                     shared_ptr<KuduTable>* table) {
 
     bool added_replicas = false;
     // Add more tablet servers to satisfy all replicas, if necessary.
     while (cluster_->num_tablet_servers() < num_replicas) {
-      ASSERT_OK(cluster_->AddTabletServer());
+      RETURN_NOT_OK(cluster_->AddTabletServer());
       added_replicas = true;
     }
 
     if (added_replicas) {
-      ASSERT_OK(cluster_->WaitForTabletServerCount(num_replicas));
+      RETURN_NOT_OK(cluster_->WaitForTabletServerCount(num_replicas));
     }
 
     unique_ptr<KuduTableCreator> table_creator(client_->NewTableCreator());
@@ -734,14 +734,14 @@ class ClientTest : public KuduTest {
     for (auto& bound : range_bounds) {
       table_creator->add_range_partition(bound.first.release(), bound.second.release());
     }
-    ASSERT_OK(table_creator->table_name(table_name)
+    RETURN_NOT_OK(table_creator->table_name(table_name)
                             .schema(&schema_)
                             .num_replicas(num_replicas)
                             .set_range_partition_columns({ "key" })
                             .timeout(MonoDelta::FromSeconds(60))
                             .Create());
 
-    ASSERT_OK(client_->OpenTable(table_name, table));
+    return client_->OpenTable(table_name, table);
   }
 
   // Kills a tablet server.
@@ -886,7 +886,7 @@ TEST_F(ClientTest, TestClusterId) {
 TEST_F(ClientTest, TestListTables) {
   const char* kTable2Name = "client-testtb2";
   shared_ptr<KuduTable> second_table;
-  NO_FATALS(CreateTable(kTable2Name, 1, {}, {}, &second_table));
+  ASSERT_OK(CreateTable(kTable2Name, 1, {}, {}, &second_table));
 
   vector<string> tables;
   ASSERT_OK(client_->ListTables(&tables));
@@ -1257,7 +1257,7 @@ TEST_P(ScanMultiTabletParamTest, Test) {
       ASSERT_OK(row->SetInt32(0, i * kRowsPerTablet));
       rows.emplace_back(std::move(row));
     }
-    NO_FATALS(CreateTable("TestScanMultiTablet", 1,
+    ASSERT_OK(CreateTable("TestScanMultiTablet", 1,
                           std::move(rows), {}, &table));
   }
 
@@ -1532,7 +1532,7 @@ TEST_F(ClientTest, TestInvalidPredicates) {
 TEST_F(ClientTest, TestScanCloseProxy) {
   const string kEmptyTable = "TestScanCloseProxy";
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable(kEmptyTable, 3, GenerateSplitRows(), {}, &table));
+  ASSERT_OK(CreateTable(kEmptyTable, 3, GenerateSplitRows(), {}, &table));
 
   {
     // Open and close an empty scanner.
@@ -1670,7 +1670,7 @@ TEST_F(ClientTest, TestScanFaultTolerance) {
   FLAGS_leader_failure_exp_backoff_max_delta_ms = 1000;
 
   const int kNumReplicas = 3;
-  NO_FATALS(CreateTable(kScanTable, kNumReplicas, {}, {}, &table));
+  ASSERT_OK(CreateTable(kScanTable, kNumReplicas, {}, {}, &table));
   NO_FATALS(InsertTestRows(table.get(), FLAGS_test_scan_num_rows));
 
   // Do an initial scan to determine the expected rows for later verification.
@@ -1739,7 +1739,7 @@ TEST_F(ClientTest, TestNonFaultTolerantScannerExpired) {
   shared_ptr<KuduTable> table;
 
   const int kNumReplicas = 1;
-  NO_FATALS(CreateTable(kScanTable, kNumReplicas, {}, {}, &table));
+  ASSERT_OK(CreateTable(kScanTable, kNumReplicas, {}, {}, &table));
   NO_FATALS(InsertTestRows(table.get(), FLAGS_test_scan_num_rows));
 
   KuduScanner scanner(table.get());
@@ -2471,7 +2471,7 @@ TEST_F(ClientTest, TestMetaCacheLookupNoLeaders) {
 
 TEST_F(ClientTest, TestGetTabletServerBlacklist) {
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable("blacklist",
+  ASSERT_OK(CreateTable("blacklist",
                         3,
                         GenerateSplitRows(),
                         {},
@@ -2548,7 +2548,7 @@ TEST_F(ClientTest, TestGetTabletServerBlacklist) {
 
 TEST_F(ClientTest, TestGetTabletServerDeterministic) {
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable("selection",
+  ASSERT_OK(CreateTable("selection",
                         3,
                         GenerateSplitRows(),
                         {},
@@ -2598,7 +2598,7 @@ TEST_F(ClientTest, TestGetTabletServerDeterministic) {
 
 TEST_F(ClientTest, TestScanWithEncodedRangePredicate) {
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable("split-table",
+  ASSERT_OK(CreateTable("split-table",
                         1, /* replicas */
                         GenerateSplitRows(),
                         {},
@@ -3304,7 +3304,7 @@ TEST_F(ClientTest, TestSessionClose) {
 // contains multiple rows spread across multiple tablets.
 TEST_F(ClientTest, TestMultipleMultiRowManualBatches) {
   shared_ptr<KuduTable> second_table;
-  NO_FATALS(CreateTable("second table", 1, {}, {}, &second_table));
+  ASSERT_OK(CreateTable("second table", 1, {}, {}, &second_table));
 
   shared_ptr<KuduSession> session = client_->NewSession();
   ASSERT_OK(session->SetFlushMode(KuduSession::MANUAL_FLUSH));
@@ -3542,7 +3542,7 @@ TEST_F(ClientTest, TestInsertDuplicateKeys) {
 
   constexpr const char* kTable2Name = "client-testtb2";
   shared_ptr<KuduTable> second_table;
-  NO_FATALS(CreateTable(kTable2Name, 1, {}, {}, &second_table));
+  ASSERT_OK(CreateTable(kTable2Name, 1, {}, {}, &second_table));
 
   // Insert initial rows
   ASSERT_OK(ApplyInsertToSession(session.get(), client_table_, 1, 1, "one"));
@@ -4012,7 +4012,7 @@ TEST_F(ClientTest, TestAutoFlushBackgroundAndErrorCollector) {
     // the crux of the race condition for KUDU-1743.
     const string table_name = Substitute("table.$0", i);
     shared_ptr<KuduTable> table;
-    NO_FATALS(CreateTable(table_name, 3, std::move(splits), {}, &table));
+    ASSERT_OK(CreateTable(table_name, 3, std::move(splits), {}, &table));
 
     shared_ptr<KuduSession> session(client_->NewSession());
     scoped_refptr<ErrorCollector> ec(new CustomErrorCollector);
@@ -4909,7 +4909,7 @@ TEST_F(ClientTest, TestDeleteTable) {
 
   // Create a new table with the same name. This is to ensure that the client
   // doesn't cache anything inappropriately by table name (see KUDU-1055).
-  NO_FATALS(CreateTable(kTableName, 1, GenerateSplitRows(), {}, &client_table_));
+  ASSERT_OK(CreateTable(kTableName, 1, GenerateSplitRows(), {}, &client_table_));
 
   // Should be able to insert successfully into the new table.
   NO_FATALS(InsertTestRows(client_.get(), client_table_.get(), 10));
@@ -4940,7 +4940,7 @@ TEST_F(ClientTest, TestReplicatedMultiTabletTable) {
   const int kNumReplicas = 3;
 
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable(kReplicatedTable,
+  ASSERT_OK(CreateTable(kReplicatedTable,
                         kNumReplicas,
                         GenerateSplitRows(),
                         {},
@@ -4966,7 +4966,7 @@ TEST_F(ClientTest, TestReplicatedMultiTabletTableFailover) {
   const int kNumTries = 100;
 
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable(kReplicatedTable,
+  ASSERT_OK(CreateTable(kReplicatedTable,
                         kNumReplicas,
                         GenerateSplitRows(),
                         {},
@@ -5020,7 +5020,7 @@ TEST_F(ClientTest, TestReplicatedTabletWritesWithLeaderElection) {
   const int kNumReplicas = 3;
 
   shared_ptr<KuduTable> table;
-  NO_FATALS(CreateTable(kReplicatedTable, kNumReplicas, {}, {}, &table));
+  ASSERT_OK(CreateTable(kReplicatedTable, kNumReplicas, {}, {}, &table));
 
   // Insert some data.
   NO_FATALS(InsertTestRows(table.get(), kNumRowsToWrite));
@@ -5772,7 +5772,7 @@ TEST_F(ClientTest, TestReadAtSnapshotNoTimestampSet) {
       CHECK_OK(row->SetInt32(0, i * kRowsPerTablet));
       rows.push_back(std::move(row));
     }
-    NO_FATALS(CreateTable("test_table", 1, std::move(rows), {}, &table));
+    ASSERT_OK(CreateTable("test_table", 1, std::move(rows), {}, &table));
     // Insert some data into the table, so each tablet would get populated.
     shared_ptr<KuduSession> session(client_->NewSession());
     ASSERT_OK(session->SetFlushMode(KuduSession::MANUAL_FLUSH));
@@ -6487,7 +6487,7 @@ TEST_F(ClientTest, TestBatchScanConstIterator) {
 TEST_F(ClientTest, TestTableNumReplicas) {
   for (int i : { 1, 3, 5, 7 }) {
     shared_ptr<KuduTable> table;
-    NO_FATALS(CreateTable(Substitute("table_with_$0_replicas", i),
+    ASSERT_OK(CreateTable(Substitute("table_with_$0_replicas", i),
                           i, {}, {}, &table));
     ASSERT_EQ(i, table->num_replicas());
   }


[kudu] 01/03: [disk_failure-itest] fix premature return from AllowRecovery()

Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 88148d37ab2ecb3ffc512cc756f4baf7d502bb5f
Author: shenxingwuying <sh...@gmail.com>
AuthorDate: Wed Apr 20 16:33:09 2022 +0800

    [disk_failure-itest] fix premature return from AllowRecovery()
    
    Fixed a premature return from the AllowRecovery() utility function.
    Prior to this fix, the error injection flags
    were reset only for the first tserver upon call
    to AllowRecovery().
    
    Change-Id: I8759d45623e33c5b2b21fceb681f277ab4e1c113
    Reviewed-on: http://gerrit.cloudera.org:8080/18429
    Reviewed-by: Yifan Zhang <ch...@163.com>
    Tested-by: Yifan Zhang <ch...@163.com>
---
 src/kudu/integration-tests/disk_failure-itest.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kudu/integration-tests/disk_failure-itest.cc b/src/kudu/integration-tests/disk_failure-itest.cc
index ec84c063b..7b0544f1e 100644
--- a/src/kudu/integration-tests/disk_failure-itest.cc
+++ b/src/kudu/integration-tests/disk_failure-itest.cc
@@ -278,7 +278,7 @@ class TabletServerDiskErrorITest : public DiskErrorITestBase {
         // Then allow for recovery.
         { "enable_tablet_copy", "true" },
       };
-      return SetFlags(cluster_->tablet_server(i), recovery_flags);
+      RETURN_NOT_OK(SetFlags(cluster_->tablet_server(i), recovery_flags));
     }
     return Status::OK();
   }