You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2019/04/05 16:02:48 UTC
[kudu] branch master updated: [kudu-tool-test] deflake
ToolTestCopyTableParameterized.TestCopyTable
This is an automated email from the ASF dual-hosted git repository.
adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 1ae941c [kudu-tool-test] deflake ToolTestCopyTableParameterized.TestCopyTable
1ae941c is described below
commit 1ae941ca51ef427fa18bef92eb0a91bfae3bfe7f
Author: Yingchun Lai <40...@qq.com>
AuthorDate: Thu Apr 4 03:53:30 2019 -0400
[kudu-tool-test] deflake ToolTestCopyTableParameterized.TestCopyTable
Under mode UPSERT_TO_EXIST_TABLE, destination table is not empty before
copying, it may has more rows than source table, so it may still has
more rows than source table after copying.
Change-Id: I089bdd5e737f4eef94068303516ceb0d5ddd3abb
Reviewed-on: http://gerrit.cloudera.org:8080/12932
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
src/kudu/tools/kudu-tool-test.cc | 55 ++++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 25 deletions(-)
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index 8ed3c3b..7a3760c 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -551,34 +551,39 @@ class ToolTest : public KuduTest {
}
// Check all values.
- {
- vector<string> src_lines;
- NO_FATALS(RunActionStdoutLines(
- Substitute("table scan $0 $1 -show_values=true "
- "-columns=$2 -predicates=$3 -num_threads=1",
- cluster_->master()->bound_rpc_addr().ToString(),
- args.src_table_name, args.columns, args.predicates_json), &src_lines));
+ vector<string> src_lines;
+ NO_FATALS(RunActionStdoutLines(
+ Substitute("table scan $0 $1 -show_values=true "
+ "-columns=$2 -predicates=$3 -num_threads=1",
+ cluster_->master()->bound_rpc_addr().ToString(),
+ args.src_table_name, args.columns, args.predicates_json), &src_lines));
- vector<string> dst_lines;
- NO_FATALS(RunActionStdoutLines(
- Substitute("table scan $0 $1 -show_values=true "
- "-columns=$2 -num_threads=1",
- cluster_->master()->bound_rpc_addr().ToString(),
- kDstTableName, args.columns), &dst_lines));
+ vector<string> dst_lines;
+ NO_FATALS(RunActionStdoutLines(
+ Substitute("table scan $0 $1 -show_values=true "
+ "-columns=$2 -num_threads=1",
+ cluster_->master()->bound_rpc_addr().ToString(),
+ kDstTableName, args.columns), &dst_lines));
- if (args.mode == TableCopyMode::COPY_SCHEMA_ONLY) {
- ASSERT_GT(dst_lines.size(), 1);
- ASSERT_STR_CONTAINS(*dst_lines.rbegin(), "Total count 0 ");
- } else {
- set<string> sorted_dst_lines(dst_lines.begin(), dst_lines.end());
- for (auto src_line = src_lines.begin(); src_line != src_lines.end();) {
- if (src_line->find("key") != string::npos) {
- ASSERT_TRUE(ContainsKey(sorted_dst_lines, *src_line));
- sorted_dst_lines.erase(*src_line);
- }
- src_line = src_lines.erase(src_line);
+ if (args.mode == TableCopyMode::COPY_SCHEMA_ONLY) {
+ ASSERT_GT(dst_lines.size(), 1);
+ ASSERT_STR_CONTAINS(*dst_lines.rbegin(), "Total count 0 ");
+ } else {
+ // Rows scanned from source table can be found in destination table.
+ set<string> sorted_dst_lines(dst_lines.begin(), dst_lines.end());
+ for (auto src_line = src_lines.begin(); src_line != src_lines.end();) {
+ if (src_line->find("key") != string::npos) {
+ ASSERT_TRUE(ContainsKey(sorted_dst_lines, *src_line));
+ sorted_dst_lines.erase(*src_line);
}
- for (const auto &dst_line : sorted_dst_lines) {
+ src_line = src_lines.erase(src_line);
+ }
+
+ // Under all modes except UPSERT_TO_EXIST_TABLE, destination table is empty before
+ // copying, that means destination table should have no more rows than source table
+ // after copying.
+ if (args.mode != TableCopyMode::UPSERT_TO_EXIST_TABLE) {
+ for (const auto& dst_line : sorted_dst_lines) {
ASSERT_STR_NOT_CONTAINS(dst_line, "key");
}
}