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 2bf2b2d5d [tablet-copy] Simple refactor on 
tablet_copy_service{.h,.cc,-test.cc}
2bf2b2d5d is described below

commit 2bf2b2d5dcd61a80f928e9f4a20fe70c42f00592
Author: Yingchun Lai <acelyc1112...@gmail.com>
AuthorDate: Sun Apr 3 23:17:54 2022 +0800

    [tablet-copy] Simple refactor on tablet_copy_service{.h,.cc,-test.cc}
    
    There is no functional changes in this patch, but only code style
    related changes.
    
    Change-Id: If1f4fd31cf3b217e604b565165a04efa017d19d2
    Reviewed-on: http://gerrit.cloudera.org:8080/18379
    Tested-by: Kudu Jenkins
    Reviewed-by: Alexey Serbin <ale...@apache.org>
---
 src/kudu/tserver/tablet_copy_service-test.cc | 12 +++++------
 src/kudu/tserver/tablet_copy_service.cc      |  6 +++---
 src/kudu/tserver/tablet_copy_service.h       | 32 +++++++++++++---------------
 3 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/src/kudu/tserver/tablet_copy_service-test.cc 
b/src/kudu/tserver/tablet_copy_service-test.cc
index 97c6578ac..d7a0714d1 100644
--- a/src/kudu/tserver/tablet_copy_service-test.cc
+++ b/src/kudu/tserver/tablet_copy_service-test.cc
@@ -106,9 +106,9 @@ class TabletCopyServiceTest : public TabletCopyTest {
   }
 
   Status DoBeginValidTabletCopySession(string* session_id,
-                                            tablet::TabletSuperBlockPB* 
superblock = nullptr,
-                                            uint64_t* idle_timeout_millis = 
nullptr,
-                                            vector<uint64_t>* sequence_numbers 
= nullptr) {
+                                       tablet::TabletSuperBlockPB* superblock 
= nullptr,
+                                       uint64_t* idle_timeout_millis = nullptr,
+                                       vector<uint64_t>* sequence_numbers = 
nullptr) {
     BeginTabletCopySessionResponsePB resp;
     RpcController controller;
     RETURN_NOT_OK(DoBeginTabletCopySession(GetTabletId(), GetLocalUUID(), 
&resp, &controller));
@@ -218,9 +218,9 @@ TEST_F(TabletCopyServiceTest, TestSimpleBeginEndSession) {
   uint64_t idle_timeout_millis;
   vector<uint64_t> segment_seqnos;
   ASSERT_OK(DoBeginValidTabletCopySession(&session_id,
-                                               &superblock,
-                                               &idle_timeout_millis,
-                                               &segment_seqnos));
+                                          &superblock,
+                                          &idle_timeout_millis,
+                                          &segment_seqnos));
   // Basic validation of returned params.
   ASSERT_FALSE(session_id.empty());
   ASSERT_EQ(FLAGS_tablet_copy_idle_timeout_sec * 1000, idle_timeout_millis);
diff --git a/src/kudu/tserver/tablet_copy_service.cc 
b/src/kudu/tserver/tablet_copy_service.cc
index 55ef98a3a..68fc2b249 100644
--- a/src/kudu/tserver/tablet_copy_service.cc
+++ b/src/kudu/tserver/tablet_copy_service.cc
@@ -34,6 +34,7 @@
 #include "kudu/fs/fs_manager.h"
 #include "kudu/gutil/macros.h"
 #include "kudu/gutil/map-util.h"
+#include "kudu/gutil/port.h"
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/rpc/rpc_context.h"
 #include "kudu/server/server_base.h"
@@ -285,7 +286,7 @@ void TabletCopyServiceImpl::FetchData(const 
FetchDataRequestPB* req,
 
   const DataIdPB& data_id = req->data_id();
   TabletCopyErrorPB::Code error_code = TabletCopyErrorPB::UNKNOWN_ERROR;
-  RPC_RETURN_NOT_OK(ValidateFetchRequestDataId(data_id, &error_code, session),
+  RPC_RETURN_NOT_OK(ValidateFetchRequestDataId(data_id, &error_code),
                     error_code, "Invalid DataId", context);
 
   DataChunkPB* data_chunk = resp->mutable_chunk();
@@ -368,8 +369,7 @@ Status TabletCopyServiceImpl::FindSessionUnlocked(
 
 Status TabletCopyServiceImpl::ValidateFetchRequestDataId(
         const DataIdPB& data_id,
-        TabletCopyErrorPB::Code* app_error,
-        const scoped_refptr<TabletCopySourceSession>& session) const {
+        TabletCopyErrorPB::Code* app_error) {
   if (PREDICT_FALSE(data_id.has_block_id() && 
data_id.has_wal_segment_seqno())) {
     *app_error = TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST;
     return Status::InvalidArgument(
diff --git a/src/kudu/tserver/tablet_copy_service.h 
b/src/kudu/tserver/tablet_copy_service.h
index 19ac07a58..4882f7926 100644
--- a/src/kudu/tserver/tablet_copy_service.h
+++ b/src/kudu/tserver/tablet_copy_service.h
@@ -20,7 +20,6 @@
 #include <string>
 #include <unordered_map>
 
-#include "kudu/gutil/port.h"
 #include "kudu/gutil/ref_counted.h"
 #include "kudu/tserver/tablet_copy.pb.h"
 #include "kudu/tserver/tablet_copy.service.h"
@@ -63,23 +62,23 @@ class TabletCopyServiceImpl : public TabletCopyServiceIf {
                             google::protobuf::Message* resp,
                             rpc::RpcContext* rpc) override;
 
-  virtual void BeginTabletCopySession(const BeginTabletCopySessionRequestPB* 
req,
-                                           BeginTabletCopySessionResponsePB* 
resp,
-                                           rpc::RpcContext* context) OVERRIDE;
+  void BeginTabletCopySession(const BeginTabletCopySessionRequestPB* req,
+                              BeginTabletCopySessionResponsePB* resp,
+                              rpc::RpcContext* context) override;
 
-  virtual void CheckSessionActive(const CheckTabletCopySessionActiveRequestPB* 
req,
-                                  CheckTabletCopySessionActiveResponsePB* resp,
-                                  rpc::RpcContext* context) OVERRIDE;
+  void CheckSessionActive(const CheckTabletCopySessionActiveRequestPB* req,
+                          CheckTabletCopySessionActiveResponsePB* resp,
+                          rpc::RpcContext* context) override;
 
-  virtual void FetchData(const FetchDataRequestPB* req,
-                         FetchDataResponsePB* resp,
-                         rpc::RpcContext* context) OVERRIDE;
+  void FetchData(const FetchDataRequestPB* req,
+                 FetchDataResponsePB* resp,
+                 rpc::RpcContext* context) override;
 
-  virtual void EndTabletCopySession(const EndTabletCopySessionRequestPB* req,
-                                         EndTabletCopySessionResponsePB* resp,
-                                         rpc::RpcContext* context) OVERRIDE;
+  void EndTabletCopySession(const EndTabletCopySessionRequestPB* req,
+                            EndTabletCopySessionResponsePB* resp,
+                            rpc::RpcContext* context) override;
 
-  virtual void Shutdown() OVERRIDE;
+  void Shutdown() override;
 
  private:
   struct SessionEntry {
@@ -98,9 +97,8 @@ class TabletCopyServiceImpl : public TabletCopyServiceIf {
                              scoped_refptr<TabletCopySourceSession>* session) 
const;
 
   // Validate the data identifier in a FetchData request.
-  Status ValidateFetchRequestDataId(const DataIdPB& data_id,
-                                    TabletCopyErrorPB::Code* app_error,
-                                    const 
scoped_refptr<TabletCopySourceSession>& session) const;
+  static Status ValidateFetchRequestDataId(const DataIdPB& data_id,
+                                           TabletCopyErrorPB::Code* app_error);
 
   // Take note of session activity; Re-update the session timeout deadline.
   void ResetSessionExpirationUnlocked(const std::string& session_id);

Reply via email to