kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpe...@apache.org
Subject [3/3] kudu git commit: tablet copy: Rename TabletCopySession -> TabletCopySourceSession
Date Thu, 24 Nov 2016 18:24:26 GMT
tablet copy: Rename TabletCopySession -> TabletCopySourceSession

This opens the way for a TabletCopyClientSession later.

Change-Id: I123fd339faec3bd53353861adcb501bf8b88764f
Reviewed-on: http://gerrit.cloudera.org:8080/5041
Reviewed-by: Todd Lipcon <todd@apache.org>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/25771c21
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/25771c21
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/25771c21

Branch: refs/heads/master
Commit: 25771c21f694461b6de535f7d1ab0eeedfc62f20
Parents: 60886a3
Author: Mike Percy <mpercy@apache.org>
Authored: Mon Nov 7 13:41:38 2016 +0000
Committer: Mike Percy <mpercy@apache.org>
Committed: Thu Nov 24 18:23:49 2016 +0000

----------------------------------------------------------------------
 src/kudu/tserver/tablet_copy_service.cc      | 14 ++++++------
 src/kudu/tserver/tablet_copy_service.h       |  8 +++----
 src/kudu/tserver/tablet_copy_session-test.cc |  8 +++----
 src/kudu/tserver/tablet_copy_session.cc      | 26 +++++++++++------------
 src/kudu/tserver/tablet_copy_session.h       | 18 +++++++---------
 5 files changed, 36 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/25771c21/src/kudu/tserver/tablet_copy_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.cc b/src/kudu/tserver/tablet_copy_service.cc
index 571f2d6..502fd00 100644
--- a/src/kudu/tserver/tablet_copy_service.cc
+++ b/src/kudu/tserver/tablet_copy_service.cc
@@ -117,7 +117,7 @@ void TabletCopyServiceImpl::BeginTabletCopySession(
                     TabletCopyErrorPB::TABLET_NOT_FOUND,
                     Substitute("Unable to find specified tablet: $0", tablet_id));
 
-  scoped_refptr<TabletCopySession> session;
+  scoped_refptr<TabletCopySourceSession> session;
   {
     MutexLock l(sessions_lock_);
     if (!FindCopy(sessions_, session_id, &session)) {
@@ -125,7 +125,7 @@ void TabletCopyServiceImpl::BeginTabletCopySession(
           "Beginning new tablet copy session on tablet $0 from peer $1"
           " at $2: session id = $3",
           tablet_id, requestor_uuid, context->requestor_string(), session_id);
-      session.reset(new TabletCopySession(tablet_peer, session_id,
+      session.reset(new TabletCopySourceSession(tablet_peer, session_id,
                                                requestor_uuid, fs_manager_));
       RPC_RETURN_NOT_OK(session->Init(),
                         TabletCopyErrorPB::UNKNOWN_ERROR,
@@ -161,7 +161,7 @@ void TabletCopyServiceImpl::CheckSessionActive(
   const string& session_id = req->session_id();
 
   // Look up and validate tablet copy session.
-  scoped_refptr<TabletCopySession> session;
+  scoped_refptr<TabletCopySourceSession> session;
   MutexLock l(sessions_lock_);
   TabletCopyErrorPB::Code app_error;
   Status status = FindSessionUnlocked(session_id, &app_error, &session);
@@ -188,7 +188,7 @@ void TabletCopyServiceImpl::FetchData(const FetchDataRequestPB* req,
   const string& session_id = req->session_id();
 
   // Look up and validate tablet copy session.
-  scoped_refptr<TabletCopySession> session;
+  scoped_refptr<TabletCopySourceSession> session;
   {
     MutexLock l(sessions_lock_);
     TabletCopyErrorPB::Code app_error;
@@ -268,7 +268,7 @@ void TabletCopyServiceImpl::Shutdown() {
 Status TabletCopyServiceImpl::FindSessionUnlocked(
         const string& session_id,
         TabletCopyErrorPB::Code* app_error,
-        scoped_refptr<TabletCopySession>* session) const {
+        scoped_refptr<TabletCopySourceSession>* session) const {
   if (!FindCopy(sessions_, session_id, session)) {
     *app_error = TabletCopyErrorPB::NO_SESSION;
     return Status::NotFound(
@@ -280,7 +280,7 @@ Status TabletCopyServiceImpl::FindSessionUnlocked(
 Status TabletCopyServiceImpl::ValidateFetchRequestDataId(
         const DataIdPB& data_id,
         TabletCopyErrorPB::Code* app_error,
-        const scoped_refptr<TabletCopySession>& session) const {
+        const scoped_refptr<TabletCopySourceSession>& session) const {
   if (PREDICT_FALSE(data_id.has_block_id() && data_id.has_wal_segment_seqno())) {
     *app_error = TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST;
     return Status::InvalidArgument(
@@ -318,7 +318,7 @@ void TabletCopyServiceImpl::ResetSessionExpirationUnlocked(const std::string&
se
 Status TabletCopyServiceImpl::DoEndTabletCopySessionUnlocked(
         const std::string& session_id,
         TabletCopyErrorPB::Code* app_error) {
-  scoped_refptr<TabletCopySession> session;
+  scoped_refptr<TabletCopySourceSession> session;
   RETURN_NOT_OK(FindSessionUnlocked(session_id, app_error, &session));
   // Remove the session from the map.
   // It will get destroyed once there are no outstanding refs.

http://git-wip-us.apache.org/repos/asf/kudu/blob/25771c21/src/kudu/tserver/tablet_copy_service.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_service.h b/src/kudu/tserver/tablet_copy_service.h
index 180dc1b..4e912bd 100644
--- a/src/kudu/tserver/tablet_copy_service.h
+++ b/src/kudu/tserver/tablet_copy_service.h
@@ -39,7 +39,7 @@ class ReadableLogSegment;
 
 namespace tserver {
 
-class TabletCopySession;
+class TabletCopySourceSession;
 class TabletPeerLookupIf;
 
 class TabletCopyServiceImpl : public TabletCopyServiceIf {
@@ -68,18 +68,18 @@ class TabletCopyServiceImpl : public TabletCopyServiceIf {
   virtual void Shutdown() OVERRIDE;
 
  private:
-  typedef std::unordered_map<std::string, scoped_refptr<TabletCopySession> >
SessionMap;
+  typedef std::unordered_map<std::string, scoped_refptr<TabletCopySourceSession>
> SessionMap;
   typedef std::unordered_map<std::string, MonoTime> MonoTimeMap;
 
   // Look up session in session map.
   Status FindSessionUnlocked(const std::string& session_id,
                              TabletCopyErrorPB::Code* app_error,
-                             scoped_refptr<TabletCopySession>* session) const;
+                             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<TabletCopySession>& session)
const;
+                                    const scoped_refptr<TabletCopySourceSession>&
session) const;
 
   // Take note of session activity; Re-update the session timeout deadline.
   void ResetSessionExpirationUnlocked(const std::string& session_id);

http://git-wip-us.apache.org/repos/asf/kudu/blob/25771c21/src/kudu/tserver/tablet_copy_session-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_session-test.cc b/src/kudu/tserver/tablet_copy_session-test.cc
index 3e8e0ff..8b4ec0a 100644
--- a/src/kudu/tserver/tablet_copy_session-test.cc
+++ b/src/kudu/tserver/tablet_copy_session-test.cc
@@ -179,12 +179,12 @@ class TabletCopyTest : public KuduTabletTest {
   }
 
   void InitSession() {
-    session_.reset(new TabletCopySession(tablet_peer_.get(), "TestSession", "FakeUUID",
+    session_.reset(new TabletCopySourceSession(tablet_peer_.get(), "TestSession", "FakeUUID",
                    fs_manager()));
     ASSERT_OK(session_->Init());
   }
 
-  // Read the specified BlockId, via the TabletCopySession, into a file.
+  // Read the specified BlockId, via the TabletCopySourceSession, into a file.
   // 'path' will be populated with the name of the file used.
   // 'file' will be set to point to the SequentialFile containing the data.
   void FetchBlockToFile(const BlockId& block_id,
@@ -213,10 +213,10 @@ class TabletCopyTest : public KuduTabletTest {
   scoped_refptr<LogAnchorRegistry> log_anchor_registry_;
   gscoped_ptr<ThreadPool> apply_pool_;
   scoped_refptr<TabletPeer> tablet_peer_;
-  scoped_refptr<TabletCopySession> session_;
+  scoped_refptr<TabletCopySourceSession> session_;
 };
 
-// Ensure that the serialized SuperBlock included in the TabletCopySession is
+// Ensure that the serialized SuperBlock included in the TabletCopySourceSession is
 // equal to the serialized live superblock (on a quiesced tablet).
 TEST_F(TabletCopyTest, TestSuperBlocksEqual) {
   // Compare content of superblocks.

http://git-wip-us.apache.org/repos/asf/kudu/blob/25771c21/src/kudu/tserver/tablet_copy_session.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_session.cc b/src/kudu/tserver/tablet_copy_session.cc
index 0b601c4..100fbaa 100644
--- a/src/kudu/tserver/tablet_copy_session.cc
+++ b/src/kudu/tserver/tablet_copy_session.cc
@@ -55,7 +55,7 @@ using tablet::TabletMetadata;
 using tablet::TabletPeer;
 using tablet::TabletSuperBlockPB;
 
-TabletCopySession::TabletCopySession(
+TabletCopySourceSession::TabletCopySourceSession(
     const scoped_refptr<TabletPeer>& tablet_peer, std::string session_id,
     std::string requestor_uuid, FsManager* fs_manager)
     : tablet_peer_(tablet_peer),
@@ -65,12 +65,12 @@ TabletCopySession::TabletCopySession(
       blocks_deleter_(&blocks_),
       logs_deleter_(&logs_) {}
 
-TabletCopySession::~TabletCopySession() {
+TabletCopySourceSession::~TabletCopySourceSession() {
   // No lock taken in the destructor, should only be 1 thread with access now.
   CHECK_OK(UnregisterAnchorIfNeededUnlocked());
 }
 
-Status TabletCopySession::Init() {
+Status TabletCopySourceSession::Init() {
   MutexLock l(session_lock_);
   CHECK(!initted_);
 
@@ -146,12 +146,12 @@ Status TabletCopySession::Init() {
   return Status::OK();
 }
 
-const std::string& TabletCopySession::tablet_id() const {
+const std::string& TabletCopySourceSession::tablet_id() const {
   DCHECK(initted_);
   return tablet_peer_->tablet_id();
 }
 
-const std::string& TabletCopySession::requestor_uuid() const {
+const std::string& TabletCopySourceSession::requestor_uuid() const {
   DCHECK(initted_);
   return requestor_uuid_;
 }
@@ -240,7 +240,7 @@ static Status ReadFileChunkToBuf(const Info* info,
   return Status::OK();
 }
 
-Status TabletCopySession::GetBlockPiece(const BlockId& block_id,
+Status TabletCopySourceSession::GetBlockPiece(const BlockId& block_id,
                                              uint64_t offset, int64_t client_maxlen,
                                              string* data, int64_t* block_file_size,
                                              TabletCopyErrorPB::Code* error_code) {
@@ -259,7 +259,7 @@ Status TabletCopySession::GetBlockPiece(const BlockId& block_id,
   return Status::OK();
 }
 
-Status TabletCopySession::GetLogSegmentPiece(uint64_t segment_seqno,
+Status TabletCopySourceSession::GetLogSegmentPiece(uint64_t segment_seqno,
                                                   uint64_t offset, int64_t client_maxlen,
                                                   std::string* data, int64_t* block_file_size,
                                                   TabletCopyErrorPB::Code* error_code) {
@@ -275,7 +275,7 @@ Status TabletCopySession::GetLogSegmentPiece(uint64_t segment_seqno,
   return Status::OK();
 }
 
-bool TabletCopySession::IsBlockOpenForTests(const BlockId& block_id) const {
+bool TabletCopySourceSession::IsBlockOpenForTests(const BlockId& block_id) const {
   MutexLock l(session_lock_);
   return ContainsKey(blocks_, block_id);
 }
@@ -300,7 +300,7 @@ static Status AddImmutableFileToMap(Collection* const cache,
   return Status::OK();
 }
 
-Status TabletCopySession::OpenBlockUnlocked(const BlockId& block_id) {
+Status TabletCopySourceSession::OpenBlockUnlocked(const BlockId& block_id) {
   session_lock_.AssertAcquired();
 
   gscoped_ptr<ReadableBlock> block;
@@ -328,7 +328,7 @@ Status TabletCopySession::OpenBlockUnlocked(const BlockId& block_id)
{
   return s;
 }
 
-Status TabletCopySession::FindBlock(const BlockId& block_id,
+Status TabletCopySourceSession::FindBlock(const BlockId& block_id,
                                          ImmutableReadableBlockInfo** block_info,
                                          TabletCopyErrorPB::Code* error_code) {
   Status s;
@@ -340,7 +340,7 @@ Status TabletCopySession::FindBlock(const BlockId& block_id,
   return s;
 }
 
-Status TabletCopySession::OpenLogSegmentUnlocked(uint64_t segment_seqno) {
+Status TabletCopySourceSession::OpenLogSegmentUnlocked(uint64_t segment_seqno) {
   session_lock_.AssertAcquired();
 
   scoped_refptr<log::ReadableLogSegment> log_segment;
@@ -366,7 +366,7 @@ Status TabletCopySession::OpenLogSegmentUnlocked(uint64_t segment_seqno)
{
   return s;
 }
 
-Status TabletCopySession::FindLogSegment(uint64_t segment_seqno,
+Status TabletCopySourceSession::FindLogSegment(uint64_t segment_seqno,
                                               ImmutableRandomAccessFileInfo** file_info,
                                               TabletCopyErrorPB::Code* error_code) {
   MutexLock l(session_lock_);
@@ -378,7 +378,7 @@ Status TabletCopySession::FindLogSegment(uint64_t segment_seqno,
   return Status::OK();
 }
 
-Status TabletCopySession::UnregisterAnchorIfNeededUnlocked() {
+Status TabletCopySourceSession::UnregisterAnchorIfNeededUnlocked() {
   return tablet_peer_->log_anchor_registry()->UnregisterIfAnchored(&log_anchor_);
 }
 

http://git-wip-us.apache.org/repos/asf/kudu/blob/25771c21/src/kudu/tserver/tablet_copy_session.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/tablet_copy_session.h b/src/kudu/tserver/tablet_copy_session.h
index d05f70a..aaf0043 100644
--- a/src/kudu/tserver/tablet_copy_session.h
+++ b/src/kudu/tserver/tablet_copy_session.h
@@ -14,8 +14,8 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#ifndef KUDU_TSERVER_TABLET_COPY_SESSION_H_
-#define KUDU_TSERVER_TABLET_COPY_SESSION_H_
+
+#pragma once
 
 #include <memory>
 #include <string>
@@ -80,13 +80,13 @@ struct ImmutableReadableBlockInfo {
   }
 };
 
-// A potential Learner must establish a TabletCopySession with the leader in order
+// A potential Learner must establish a TabletCopySourceSession with the leader in order
 // to fetch the needed superblock, blocks, and log segments.
 // This class is refcounted to make it easy to remove it from the session map
 // on expiration while it is in use by another thread.
-class TabletCopySession : public RefCountedThreadSafe<TabletCopySession> {
+class TabletCopySourceSession : public RefCountedThreadSafe<TabletCopySourceSession>
{
  public:
-  TabletCopySession(const scoped_refptr<tablet::TabletPeer>& tablet_peer,
+  TabletCopySourceSession(const scoped_refptr<tablet::TabletPeer>& tablet_peer,
                          std::string session_id, std::string requestor_uuid,
                          FsManager* fs_manager);
 
@@ -142,12 +142,12 @@ class TabletCopySession : public RefCountedThreadSafe<TabletCopySession>
{
   bool IsBlockOpenForTests(const BlockId& block_id) const;
 
  private:
-  friend class RefCountedThreadSafe<TabletCopySession>;
+  friend class RefCountedThreadSafe<TabletCopySourceSession>;
 
   typedef std::unordered_map<BlockId, ImmutableReadableBlockInfo*, BlockIdHash> BlockMap;
   typedef std::unordered_map<uint64_t, ImmutableRandomAccessFileInfo*> LogMap;
 
-  ~TabletCopySession();
+  ~TabletCopySourceSession();
 
   // Open the block and add it to the block map.
   Status OpenBlockUnlocked(const BlockId& block_id);
@@ -190,10 +190,8 @@ class TabletCopySession : public RefCountedThreadSafe<TabletCopySession>
{
 
   log::LogAnchor log_anchor_;
 
-  DISALLOW_COPY_AND_ASSIGN(TabletCopySession);
+  DISALLOW_COPY_AND_ASSIGN(TabletCopySourceSession);
 };
 
 } // namespace tserver
 } // namespace kudu
-
-#endif // KUDU_TSERVER_TABLET_COPY_SESSION_H_


Mime
View raw message