Created
October 12, 2016 20:04
-
-
Save alexeyserbin/06ed8dbdb0e8e9abcbde2991c6615660 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..9864b17 100644 | |
--- a/src/kudu/integration-tests/tablet_history_gc-itest.cc | |
+++ b/src/kudu/integration-tests/tablet_history_gc-itest.cc | |
@@ -380,12 +380,26 @@ 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; | |
+ int action; | |
+ switch (cur_round_ % 3) { | |
+ case 0: | |
+ action = kInsert; | |
+ break; | |
+ case 1: | |
+ action = kUpdate; | |
+ break; | |
+ default: | |
+ action = kStartScan; | |
+ break; | |
+ } | |
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 = 512; | |
VLOG(1) << "Inserting " << num_rows_to_insert << " rows"; | |
if (num_rows_to_insert == 0) continue; | |
MaterializedTestTable snapshot = CloneLatestSnapshot(); | |
@@ -393,13 +407,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,28 +433,32 @@ 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 = 512; | |
VLOG(1) << "Updating up to " << num_rows_to_update << " rows"; | |
if (num_rows_to_update == 0) continue; | |
MaterializedTestTable snapshot = CloneLatestSnapshot(); | |
// 5% chance to reupdate while also forcing a full compaction. | |
- bool force_reupdate_missed_deltas = random.OneIn(20); | |
+ //bool force_reupdate_missed_deltas = random.OneIn(20); | |
+ bool force_reupdate_missed_deltas = false; | |
if (force_reupdate_missed_deltas) { | |
VLOG(1) << "Forcing a reupdate of missed deltas"; | |
} | |
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 +479,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 +488,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 +498,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 +541,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