Speed up DB key_value tests.

This commit is contained in:
levlam 2020-11-22 17:34:01 +03:00
parent 30fb689ba3
commit 172c08a991

View File

@ -350,7 +350,7 @@ TEST(DB, key_value) {
values.push_back(rand_string('a', 'b', Random::fast(1, 10))); values.push_back(rand_string('a', 'b', Random::fast(1, 10)));
} }
int queries_n = 300000; int queries_n = 30000;
std::vector<DbQuery> queries(queries_n); std::vector<DbQuery> queries(queries_n);
for (auto &q : queries) { for (auto &q : queries) {
int op = Random::fast(0, 2); int op = Random::fast(0, 2);
@ -399,14 +399,14 @@ TEST(DB, key_value) {
ASSERT_EQ(a.value, c.value); ASSERT_EQ(a.value, c.value);
ASSERT_EQ(a.value, d.value); ASSERT_EQ(a.value, d.value);
ASSERT_EQ(a.value, e.value); ASSERT_EQ(a.value, e.value);
if (cnt++ % 10000 == 0) { if (cnt++ % 5000 == 0) {
new_kv.impl().init(new_kv_name.str()).ensure(); new_kv.impl().init(new_kv_name.str()).ensure();
} }
} }
} }
TEST(DB, thread_key_value) {
#if !TD_THREAD_UNSUPPORTED #if !TD_THREAD_UNSUPPORTED
TEST(DB, thread_key_value) {
std::vector<std::string> keys; std::vector<std::string> keys;
std::vector<std::string> values; std::vector<std::string> values;
@ -418,7 +418,7 @@ TEST(DB, thread_key_value) {
} }
int threads_n = 4; int threads_n = 4;
int queries_n = 100000; int queries_n = 10000;
std::vector<std::vector<DbQuery>> queries(threads_n, std::vector<DbQuery>(queries_n)); std::vector<std::vector<DbQuery>> queries(threads_n, std::vector<DbQuery>(queries_n));
for (auto &qs : queries) { for (auto &qs : queries) {
@ -507,8 +507,8 @@ TEST(DB, thread_key_value) {
baseline.do_query(res[best][pos[best]]); baseline.do_query(res[best][pos[best]]);
pos[best]++; pos[best]++;
} }
#endif
} }
#endif
TEST(DB, persistent_key_value) { TEST(DB, persistent_key_value) {
using KeyValue = BinlogKeyValue<ConcurrentBinlog>; using KeyValue = BinlogKeyValue<ConcurrentBinlog>;