This is an automated email from the ASF dual-hosted git repository.

mpercy 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 1401630  tablet_server-test-base: make types match schema
1401630 is described below

commit 140163057228393edb9ddbaa0b773cd130d79119
Author: Mike Percy <[email protected]>
AuthorDate: Fri Mar 22 20:26:15 2019 -0700

    tablet_server-test-base: make types match schema
    
    This patch makes the types used in the TabletServerTestBase helper
    methods consistent with the schema they assume, which specifies an int32
    for both the key and the value fields.
    
    Additionally, fix up the variable types in various places in
    tablet_server-test to match the calls that are assigned to them.
    
    Change-Id: I209db29d8be884db1173f5141f2e63a89c32d408
    Reviewed-on: http://gerrit.cloudera.org:8080/12839
    Reviewed-by: Adar Dembo <[email protected]>
    Tested-by: Kudu Jenkins
---
 src/kudu/tserver/tablet_server-test-base.cc | 28 ++++++++++++++--------------
 src/kudu/tserver/tablet_server-test-base.h  | 14 +++++++-------
 src/kudu/tserver/tablet_server-test.cc      | 18 +++++++++---------
 3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/kudu/tserver/tablet_server-test-base.cc 
b/src/kudu/tserver/tablet_server-test-base.cc
index 9c46103..f9bf79d 100644
--- a/src/kudu/tserver/tablet_server-test-base.cc
+++ b/src/kudu/tserver/tablet_server-test-base.cc
@@ -156,7 +156,7 @@ Status TabletServerTestBase::WaitForTabletRunning(const 
char *tablet_id) {
   return 
tablet_manager->WaitForNoTransitionsForTests(MonoDelta::FromSeconds(10));
 }
 
-void TabletServerTestBase::UpdateTestRowRemote(int64_t row_idx,
+void TabletServerTestBase::UpdateTestRowRemote(int32_t row_idx,
                                                int32_t new_val,
                                                TimeSeries* ts) {
   WriteRequestPB req;
@@ -191,11 +191,11 @@ void TabletServerTestBase::ResetClientProxies() {
 }
 
 // Inserts 'num_rows' test rows directly into the tablet (i.e not via RPC)
-void TabletServerTestBase::InsertTestRowsDirect(int64_t start_row,
-                                                uint64_t num_rows) {
+void TabletServerTestBase::InsertTestRowsDirect(int32_t start_row,
+                                                int32_t num_rows) {
   tablet::LocalTabletWriter writer(tablet_replica_->tablet(), &schema_);
   KuduPartialRow row(&schema_);
-  for (int64_t i = 0; i < num_rows; i++) {
+  for (int32_t i = 0; i < num_rows; i++) {
     BuildTestRow(start_row + i, &row);
     CHECK_OK(writer.Insert(row));
   }
@@ -205,9 +205,9 @@ void TabletServerTestBase::InsertTestRowsDirect(int64_t 
start_row,
 // Rows are grouped in batches of 'count'/'num_batches' size.
 // Batch size defaults to 1.
 void TabletServerTestBase::InsertTestRowsRemote(
-    int64_t first_row,
-    uint64_t count,
-    uint64_t num_batches,
+    int32_t first_row,
+    int32_t count,
+    int32_t num_batches,
     TabletServerServiceProxy* proxy,
     string tablet_id,
     vector<uint64_t>* write_timestamps_collector,
@@ -231,7 +231,7 @@ void TabletServerTestBase::InsertTestRowsRemote(
 
   ASSERT_OK(SchemaToPB(schema_, req.mutable_schema()));
 
-  uint64_t inserted_since_last_report = 0;
+  int32_t inserted_since_last_report = 0;
   for (int i = 0; i < num_batches; ++i) {
 
     // reset the controller and the request
@@ -239,10 +239,10 @@ void TabletServerTestBase::InsertTestRowsRemote(
     controller.set_timeout(MonoDelta::FromSeconds(FLAGS_rpc_timeout));
     data->Clear();
 
-    uint64_t first_row_in_batch = first_row + (i * count / num_batches);
-    uint64_t last_row_in_batch = first_row_in_batch + count / num_batches;
+    int32_t first_row_in_batch = first_row + (i * count / num_batches);
+    int32_t last_row_in_batch = first_row_in_batch + count / num_batches;
 
-    for (int j = first_row_in_batch; j < last_row_in_batch; j++) {
+    for (int32_t j = first_row_in_batch; j < last_row_in_batch; j++) {
       string str_val = Substitute("original$0", j);
       const char* cstr_val = str_val.c_str();
       if (!string_field_defined) {
@@ -275,8 +275,8 @@ void TabletServerTestBase::InsertTestRowsRemote(
 }
 
 // Delete specified test row range.
-void TabletServerTestBase::DeleteTestRowsRemote(int64_t first_row,
-                                                uint64_t count,
+void TabletServerTestBase::DeleteTestRowsRemote(int32_t first_row,
+                                                int32_t count,
                                                 TabletServerServiceProxy* 
proxy,
                                                 string tablet_id) {
   if (!proxy) {
@@ -291,7 +291,7 @@ void TabletServerTestBase::DeleteTestRowsRemote(int64_t 
first_row,
   ASSERT_OK(SchemaToPB(schema_, req.mutable_schema()));
 
   RowOperationsPB* ops = req.mutable_row_operations();
-  for (int64_t rowid = first_row; rowid < first_row + count; rowid++) {
+  for (int32_t rowid = first_row; rowid < first_row + count; rowid++) {
     AddTestKeyToPB(RowOperationsPB::DELETE, schema_, rowid, ops);
   }
 
diff --git a/src/kudu/tserver/tablet_server-test-base.h 
b/src/kudu/tserver/tablet_server-test-base.h
index e325496..2f6af1d 100644
--- a/src/kudu/tserver/tablet_server-test-base.h
+++ b/src/kudu/tserver/tablet_server-test-base.h
@@ -64,21 +64,21 @@ class TabletServerTestBase : public KuduTest {
 
   Status WaitForTabletRunning(const char *tablet_id);
 
-  void UpdateTestRowRemote(int64_t row_idx,
+  void UpdateTestRowRemote(int32_t row_idx,
                            int32_t new_val,
                            TimeSeries* ts = nullptr);
 
   void ResetClientProxies();
 
   // Inserts 'num_rows' test rows directly into the tablet (i.e not via RPC)
-  void InsertTestRowsDirect(int64_t start_row, uint64_t num_rows);
+  void InsertTestRowsDirect(int32_t start_row, int32_t num_rows);
 
   // Inserts 'num_rows' test rows remotely into the tablet (i.e via RPC)
   // Rows are grouped in batches of 'count'/'num_batches' size.
   // Batch size defaults to 1.
-  void InsertTestRowsRemote(int64_t first_row,
-                            uint64_t count,
-                            uint64_t num_batches = -1,
+  void InsertTestRowsRemote(int32_t first_row,
+                            int32_t count,
+                            int32_t num_batches = -1,
                             TabletServerServiceProxy* proxy = nullptr,
                             std::string tablet_id = kTabletId,
                             std::vector<uint64_t>* write_timestamps_collector 
= nullptr,
@@ -86,8 +86,8 @@ class TabletServerTestBase : public KuduTest {
                             bool string_field_defined = true);
 
   // Delete specified test row range.
-  void DeleteTestRowsRemote(int64_t first_row,
-                            uint64_t count,
+  void DeleteTestRowsRemote(int32_t first_row,
+                            int32_t count,
                             TabletServerServiceProxy* proxy = nullptr,
                             std::string tablet_id = kTabletId);
 
diff --git a/src/kudu/tserver/tablet_server-test.cc 
b/src/kudu/tserver/tablet_server-test.cc
index b59e55e..b720929 100644
--- a/src/kudu/tserver/tablet_server-test.cc
+++ b/src/kudu/tserver/tablet_server-test.cc
@@ -2117,7 +2117,7 @@ TEST_F(TabletServerTest, TestScanYourWrites) {
   // Scan with READ_YOUR_WRITES mode and use the previous
   // write response as the propagated timestamp.
   ScanResponsePB resp;
-  int64_t propagated_timestamp = write_timestamps_collector[0];
+  uint64_t propagated_timestamp = write_timestamps_collector[0];
   ScanYourWritesTest(propagated_timestamp, &resp);
 
   // Store the returned snapshot timestamp as the propagated
@@ -2252,20 +2252,20 @@ TEST_F(TabletServerTest, 
TestNonPositiveLimitsShortCircuit) {
 // Randomized test that runs a few scans with varying limits.
 TEST_F(TabletServerTest, TestRandomizedScanLimits) {
   // Set a relatively small batch size...
-  const int64_t kBatchSizeRows = rand() % 1000;
+  const int kBatchSizeRows = rand() % 1000;
   // ...and decent number of rows, such that we can get a good mix of
   // multiple-batch and single-batch scans.
-  const int64_t kNumRows = rand() % 2000;
+  const int kNumRows = rand() % 2000;
   FLAGS_scanner_batch_size_rows = kBatchSizeRows;
   InsertTestRowsDirect(0, kNumRows);
   LOG(INFO) << Substitute("Rows inserted: $0, batch size: $1", kNumRows, 
kBatchSizeRows);
 
-  for (int64_t i = 1; i < 100; i++) {
+  for (int i = 1; i < 100; i++) {
     // To broaden a range of coverage, gradiate the max limit that we can set.
-    const int64_t kMaxLimit = kNumRows * static_cast<double>(0.01 * i);
+    const int kMaxLimit = kNumRows * static_cast<double>(0.01 * i);
 
     // Get a random limit, capped by the max, inclusive.
-    const int64_t kLimit = rand() % kMaxLimit + 1;
+    const int kLimit = rand() % kMaxLimit + 1;
     LOG(INFO) << "Scanning with a limit of " << kLimit;
 
     ScanRequestPB req;
@@ -3034,14 +3034,14 @@ TEST_F(TabletServerTest, 
TestInsertLatencyMicroBenchmark) {
 
   scoped_refptr<Histogram> histogram = 
METRIC_insert_latency.Instantiate(ts_test_metric_entity_);
 
-  uint64_t warmup = AllowSlowTests() ?
+  int warmup = AllowSlowTests() ?
       FLAGS_single_threaded_insert_latency_bench_warmup_rows : 10;
 
   for (int i = 0; i < warmup; i++) {
     InsertTestRowsRemote(i, 1);
   }
 
-  uint64_t max_rows = AllowSlowTests() ?
+  int max_rows = AllowSlowTests() ?
       FLAGS_single_threaded_insert_latency_bench_insert_rows : 100;
 
   MonoTime start = MonoTime::Now();
@@ -3489,7 +3489,7 @@ TEST_F(TabletServerTest, TestScannerCheckMatchingUser) {
 
   // Now do a checksum scan as the user.
   string checksum_scanner_id;
-  int64_t checksum_val;
+  uint64_t checksum_val;
   {
     ChecksumRequestPB checksum_req;
     ChecksumResponsePB checksum_resp;

Reply via email to