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

alexey 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 5f0964a  [tserver] avoid copying Schema in SplitKeyRange()
5f0964a is described below

commit 5f0964a5ca7476b9bbb6d56fdb131eec50699d21
Author: Alexey Serbin <ale...@apache.org>
AuthorDate: Wed Feb 16 14:27:34 2022 -0800

    [tserver] avoid copying Schema in SplitKeyRange()
    
    This patch cleans up the code in src/kudu/tserver/tablet_service.cc
    a bit to stop copying Schema in TabletServiceImpl::SplitKeyRange();
    other minor clean up.
    
    This is a follow-up to d4ded71bc0edadcbe2564d5677d319f35e48dad8.
    
    Change-Id: I07642a438a4eeee6812828ddd871534bdf985155
    Reviewed-on: http://gerrit.cloudera.org:8080/18238
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Tested-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/common/key_range.h        |  8 ++++----
 src/kudu/tserver/tablet_service.cc | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/kudu/common/key_range.h b/src/kudu/common/key_range.h
index 6e555ea..0c9b02f 100644
--- a/src/kudu/common/key_range.h
+++ b/src/kudu/common/key_range.h
@@ -46,14 +46,14 @@ class KeyRange {
     return stop_key_;
   }
 
-  const uint64_t size_bytes() const {
+  uint64_t size_bytes() const {
     return size_bytes_;
   }
 
  private:
-  std::string start_key_;
-  std::string stop_key_;
-  uint64_t size_bytes_;
+  const std::string start_key_;
+  const std::string stop_key_;
+  const uint64_t size_bytes_;
 };
 
 } // namespace kudu
diff --git a/src/kudu/tserver/tablet_service.cc 
b/src/kudu/tserver/tablet_service.cc
index 16c73ba..d32e661 100644
--- a/src/kudu/tserver/tablet_service.cc
+++ b/src/kudu/tserver/tablet_service.cc
@@ -2254,10 +2254,10 @@ void TabletServiceImpl::ListTablets(const 
ListTabletsRequestPB* req,
     }
 
     if (req->need_schema_info()) {
-      CHECK_OK(SchemaToPB(replica->tablet_metadata()->schema(),
-                          status->mutable_schema()));
+      const auto& tablet_schema = replica->tablet_metadata()->schema();
+      CHECK_OK(SchemaToPB(tablet_schema, status->mutable_schema()));
       CHECK_OK(replica->tablet_metadata()->partition_schema().ToPB(
-          replica->tablet_metadata()->schema(), 
status->mutable_partition_schema()));
+          tablet_schema, status->mutable_partition_schema()));
       status->set_schema_version(replica->tablet_metadata()->schema_version());
     }
   }
@@ -2345,7 +2345,7 @@ void TabletServiceImpl::SplitKeyRange(const 
SplitKeyRangeRequestPB* req,
 
   // Decode encoded key
   Arena arena(256);
-  Schema tablet_schema = replica->tablet_metadata()->schema();
+  const auto& tablet_schema = replica->tablet_metadata()->schema();
   EncodedKey* start = nullptr;
   EncodedKey* stop = nullptr;
   if (req->has_start_primary_key()) {
@@ -2788,7 +2788,7 @@ Status 
TabletServiceImpl::HandleNewScanRequest(TabletReplica* replica,
     }
   }
 
-  const Schema& tablet_schema = replica->tablet_metadata()->schema();
+  const auto& tablet_schema = replica->tablet_metadata()->schema();
 
   ScanSpec spec;
   s = SetupScanSpec(scan_pb, tablet_schema, scanner, &spec);

Reply via email to