db/view/view_builder: Don't timeout waiting for view to be built
Remove the timeout argument to db::view::view_builder::wait_until_built(), a test-only function to wait until a given materialized view has finished building. This change is motivated by the fact that some tests running on slow environments will timeout. Instead of incrementally increasing the timeout, remove it completely since tests are already run under an exterior timeout. Fixes #3920 Tests: unit release(view_build_test, view_schema_test) Signed-off-by: Duarte Nunes <duarte@scylladb.com> Message-Id: <20181115173902.19048-1-duarte@scylladb.com>
This commit is contained in:
@@ -1614,10 +1614,10 @@ future<> view_builder::maybe_mark_view_as_built(view_ptr view, dht::token next_t
|
||||
});
|
||||
}
|
||||
|
||||
future<> view_builder::wait_until_built(const sstring& ks_name, const sstring& view_name, lowres_clock::time_point timeout) {
|
||||
return container().invoke_on(0, [ks_name, view_name, timeout] (view_builder& builder) {
|
||||
future<> view_builder::wait_until_built(const sstring& ks_name, const sstring& view_name) {
|
||||
return container().invoke_on(0, [ks_name, view_name] (view_builder& builder) {
|
||||
auto v = std::pair(std::move(ks_name), std::move(view_name));
|
||||
return builder._build_notifiers[std::move(v)].get_shared_future(timeout);
|
||||
return builder._build_notifiers[std::move(v)].get_shared_future();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
virtual void on_drop_view(const sstring& ks_name, const sstring& view_name) override;
|
||||
|
||||
// For tests
|
||||
future<> wait_until_built(const sstring& ks_name, const sstring& view_name, lowres_clock::time_point timeout);
|
||||
future<> wait_until_built(const sstring& ks_name, const sstring& view_name);
|
||||
|
||||
private:
|
||||
build_step& get_or_create_build_step(utils::UUID);
|
||||
|
||||
@@ -65,7 +65,7 @@ SEASTAR_TEST_CASE(test_builder_with_large_partition) {
|
||||
e.execute_cql(format("insert into cf (p, c, v) values (0, {:d}, 0)", i)).get();
|
||||
}
|
||||
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf", lowres_clock::now() + 10s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf");
|
||||
e.execute_cql("create materialized view vcf as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
"primary key (v, c, p)").get();
|
||||
@@ -89,7 +89,7 @@ SEASTAR_TEST_CASE(test_builder_with_multiple_partitions) {
|
||||
e.execute_cql(format("insert into cf (p, c, v) values ({:d}, {:d}, 0)", i % 5, i)).get();
|
||||
}
|
||||
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf", lowres_clock::now() + 10s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf");
|
||||
e.execute_cql("create materialized view vcf as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
"primary key (v, c, p)").get();
|
||||
@@ -113,7 +113,7 @@ SEASTAR_TEST_CASE(test_builder_with_multiple_partitions_of_batch_size_rows) {
|
||||
e.execute_cql(format("insert into cf (p, c, v) values ({:d}, {:d}, 0)", i % db::view::view_builder::batch_size, i)).get();
|
||||
}
|
||||
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf", lowres_clock::now() + 10s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf");
|
||||
e.execute_cql("create materialized view vcf as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
"primary key (v, c, p)").get();
|
||||
@@ -137,8 +137,8 @@ SEASTAR_TEST_CASE(test_builder_view_added_during_ongoing_build) {
|
||||
e.execute_cql(format("insert into cf (p, c, v) values (0, {:d}, 0)", i)).get();
|
||||
}
|
||||
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf1", lowres_clock::now() + 60s);
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", "vcf2", lowres_clock::now() + 30s);
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf1");
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", "vcf2");
|
||||
|
||||
e.execute_cql("create materialized view vcf1 as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
@@ -196,8 +196,8 @@ SEASTAR_TEST_CASE(test_builder_across_tokens_with_large_partitions) {
|
||||
}
|
||||
}
|
||||
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf1", lowres_clock::now() + 60s);
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", "vcf2", lowres_clock::now() + 30s);
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf1");
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", "vcf2");
|
||||
|
||||
e.execute_cql("create materialized view vcf1 as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
@@ -238,8 +238,8 @@ SEASTAR_TEST_CASE(test_builder_across_tokens_with_small_partitions) {
|
||||
}
|
||||
}
|
||||
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf1", lowres_clock::now() + 60s);
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", "vcf2", lowres_clock::now() + 30s);
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf1");
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", "vcf2");
|
||||
|
||||
e.execute_cql("create materialized view vcf1 as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
@@ -278,7 +278,7 @@ SEASTAR_TEST_CASE(test_builder_with_tombstones) {
|
||||
e.execute_cql("delete from cf where p = 0 and c1 = 0").get();
|
||||
e.execute_cql("delete from cf where p = 0 and c1 = 1 and c2 >= 50 and c2 < 101").get();
|
||||
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf", lowres_clock::now() + 30s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf");
|
||||
e.execute_cql("create materialized view vcf as select * from cf "
|
||||
"where p is not null and c1 is not null and c2 is not null and v is not null "
|
||||
"primary key ((v, p), c1, c2)").get();
|
||||
@@ -316,7 +316,7 @@ SEASTAR_TEST_CASE(test_builder_with_concurrent_writes) {
|
||||
}
|
||||
}
|
||||
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf", lowres_clock::now() + 60s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", "vcf");
|
||||
e.execute_cql("create materialized view vcf as select * from cf "
|
||||
"where p is not null and c is not null and v is not null "
|
||||
"primary key (v, c, p)").get();
|
||||
|
||||
@@ -3530,7 +3530,7 @@ SEASTAR_TEST_CASE(test_base_non_pk_columns_in_view_partition_key_are_non_emtpy)
|
||||
};
|
||||
for (auto&& view : views_matching) {
|
||||
auto name = make_view_name();
|
||||
auto f = e.local_view_builder().wait_until_built("ks", name, lowres_clock::now() + 5s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", name);
|
||||
e.execute_cql(sprint(view, name)).get();
|
||||
f.get();
|
||||
auto msg = e.execute_cql(format("select p1, p2, c, v from {}", name)).get0();
|
||||
@@ -3555,14 +3555,14 @@ SEASTAR_TEST_CASE(test_base_non_pk_columns_in_view_partition_key_are_non_emtpy)
|
||||
};
|
||||
for (auto&& view : views_not_matching) {
|
||||
auto name = make_view_name();
|
||||
auto f = e.local_view_builder().wait_until_built("ks", name, lowres_clock::now() + 5s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", name);
|
||||
e.execute_cql(sprint(view, name)).get();
|
||||
f.get();
|
||||
auto msg = e.execute_cql(format("select p1, p2, c, v from {}", name)).get0();
|
||||
assert_that(msg).is_rows().is_empty();
|
||||
}
|
||||
auto name = make_view_name();
|
||||
auto f = e.local_view_builder().wait_until_built("ks", name, lowres_clock::now() + 5s);
|
||||
auto f = e.local_view_builder().wait_until_built("ks", name);
|
||||
e.execute_cql(sprint("create materialized view %s as select * from cf "
|
||||
"where p1 is not null and p2 is not null and c is not null and v is not null "
|
||||
"primary key (v, p1, p2, c)", name)).get();
|
||||
|
||||
@@ -273,8 +273,8 @@ SEASTAR_TEST_CASE(test_query_built_indexes_virtual_table) {
|
||||
return do_with_cql_env_thread([] (cql_test_env& e) {
|
||||
auto idx = secondary_index::index_table_name("idx");
|
||||
e.execute_cql("create table cf(p int PRIMARY KEY, v int);").get();
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf", lowres_clock::now() + 10min);
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", idx, lowres_clock::now() + 10min);
|
||||
auto f1 = e.local_view_builder().wait_until_built("ks", "vcf");
|
||||
auto f2 = e.local_view_builder().wait_until_built("ks", idx);
|
||||
e.execute_cql("create materialized view vcf as select * from cf "
|
||||
"where v is not null and p is not null "
|
||||
"primary key (v, p)").get();
|
||||
|
||||
Reference in New Issue
Block a user