-
-
Save alexeyserbin/7c885148dadff8705912f6cc513108d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/kudu/integration-tests/tablet_history_gc-itest.cc b/src/kudu/integration-tests/tablet_history_gc-itest.cc | |
index ec1e78a..626631c 100644 | |
--- a/src/kudu/integration-tests/tablet_history_gc-itest.cc | |
+++ b/src/kudu/integration-tests/tablet_history_gc-itest.cc | |
@@ -380,12 +380,14 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
VLOG(1) << "Starting round " << cur_round_; | |
NO_FATALS(VerifyScannersForRound(cur_round_)); | |
- int action = random.Uniform(kNumActions); | |
+ //int action = random.Uniform(kNumActions); | |
+ const int action = cur_round_ % kNumActions; | |
switch (action) { | |
case kInsert: { | |
// TODO: Allow for reinsert onto deleted rows after KUDU-237 has been | |
// implemented. | |
- int32_t num_rows_to_insert = random.Uniform(1000); | |
+ //int32_t num_rows_to_insert = random.Uniform(1000); | |
+ int32_t num_rows_to_insert = 500; | |
VLOG(1) << "Inserting " << num_rows_to_insert << " rows"; | |
if (num_rows_to_insert == 0) continue; | |
MaterializedTestTable snapshot = CloneLatestSnapshot(); | |
@@ -393,13 +395,14 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
client::sp::shared_ptr<client::KuduSession> session = client_->NewSession(); | |
session->SetTimeoutMillis(20000); | |
ASSERT_OK_FAST(session->SetFlushMode( | |
- client::KuduSession::AUTO_FLUSH_BACKGROUND)); | |
+ client::KuduSession::MANUAL_FLUSH)); | |
for (int32_t i = 0; i < num_rows_to_insert; i++) { | |
int32_t row_key = rows_inserted_; | |
+ const int32_t val = static_cast<int32_t>(random.Next()); | |
MaterializedTestRow test_row = { row_key, | |
- static_cast<int32_t>(random.Next()), | |
- Substitute("$0", random.Next()), | |
+ val, | |
+ Substitute("$0", val + 1), | |
NOT_DELETED }; | |
unique_ptr<client::KuduInsert> insert(table->NewInsert()); | |
KuduPartialRow* row = insert->mutable_row(); | |
@@ -418,7 +421,8 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
} | |
case kUpdate: { | |
if (rows_inserted_ == 0) continue; | |
- int32_t num_rows_to_update = random.Uniform(std::min(rows_inserted_, 1000)); | |
+ //int32_t num_rows_to_update = random.Uniform(std::min(rows_inserted_, 1000)); | |
+ int32_t num_rows_to_update = 256; | |
VLOG(1) << "Updating up to " << num_rows_to_update << " rows"; | |
if (num_rows_to_update == 0) continue; | |
@@ -432,14 +436,16 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
vector<MaterializedTestRow> updates; | |
for (int i = 0; i < num_rows_to_update; i++) { | |
- int32_t row_key = random.Uniform(rows_inserted_); | |
+ //int32_t row_key = random.Uniform(rows_inserted_); | |
+ int32_t row_key = rows_inserted_ - 1 - (i / 2); | |
MaterializedTestRow test_row = snapshot[row_key]; | |
CHECK_EQ(row_key, test_row.key) << "Rows inserted: " << rows_inserted_ | |
<< ", row: " << StringifyTestRow(test_row); | |
if (test_row.is_deleted == DELETED) continue; | |
- test_row.int_val = random.Next(); | |
- test_row.string_val = Substitute("$0", random.Next()); | |
+ const int32_t val = random.Next(); | |
+ test_row.int_val = val; | |
+ test_row.string_val = Substitute("$0", val - 1); | |
VLOG(2) << "Updating row to " << StringifyTestRow(test_row); | |
updates.push_back(test_row); | |
@@ -460,7 +466,7 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
client::sp::shared_ptr<client::KuduSession> session = client_->NewSession(); | |
session->SetTimeoutMillis(20000); | |
ASSERT_OK_FAST(session->SetFlushMode( | |
- client::KuduSession::AUTO_FLUSH_BACKGROUND)); | |
+ client::KuduSession::MANUAL_FLUSH)); | |
for (const MaterializedTestRow& test_row : updates) { | |
unique_ptr<client::KuduUpdate> update(table->NewUpdate()); | |
@@ -469,6 +475,7 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
ASSERT_OK_FAST(row->SetInt32(1, test_row.int_val)); | |
ASSERT_OK_FAST(row->SetStringCopy(2, test_row.string_val)); | |
ASSERT_OK_FAST(session->Apply(update.release())); | |
+ session->FlushAsync(nullptr); | |
} | |
FlushSessionOrDie(session); | |
} | |
@@ -478,7 +485,8 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
} | |
case kDelete: { | |
if (rows_inserted_ == 0) continue; | |
- int32_t num_rows_to_delete = random.Uniform(std::min(rows_inserted_, 1000)); | |
+ //int32_t num_rows_to_delete = random.Uniform(std::min(rows_inserted_, 1000)); | |
+ int32_t num_rows_to_delete = 25; | |
VLOG(1) << "Deleting up to " << num_rows_to_delete << " rows"; | |
if (num_rows_to_delete == 0) continue; | |
@@ -520,7 +528,7 @@ TEST_F(RandomizedTabletHistoryGcITest, TestRandomHistoryGCWorkload) { | |
client::sp::shared_ptr<client::KuduSession> session = client_->NewSession(); | |
session->SetTimeoutMillis(20000); | |
ASSERT_OK_FAST(session->SetFlushMode( | |
- client::KuduSession::AUTO_FLUSH_BACKGROUND)); | |
+ client::KuduSession::MANUAL_FLUSH)); | |
for (int32_t row_key : deletes) { | |
unique_ptr<client::KuduDelete> del(table->NewDelete()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment