http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/CMakeLists.txt b/src/kudu/tserver/CMakeLists.txt
index 8568fea..a2e34e1 100644
--- a/src/kudu/tserver/CMakeLists.txt
+++ b/src/kudu/tserver/CMakeLists.txt
@@ -20,11 +20,11 @@
#########################################
KRPC_GENERATE(
- REMOTE_BOOTSTRAP_KRPC_SRCS REMOTE_BOOTSTRAP_KRPC_HDRS REMOTE_BOOTSTRAP_KRPC_TGTS
+ TABLET_COPY_KRPC_SRCS TABLET_COPY_KRPC_HDRS TABLET_COPY_KRPC_TGTS
SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..
BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../..
PROTO_FILES remote_bootstrap.proto)
-set(REMOTE_BOOTSTRAP_KRPC_LIBS
+set(TABLET_COPY_KRPC_LIBS
consensus_proto
krpc
protobuf
@@ -32,9 +32,9 @@ set(REMOTE_BOOTSTRAP_KRPC_LIBS
tablet_proto
wire_protocol_proto)
ADD_EXPORTABLE_LIBRARY(remote_bootstrap_proto
- SRCS ${REMOTE_BOOTSTRAP_KRPC_SRCS}
- DEPS ${REMOTE_BOOTSTRAP_KRPC_LIBS}
- NONLINK_DEPS ${REMOTE_BOOTSTRAP_KRPC_TGTS})
+ SRCS ${TABLET_COPY_KRPC_SRCS}
+ DEPS ${TABLET_COPY_KRPC_LIBS}
+ NONLINK_DEPS ${TABLET_COPY_KRPC_TGTS})
#########################################
# tserver_proto
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap-test-base.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap-test-base.h b/src/kudu/tserver/remote_bootstrap-test-base.h
index ef5637f..0f7faa1 100644
--- a/src/kudu/tserver/remote_bootstrap-test-base.h
+++ b/src/kudu/tserver/remote_bootstrap-test-base.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_REMOTE_BOOTSTRAP_TEST_BASE_H_
-#define KUDU_TSERVER_REMOTE_BOOTSTRAP_TEST_BASE_H_
+#ifndef KUDU_TSERVER_TABLET_COPY_TEST_BASE_H_
+#define KUDU_TSERVER_TABLET_COPY_TEST_BASE_H_
#include "kudu/tserver/tablet_server-test-base.h"
@@ -39,7 +39,7 @@ using consensus::MinimumOpId;
// Number of times to roll the log.
static const int kNumLogRolls = 2;
-class RemoteBootstrapTest : public TabletServerTestBase {
+class TabletCopyTest : public TabletServerTestBase {
public:
virtual void SetUp() OVERRIDE {
NO_FATALS(TabletServerTestBase::SetUp());
@@ -47,7 +47,7 @@ class RemoteBootstrapTest : public TabletServerTestBase {
// Prevent logs from being deleted out from under us until / unless we want
// to test that we are anchoring correctly. Since GenerateTestData() does a
// Flush(), Log GC is allowed to eat the logs before we get around to
- // starting a remote bootstrap session.
+ // starting a tablet copy session.
tablet_peer_->log_anchor_registry()->Register(
MinimumOpId().index(), CURRENT_TEST_NAME(), &anchor_);
NO_FATALS(GenerateTestData());
@@ -76,7 +76,7 @@ class RemoteBootstrapTest : public TabletServerTestBase {
}
// Generate the test data for the tablet and do the flushing we assume will be
- // done in the unit tests for remote bootstrap.
+ // done in the unit tests for tablet copy.
void GenerateTestData() {
const int kIncr = 50;
LOG_TIMING(INFO, "Loading test data") {
@@ -123,4 +123,4 @@ class RemoteBootstrapTest : public TabletServerTestBase {
} // namespace tserver
} // namespace kudu
-#endif // KUDU_TSERVER_REMOTE_BOOTSTRAP_TEST_BASE_H_
+#endif // KUDU_TSERVER_TABLET_COPY_TEST_BASE_H_
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap.proto
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap.proto b/src/kudu/tserver/remote_bootstrap.proto
index 225f3a5..1e89919 100644
--- a/src/kudu/tserver/remote_bootstrap.proto
+++ b/src/kudu/tserver/remote_bootstrap.proto
@@ -24,29 +24,29 @@ import "kudu/fs/fs.proto";
import "kudu/rpc/rpc_header.proto";
import "kudu/tablet/metadata.proto";
-// RaftConfig remote bootstrap RPC calls.
-service RemoteBootstrapService {
- // Establish a remote bootstrap session.
- rpc BeginRemoteBootstrapSession(BeginRemoteBootstrapSessionRequestPB)
- returns (BeginRemoteBootstrapSessionResponsePB);
+// RaftConfig tablet copy RPC calls.
+service TabletCopyService {
+ // Establish a tablet copy session.
+ rpc BeginTabletCopySession(BeginTabletCopySessionRequestPB)
+ returns (BeginTabletCopySessionResponsePB);
// Check whether the specified session is active.
- rpc CheckSessionActive(CheckRemoteBootstrapSessionActiveRequestPB)
- returns (CheckRemoteBootstrapSessionActiveResponsePB);
+ rpc CheckSessionActive(CheckTabletCopySessionActiveRequestPB)
+ returns (CheckTabletCopySessionActiveResponsePB);
// Fetch data (blocks, logs) from the server.
rpc FetchData(FetchDataRequestPB)
returns (FetchDataResponsePB);
- // End a remote bootstrap session, allow server to release resources.
- rpc EndRemoteBootstrapSession(EndRemoteBootstrapSessionRequestPB)
- returns (EndRemoteBootstrapSessionResponsePB);
+ // End a tablet copy session, allow server to release resources.
+ rpc EndTabletCopySession(EndTabletCopySessionRequestPB)
+ returns (EndTabletCopySessionResponsePB);
}
-// Remote bootstrap-specific errors use this protobuf.
-message RemoteBootstrapErrorPB {
+// Tablet Copy-specific errors use this protobuf.
+message TabletCopyErrorPB {
extend kudu.rpc.ErrorStatusPB {
- optional RemoteBootstrapErrorPB remote_bootstrap_error_ext = 102;
+ optional TabletCopyErrorPB tablet_copy_error_ext = 102;
}
enum Code {
@@ -57,7 +57,7 @@ message RemoteBootstrapErrorPB {
// able to easily parse the error.
UNKNOWN_ERROR = 1;
- // The specified remote bootstrap session either never existed or has expired.
+ // The specified tablet copy session either never existed or has expired.
NO_SESSION = 2;
// Unknown tablet.
@@ -70,7 +70,7 @@ message RemoteBootstrapErrorPB {
WAL_SEGMENT_NOT_FOUND = 5;
// Invalid request. Possibly missing parameters.
- INVALID_REMOTE_BOOTSTRAP_REQUEST = 6;
+ INVALID_TABLET_COPY_REQUEST = 6;
// Error reading or transferring data.
IO_ERROR = 7;
@@ -85,7 +85,7 @@ message RemoteBootstrapErrorPB {
required AppStatusPB status = 2;
}
-message BeginRemoteBootstrapSessionRequestPB {
+message BeginTabletCopySessionRequestPB {
// permanent_uuid of the requesting peer.
required bytes requestor_uuid = 1;
@@ -93,7 +93,7 @@ message BeginRemoteBootstrapSessionRequestPB {
required bytes tablet_id = 2;
}
-message BeginRemoteBootstrapSessionResponsePB {
+message BeginTabletCopySessionResponsePB {
// Opaque session id assigned by the server.
// No guarantees are made as to the format of the session id.
required bytes session_id = 1;
@@ -111,23 +111,23 @@ message BeginRemoteBootstrapSessionResponsePB {
repeated uint64 wal_segment_seqnos = 4;
// A snapshot of the committed Consensus state at the time that the
- // remote bootstrap session was started.
+ // tablet copy session was started.
required consensus.ConsensusStatePB initial_committed_cstate = 5;
// permanent_uuid of the responding peer.
optional bytes responder_uuid = 6;
}
-message CheckRemoteBootstrapSessionActiveRequestPB {
- // Valid Session ID returned by a BeginRemoteBootstrapSession() RPC call.
+message CheckTabletCopySessionActiveRequestPB {
+ // Valid Session ID returned by a BeginTabletCopySession() RPC call.
required bytes session_id = 1;
// Set keepalive to true to reset the session timeout timer.
optional bool keepalive = 2 [default = false];
}
-message CheckRemoteBootstrapSessionActiveResponsePB {
- // Whether the given session id represents an active remote bootstrap session.
+message CheckTabletCopySessionActiveResponsePB {
+ // Whether the given session id represents an active tablet copy session.
required bool session_is_active = 1;
}
@@ -149,7 +149,7 @@ message DataIdPB {
}
message FetchDataRequestPB {
- // Valid Session ID returned by a BeginRemoteBootstrapSession() RPC call.
+ // Valid Session ID returned by a BeginTabletCopySession() RPC call.
required bytes session_id = 1;
// The server will use this ID to determine the key and type of data
@@ -189,16 +189,16 @@ message FetchDataResponsePB {
required DataChunkPB chunk = 1;
}
-message EndRemoteBootstrapSessionRequestPB {
+message EndTabletCopySessionRequestPB {
required bytes session_id = 1;
// Set to true if bootstrap is successful.
required bool is_success = 2;
// Client-provided error message. The server will log this error so that an
- // admin can identify when bad things are happening with remote bootstrap.
+ // admin can identify when bad things are happening with tablet copy.
optional AppStatusPB error = 3;
}
-message EndRemoteBootstrapSessionResponsePB {
+message EndTabletCopySessionResponsePB {
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_client-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_client-test.cc b/src/kudu/tserver/remote_bootstrap_client-test.cc
index 101faa7..d1bfc16 100644
--- a/src/kudu/tserver/remote_bootstrap_client-test.cc
+++ b/src/kudu/tserver/remote_bootstrap_client-test.cc
@@ -32,10 +32,10 @@ using consensus::RaftPeerPB;
using tablet::TabletMetadata;
using tablet::TabletStatusListener;
-class RemoteBootstrapClientTest : public RemoteBootstrapTest {
+class TabletCopyClientTest : public TabletCopyTest {
public:
virtual void SetUp() OVERRIDE {
- NO_FATALS(RemoteBootstrapTest::SetUp());
+ NO_FATALS(TabletCopyTest::SetUp());
fs_manager_.reset(new FsManager(Env::Default(), GetTestPath("client_tablet")));
ASSERT_OK(fs_manager_->CreateInitialFileSystemLayout());
@@ -43,7 +43,7 @@ class RemoteBootstrapClientTest : public RemoteBootstrapTest {
tablet_peer_->WaitUntilConsensusRunning(MonoDelta::FromSeconds(10.0));
rpc::MessengerBuilder(CURRENT_TEST_NAME()).Build(&messenger_);
- client_.reset(new RemoteBootstrapClient(GetTabletId(),
+ client_.reset(new TabletCopyClient(GetTabletId(),
fs_manager_.get(),
messenger_));
ASSERT_OK(GetRaftConfigLeader(tablet_peer_->consensus()
@@ -59,12 +59,12 @@ class RemoteBootstrapClientTest : public RemoteBootstrapTest {
gscoped_ptr<FsManager> fs_manager_;
shared_ptr<rpc::Messenger> messenger_;
- gscoped_ptr<RemoteBootstrapClient> client_;
+ gscoped_ptr<TabletCopyClient> client_;
scoped_refptr<TabletMetadata> meta_;
RaftPeerPB leader_;
};
-Status RemoteBootstrapClientTest::CompareFileContents(const string& path1, const string& path2) {
+Status TabletCopyClientTest::CompareFileContents(const string& path1, const string& path2) {
shared_ptr<RandomAccessFile> file1, file2;
RETURN_NOT_OK(env_util::OpenFileForRandom(fs_manager_->env(), path1, &file1));
RETURN_NOT_OK(env_util::OpenFileForRandom(fs_manager_->env(), path2, &file2));
@@ -90,15 +90,15 @@ Status RemoteBootstrapClientTest::CompareFileContents(const string& path1, const
return Status::OK();
}
-// Basic begin / end remote bootstrap session.
-TEST_F(RemoteBootstrapClientTest, TestBeginEndSession) {
+// Basic begin / end tablet copy session.
+TEST_F(TabletCopyClientTest, TestBeginEndSession) {
TabletStatusListener listener(meta_);
ASSERT_OK(client_->FetchAll(&listener));
ASSERT_OK(client_->Finish());
}
// Basic data block download unit test.
-TEST_F(RemoteBootstrapClientTest, TestDownloadBlock) {
+TEST_F(TabletCopyClientTest, TestDownloadBlock) {
TabletStatusListener listener(meta_);
BlockId block_id = FirstColumnBlockId(*client_->superblock_);
Slice slice;
@@ -120,7 +120,7 @@ TEST_F(RemoteBootstrapClientTest, TestDownloadBlock) {
}
// Basic WAL segment download unit test.
-TEST_F(RemoteBootstrapClientTest, TestDownloadWalSegment) {
+TEST_F(TabletCopyClientTest, TestDownloadWalSegment) {
ASSERT_OK(fs_manager_->CreateDirIfMissing(fs_manager_->GetTabletWalDir(GetTabletId())));
uint64_t seqno = client_->wal_seqnos_[0];
@@ -140,7 +140,7 @@ TEST_F(RemoteBootstrapClientTest, TestDownloadWalSegment) {
}
// Ensure that we detect data corruption at the per-transfer level.
-TEST_F(RemoteBootstrapClientTest, TestVerifyData) {
+TEST_F(TabletCopyClientTest, TestVerifyData) {
string good = "This is a known good string";
string bad = "This is a known bad! string";
const int kGoodOffset = 0;
@@ -204,7 +204,7 @@ vector<BlockId> GetAllSortedBlocks(const tablet::TabletSuperBlockPB& sb) {
} // anonymous namespace
-TEST_F(RemoteBootstrapClientTest, TestDownloadAllBlocks) {
+TEST_F(TabletCopyClientTest, TestDownloadAllBlocks) {
// Download all the blocks.
ASSERT_OK(client_->DownloadBlocks());
@@ -224,7 +224,7 @@ TEST_F(RemoteBootstrapClientTest, TestDownloadAllBlocks) {
// Verify that the old blocks aren't found. We're using a different
// FsManager than 'tablet_peer', so the only way an old block could end
- // up in ours is due to a remote bootstrap client bug.
+ // up in ours is due to a tablet copy client bug.
for (const BlockId& block_id : old_data_blocks) {
gscoped_ptr<fs::ReadableBlock> block;
Status s = fs_manager_->OpenBlock(block_id, &block);
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_client.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_client.cc b/src/kudu/tserver/remote_bootstrap_client.cc
index 3eba8db..85b3942 100644
--- a/src/kudu/tserver/remote_bootstrap_client.cc
+++ b/src/kudu/tserver/remote_bootstrap_client.cc
@@ -44,24 +44,24 @@
#include "kudu/util/logging.h"
#include "kudu/util/net/net_util.h"
-DEFINE_int32(remote_bootstrap_begin_session_timeout_ms, 3000,
- "Tablet server RPC client timeout for BeginRemoteBootstrapSession calls. "
- "Also used for EndRemoteBootstrapSession calls.");
-TAG_FLAG(remote_bootstrap_begin_session_timeout_ms, hidden);
+DEFINE_int32(tablet_copy_begin_session_timeout_ms, 3000,
+ "Tablet server RPC client timeout for BeginTabletCopySession calls. "
+ "Also used for EndTabletCopySession calls.");
+TAG_FLAG(tablet_copy_begin_session_timeout_ms, hidden);
-DEFINE_bool(remote_bootstrap_save_downloaded_metadata, false,
- "Save copies of the downloaded remote bootstrap files for debugging purposes. "
+DEFINE_bool(tablet_copy_save_downloaded_metadata, false,
+ "Save copies of the downloaded tablet copy files for debugging purposes. "
"Note: This is only intended for debugging and should not be normally used!");
-TAG_FLAG(remote_bootstrap_save_downloaded_metadata, advanced);
-TAG_FLAG(remote_bootstrap_save_downloaded_metadata, hidden);
-TAG_FLAG(remote_bootstrap_save_downloaded_metadata, runtime);
+TAG_FLAG(tablet_copy_save_downloaded_metadata, advanced);
+TAG_FLAG(tablet_copy_save_downloaded_metadata, hidden);
+TAG_FLAG(tablet_copy_save_downloaded_metadata, runtime);
-DEFINE_int32(remote_bootstrap_dowload_file_inject_latency_ms, 0,
- "Injects latency into the loop that downloads files, causing remote bootstrap "
+DEFINE_int32(tablet_copy_dowload_file_inject_latency_ms, 0,
+ "Injects latency into the loop that downloads files, causing tablet copy "
"to take much longer. For use in tests only.");
-TAG_FLAG(remote_bootstrap_dowload_file_inject_latency_ms, hidden);
+TAG_FLAG(tablet_copy_dowload_file_inject_latency_ms, hidden);
-DECLARE_int32(remote_bootstrap_transfer_chunk_size_bytes);
+DECLARE_int32(tablet_copy_transfer_chunk_size_bytes);
// RETURN_NOT_OK_PREPEND() with a remote-error unwinding step.
#define RETURN_NOT_OK_UNWIND_PREPEND(status, controller, msg) \
@@ -91,7 +91,7 @@ using tablet::TabletMetadata;
using tablet::TabletStatusListener;
using tablet::TabletSuperBlockPB;
-RemoteBootstrapClient::RemoteBootstrapClient(std::string tablet_id,
+TabletCopyClient::TabletCopyClient(std::string tablet_id,
FsManager* fs_manager,
shared_ptr<Messenger> messenger)
: tablet_id_(std::move(tablet_id)),
@@ -105,12 +105,12 @@ RemoteBootstrapClient::RemoteBootstrapClient(std::string tablet_id,
session_idle_timeout_millis_(0),
start_time_micros_(0) {}
-RemoteBootstrapClient::~RemoteBootstrapClient() {
- // Note: Ending the remote bootstrap session releases anchors on the remote.
- WARN_NOT_OK(EndRemoteSession(), "Unable to close remote bootstrap session");
+TabletCopyClient::~TabletCopyClient() {
+ // Note: Ending the tablet copy session releases anchors on the remote.
+ WARN_NOT_OK(EndRemoteSession(), "Unable to close tablet copy session");
}
-Status RemoteBootstrapClient::SetTabletToReplace(const scoped_refptr<TabletMetadata>& meta,
+Status TabletCopyClient::SetTabletToReplace(const scoped_refptr<TabletMetadata>& meta,
int64_t caller_term) {
CHECK_EQ(tablet_id_, meta->tablet_id());
TabletDataState data_state = meta->tablet_data_state();
@@ -128,7 +128,7 @@ Status RemoteBootstrapClient::SetTabletToReplace(const scoped_refptr<TabletMetad
if (last_logged_term > caller_term) {
return Status::InvalidArgument(
Substitute("Leader has term $0 but the last log entry written by the tombstoned replica "
- "for tablet $1 has higher term $2. Refusing remote bootstrap from leader",
+ "for tablet $1 has higher term $2. Refusing tablet copy from leader",
caller_term, tablet_id_, last_logged_term));
}
@@ -138,7 +138,7 @@ Status RemoteBootstrapClient::SetTabletToReplace(const scoped_refptr<TabletMetad
fs_manager_->uuid(), &cmeta);
if (s.IsNotFound()) {
// The consensus metadata was not written to disk, possibly due to a failed
- // remote bootstrap.
+ // tablet copy.
return Status::OK();
}
RETURN_NOT_OK(s);
@@ -146,7 +146,7 @@ Status RemoteBootstrapClient::SetTabletToReplace(const scoped_refptr<TabletMetad
return Status::OK();
}
-Status RemoteBootstrapClient::Start(const HostPort& bootstrap_source_addr,
+Status TabletCopyClient::Start(const HostPort& bootstrap_source_addr,
scoped_refptr<TabletMetadata>* meta) {
CHECK(!started_);
start_time_micros_ = GetCurrentTimeMicros();
@@ -154,34 +154,34 @@ Status RemoteBootstrapClient::Start(const HostPort& bootstrap_source_addr,
Sockaddr addr;
RETURN_NOT_OK(SockaddrFromHostPort(bootstrap_source_addr, &addr));
if (addr.IsWildcard()) {
- return Status::InvalidArgument("Invalid wildcard address to remote bootstrap from",
+ return Status::InvalidArgument("Invalid wildcard address to tablet copy from",
Substitute("$0 (resolved to $1)",
bootstrap_source_addr.host(), addr.host()));
}
- LOG_WITH_PREFIX(INFO) << "Beginning remote bootstrap session"
+ LOG_WITH_PREFIX(INFO) << "Beginning tablet copy session"
<< " from remote peer at address " << bootstrap_source_addr.ToString();
- // Set up an RPC proxy for the RemoteBootstrapService.
- proxy_.reset(new RemoteBootstrapServiceProxy(messenger_, addr));
+ // Set up an RPC proxy for the TabletCopyService.
+ proxy_.reset(new TabletCopyServiceProxy(messenger_, addr));
- BeginRemoteBootstrapSessionRequestPB req;
+ BeginTabletCopySessionRequestPB req;
req.set_requestor_uuid(fs_manager_->uuid());
req.set_tablet_id(tablet_id_);
rpc::RpcController controller;
controller.set_timeout(MonoDelta::FromMilliseconds(
- FLAGS_remote_bootstrap_begin_session_timeout_ms));
+ FLAGS_tablet_copy_begin_session_timeout_ms));
- // Begin the remote bootstrap session with the remote peer.
- BeginRemoteBootstrapSessionResponsePB resp;
- RETURN_NOT_OK_UNWIND_PREPEND(proxy_->BeginRemoteBootstrapSession(req, &resp, &controller),
+ // Begin the tablet copy session with the remote peer.
+ BeginTabletCopySessionResponsePB resp;
+ RETURN_NOT_OK_UNWIND_PREPEND(proxy_->BeginTabletCopySession(req, &resp, &controller),
controller,
- "Unable to begin remote bootstrap session");
+ "Unable to begin tablet copy session");
string bootstrap_peer_uuid = resp.has_responder_uuid()
? resp.responder_uuid() : "(unknown uuid)";
if (resp.superblock().tablet_data_state() != tablet::TABLET_DATA_READY) {
Status s = Status::IllegalState("Remote peer (" + bootstrap_peer_uuid + ")" +
- " is currently remotely bootstrapping itself!",
+ " is currently copying itself!",
resp.superblock().ShortDebugString());
LOG_WITH_PREFIX(WARNING) << s.ToString();
return s;
@@ -209,7 +209,7 @@ Status RemoteBootstrapClient::Start(const HostPort& bootstrap_source_addr,
return Status::InvalidArgument(
Substitute("Tablet $0: Bootstrap source has term $1 but "
"tombstoned replica has last-logged opid with higher term $2. "
- "Refusing remote bootstrap from source peer $3",
+ "Refusing tablet copy from source peer $3",
tablet_id_,
remote_committed_cstate_->current_term(),
last_logged_term,
@@ -218,7 +218,7 @@ Status RemoteBootstrapClient::Start(const HostPort& bootstrap_source_addr,
// This will flush to disk, but we set the data state to COPYING above.
RETURN_NOT_OK_PREPEND(meta_->ReplaceSuperBlock(*superblock_),
- "Remote bootstrap unable to replace superblock on tablet " +
+ "Tablet Copy unable to replace superblock on tablet " +
tablet_id_);
} else {
@@ -246,7 +246,7 @@ Status RemoteBootstrapClient::Start(const HostPort& bootstrap_source_addr,
return Status::OK();
}
-Status RemoteBootstrapClient::FetchAll(TabletStatusListener* status_listener) {
+Status TabletCopyClient::FetchAll(TabletStatusListener* status_listener) {
CHECK(started_);
status_listener_ = status_listener;
@@ -257,7 +257,7 @@ Status RemoteBootstrapClient::FetchAll(TabletStatusListener* status_listener) {
return Status::OK();
}
-Status RemoteBootstrapClient::Finish() {
+Status TabletCopyClient::Finish() {
CHECK(meta_);
CHECK(started_);
CHECK(downloaded_wal_);
@@ -268,12 +268,12 @@ Status RemoteBootstrapClient::Finish() {
// Replace tablet metadata superblock. This will set the tablet metadata state
// to TABLET_DATA_READY, since we checked above that the response
// superblock is in a valid state to bootstrap from.
- LOG_WITH_PREFIX(INFO) << "Remote bootstrap complete. Replacing tablet superblock.";
+ LOG_WITH_PREFIX(INFO) << "Tablet Copy complete. Replacing tablet superblock.";
UpdateStatusMessage("Replacing tablet superblock");
new_superblock_->set_tablet_data_state(tablet::TABLET_DATA_READY);
RETURN_NOT_OK(meta_->ReplaceSuperBlock(*new_superblock_));
- if (FLAGS_remote_bootstrap_save_downloaded_metadata) {
+ if (FLAGS_tablet_copy_save_downloaded_metadata) {
string meta_path = fs_manager_->GetTabletMetadataPath(tablet_id_);
string meta_copy_path = Substitute("$0.copy.$1.tmp", meta_path, start_time_micros_);
RETURN_NOT_OK_PREPEND(CopyFile(Env::Default(), meta_path, meta_copy_path,
@@ -285,20 +285,20 @@ Status RemoteBootstrapClient::Finish() {
}
// Decode the remote error into a human-readable Status object.
-Status RemoteBootstrapClient::ExtractRemoteError(const rpc::ErrorStatusPB& remote_error) {
- if (PREDICT_TRUE(remote_error.HasExtension(RemoteBootstrapErrorPB::remote_bootstrap_error_ext))) {
- const RemoteBootstrapErrorPB& error =
- remote_error.GetExtension(RemoteBootstrapErrorPB::remote_bootstrap_error_ext);
+Status TabletCopyClient::ExtractRemoteError(const rpc::ErrorStatusPB& remote_error) {
+ if (PREDICT_TRUE(remote_error.HasExtension(TabletCopyErrorPB::tablet_copy_error_ext))) {
+ const TabletCopyErrorPB& error =
+ remote_error.GetExtension(TabletCopyErrorPB::tablet_copy_error_ext);
return StatusFromPB(error.status()).CloneAndPrepend("Received error code " +
- RemoteBootstrapErrorPB::Code_Name(error.code()) + " from remote service");
+ TabletCopyErrorPB::Code_Name(error.code()) + " from remote service");
} else {
- return Status::InvalidArgument("Unable to decode remote bootstrap RPC error message",
+ return Status::InvalidArgument("Unable to decode tablet copy RPC error message",
remote_error.ShortDebugString());
}
}
// Enhance a RemoteError Status message with additional details from the remote.
-Status RemoteBootstrapClient::UnwindRemoteError(const Status& status,
+Status TabletCopyClient::UnwindRemoteError(const Status& status,
const rpc::RpcController& controller) {
if (!status.IsRemoteError()) {
return status;
@@ -307,33 +307,33 @@ Status RemoteBootstrapClient::UnwindRemoteError(const Status& status,
return status.CloneAndAppend(extension_status.ToString());
}
-void RemoteBootstrapClient::UpdateStatusMessage(const string& message) {
+void TabletCopyClient::UpdateStatusMessage(const string& message) {
if (status_listener_ != nullptr) {
- status_listener_->StatusMessage("RemoteBootstrap: " + message);
+ status_listener_->StatusMessage("TabletCopy: " + message);
}
}
-Status RemoteBootstrapClient::EndRemoteSession() {
+Status TabletCopyClient::EndRemoteSession() {
if (!started_) {
return Status::OK();
}
rpc::RpcController controller;
controller.set_timeout(MonoDelta::FromMilliseconds(
- FLAGS_remote_bootstrap_begin_session_timeout_ms));
+ FLAGS_tablet_copy_begin_session_timeout_ms));
- EndRemoteBootstrapSessionRequestPB req;
+ EndTabletCopySessionRequestPB req;
req.set_session_id(session_id_);
req.set_is_success(true);
- EndRemoteBootstrapSessionResponsePB resp;
- RETURN_NOT_OK_UNWIND_PREPEND(proxy_->EndRemoteBootstrapSession(req, &resp, &controller),
+ EndTabletCopySessionResponsePB resp;
+ RETURN_NOT_OK_UNWIND_PREPEND(proxy_->EndTabletCopySession(req, &resp, &controller),
controller,
- "Failure ending remote bootstrap session");
+ "Failure ending tablet copy session");
return Status::OK();
}
-Status RemoteBootstrapClient::DownloadWALs() {
+Status TabletCopyClient::DownloadWALs() {
CHECK(started_);
// Delete and recreate WAL dir if it already exists, to ensure stray files are
@@ -360,7 +360,7 @@ Status RemoteBootstrapClient::DownloadWALs() {
return Status::OK();
}
-Status RemoteBootstrapClient::DownloadBlocks() {
+Status TabletCopyClient::DownloadBlocks() {
CHECK(started_);
// Count up the total number of blocks to download.
@@ -415,7 +415,7 @@ Status RemoteBootstrapClient::DownloadBlocks() {
return Status::OK();
}
-Status RemoteBootstrapClient::DownloadWAL(uint64_t wal_segment_seqno) {
+Status TabletCopyClient::DownloadWAL(uint64_t wal_segment_seqno) {
VLOG_WITH_PREFIX(1) << "Downloading WAL segment with seqno " << wal_segment_seqno;
DataIdPB data_id;
data_id.set_type(DataIdPB::LOG_SEGMENT);
@@ -433,7 +433,7 @@ Status RemoteBootstrapClient::DownloadWAL(uint64_t wal_segment_seqno) {
return Status::OK();
}
-Status RemoteBootstrapClient::WriteConsensusMetadata() {
+Status TabletCopyClient::WriteConsensusMetadata() {
// If we didn't find a previous consensus meta file, create one.
if (!cmeta_) {
gscoped_ptr<ConsensusMetadata> cmeta;
@@ -444,11 +444,11 @@ Status RemoteBootstrapClient::WriteConsensusMetadata() {
}
// Otherwise, update the consensus metadata to reflect the config and term
- // sent by the remote bootstrap source.
+ // sent by the tablet copy source.
cmeta_->MergeCommittedConsensusStatePB(*remote_committed_cstate_);
RETURN_NOT_OK(cmeta_->Flush());
- if (FLAGS_remote_bootstrap_save_downloaded_metadata) {
+ if (FLAGS_tablet_copy_save_downloaded_metadata) {
string cmeta_path = fs_manager_->GetConsensusMetadataPath(tablet_id_);
string cmeta_copy_path = Substitute("$0.copy.$1.tmp", cmeta_path, start_time_micros_);
RETURN_NOT_OK_PREPEND(CopyFile(Env::Default(), cmeta_path, cmeta_copy_path,
@@ -459,7 +459,7 @@ Status RemoteBootstrapClient::WriteConsensusMetadata() {
return Status::OK();
}
-Status RemoteBootstrapClient::DownloadAndRewriteBlock(BlockIdPB* block_id,
+Status TabletCopyClient::DownloadAndRewriteBlock(BlockIdPB* block_id,
int* block_count, int num_blocks) {
BlockId old_block_id(BlockId::FromPB(*block_id));
UpdateStatusMessage(Substitute("Downloading block $0 ($1/$2)",
@@ -474,7 +474,7 @@ Status RemoteBootstrapClient::DownloadAndRewriteBlock(BlockIdPB* block_id,
return Status::OK();
}
-Status RemoteBootstrapClient::DownloadBlock(const BlockId& old_block_id,
+Status TabletCopyClient::DownloadBlock(const BlockId& old_block_id,
BlockId* new_block_id) {
VLOG_WITH_PREFIX(1) << "Downloading block with block_id " << old_block_id.ToString();
@@ -495,7 +495,7 @@ Status RemoteBootstrapClient::DownloadBlock(const BlockId& old_block_id,
}
template<class Appendable>
-Status RemoteBootstrapClient::DownloadFile(const DataIdPB& data_id,
+Status TabletCopyClient::DownloadFile(const DataIdPB& data_id,
Appendable* appendable) {
uint64_t offset = 0;
rpc::RpcController controller;
@@ -508,7 +508,7 @@ Status RemoteBootstrapClient::DownloadFile(const DataIdPB& data_id,
req.set_session_id(session_id_);
req.mutable_data_id()->CopyFrom(data_id);
req.set_offset(offset);
- req.set_max_length(FLAGS_remote_bootstrap_transfer_chunk_size_bytes);
+ req.set_max_length(FLAGS_tablet_copy_transfer_chunk_size_bytes);
FetchDataResponsePB resp;
RETURN_NOT_OK_UNWIND_PREPEND(proxy_->FetchData(req, &resp, &controller),
@@ -522,10 +522,10 @@ Status RemoteBootstrapClient::DownloadFile(const DataIdPB& data_id,
// Write the data.
RETURN_NOT_OK(appendable->Append(resp.chunk().data()));
- if (PREDICT_FALSE(FLAGS_remote_bootstrap_dowload_file_inject_latency_ms > 0)) {
+ if (PREDICT_FALSE(FLAGS_tablet_copy_dowload_file_inject_latency_ms > 0)) {
LOG_WITH_PREFIX(INFO) << "Injecting latency into file download: " <<
- FLAGS_remote_bootstrap_dowload_file_inject_latency_ms;
- SleepFor(MonoDelta::FromMilliseconds(FLAGS_remote_bootstrap_dowload_file_inject_latency_ms));
+ FLAGS_tablet_copy_dowload_file_inject_latency_ms;
+ SleepFor(MonoDelta::FromMilliseconds(FLAGS_tablet_copy_dowload_file_inject_latency_ms));
}
if (offset + resp.chunk().data().size() == resp.chunk().total_data_length()) {
@@ -537,7 +537,7 @@ Status RemoteBootstrapClient::DownloadFile(const DataIdPB& data_id,
return Status::OK();
}
-Status RemoteBootstrapClient::VerifyData(uint64_t offset, const DataChunkPB& chunk) {
+Status TabletCopyClient::VerifyData(uint64_t offset, const DataChunkPB& chunk) {
// Verify the offset is what we expected.
if (offset != chunk.offset()) {
return Status::InvalidArgument("Offset did not match what was asked for",
@@ -554,8 +554,8 @@ Status RemoteBootstrapClient::VerifyData(uint64_t offset, const DataChunkPB& chu
return Status::OK();
}
-string RemoteBootstrapClient::LogPrefix() {
- return Substitute("T $0 P $1: Remote bootstrap client: ",
+string TabletCopyClient::LogPrefix() {
+ return Substitute("T $0 P $1: Tablet Copy client: ",
tablet_id_, fs_manager_->uuid());
}
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_client.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_client.h b/src/kudu/tserver/remote_bootstrap_client.h
index e461ec9..e475ef1 100644
--- a/src/kudu/tserver/remote_bootstrap_client.h
+++ b/src/kudu/tserver/remote_bootstrap_client.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_REMOTE_BOOTSTRAP_CLIENT_H
-#define KUDU_TSERVER_REMOTE_BOOTSTRAP_CLIENT_H
+#ifndef KUDU_TSERVER_TABLET_COPY_CLIENT_H
+#define KUDU_TSERVER_TABLET_COPY_CLIENT_H
#include <string>
#include <memory>
@@ -58,25 +58,25 @@ class TabletSuperBlockPB;
namespace tserver {
class DataIdPB;
class DataChunkPB;
-class RemoteBootstrapServiceProxy;
+class TabletCopyServiceProxy;
-// Client class for using remote bootstrap to copy a tablet from another host.
+// Client class for using tablet copy to copy a tablet from another host.
// This class is not thread-safe.
//
// TODO:
// * Parallelize download of blocks and WAL segments.
//
-class RemoteBootstrapClient {
+class TabletCopyClient {
public:
- // Construct the remote bootstrap client.
+ // Construct the tablet copy client.
// 'fs_manager' and 'messenger' must remain valid until this object is destroyed.
- RemoteBootstrapClient(std::string tablet_id, FsManager* fs_manager,
+ TabletCopyClient(std::string tablet_id, FsManager* fs_manager,
std::shared_ptr<rpc::Messenger> messenger);
// Attempt to clean up resources on the remote end by sending an
- // EndRemoteBootstrapSession() RPC
- ~RemoteBootstrapClient();
+ // EndTabletCopySession() RPC
+ ~TabletCopyClient();
// Pass in the existing metadata for a tombstoned tablet, which will be
// replaced if validation checks pass in Start().
@@ -89,15 +89,15 @@ class RemoteBootstrapClient {
Status SetTabletToReplace(const scoped_refptr<tablet::TabletMetadata>& meta,
int64_t caller_term);
- // Start up a remote bootstrap session to bootstrap from the specified
- // bootstrap peer. Place a new superblock indicating that remote bootstrap is
+ // Start up a tablet copy session to bootstrap from the specified
+ // bootstrap peer. Place a new superblock indicating that tablet copy is
// in progress. If the 'metadata' pointer is passed as NULL, it is ignored,
// otherwise the TabletMetadata object resulting from the initial remote
// bootstrap response is returned.
Status Start(const HostPort& bootstrap_source_addr,
scoped_refptr<tablet::TabletMetadata>* metadata);
- // Runs a "full" remote bootstrap, copying the physical layout of a tablet
+ // Runs a "full" tablet copy, copying the physical layout of a tablet
// from the leader of the specified consensus configuration.
Status FetchAll(tablet::TabletStatusListener* status_listener);
@@ -106,23 +106,23 @@ class RemoteBootstrapClient {
Status Finish();
private:
- FRIEND_TEST(RemoteBootstrapClientTest, TestBeginEndSession);
- FRIEND_TEST(RemoteBootstrapClientTest, TestDownloadBlock);
- FRIEND_TEST(RemoteBootstrapClientTest, TestVerifyData);
- FRIEND_TEST(RemoteBootstrapClientTest, TestDownloadWalSegment);
- FRIEND_TEST(RemoteBootstrapClientTest, TestDownloadAllBlocks);
+ FRIEND_TEST(TabletCopyClientTest, TestBeginEndSession);
+ FRIEND_TEST(TabletCopyClientTest, TestDownloadBlock);
+ FRIEND_TEST(TabletCopyClientTest, TestVerifyData);
+ FRIEND_TEST(TabletCopyClientTest, TestDownloadWalSegment);
+ FRIEND_TEST(TabletCopyClientTest, TestDownloadAllBlocks);
// Extract the embedded Status message from the given ErrorStatusPB.
- // The given ErrorStatusPB must extend RemoteBootstrapErrorPB.
+ // The given ErrorStatusPB must extend TabletCopyErrorPB.
static Status ExtractRemoteError(const rpc::ErrorStatusPB& remote_error);
static Status UnwindRemoteError(const Status& status, const rpc::RpcController& controller);
// Update the bootstrap StatusListener with a message.
- // The string "RemoteBootstrap: " will be prepended to each message.
+ // The string "TabletCopy: " will be prepended to each message.
void UpdateStatusMessage(const std::string& message);
- // End the remote bootstrap session.
+ // End the tablet copy session.
Status EndRemoteSession();
// Download all WAL files sequentially.
@@ -134,7 +134,7 @@ class RemoteBootstrapClient {
Status DownloadWAL(uint64_t wal_segment_seqno);
// Write out the Consensus Metadata file based on the ConsensusStatePB
- // downloaded as part of initiating the remote bootstrap session.
+ // downloaded as part of initiating the tablet copy session.
Status WriteConsensusMetadata();
// Download all blocks belonging to a tablet sequentially.
@@ -177,7 +177,7 @@ class RemoteBootstrapClient {
FsManager* const fs_manager_;
const std::shared_ptr<rpc::Messenger> messenger_;
- // State flags that enforce the progress of remote bootstrap.
+ // State flags that enforce the progress of tablet copy.
bool started_; // Session started.
bool downloaded_wal_; // WAL segments downloaded.
bool downloaded_blocks_; // Data blocks downloaded.
@@ -193,7 +193,7 @@ class RemoteBootstrapClient {
gscoped_ptr<consensus::ConsensusMetadata> cmeta_;
tablet::TabletStatusListener* status_listener_;
- std::shared_ptr<RemoteBootstrapServiceProxy> proxy_;
+ std::shared_ptr<TabletCopyServiceProxy> proxy_;
std::string session_id_;
uint64_t session_idle_timeout_millis_;
gscoped_ptr<tablet::TabletSuperBlockPB> superblock_;
@@ -202,9 +202,9 @@ class RemoteBootstrapClient {
std::vector<uint64_t> wal_seqnos_;
int64_t start_time_micros_;
- DISALLOW_COPY_AND_ASSIGN(RemoteBootstrapClient);
+ DISALLOW_COPY_AND_ASSIGN(TabletCopyClient);
};
} // namespace tserver
} // namespace kudu
-#endif /* KUDU_TSERVER_REMOTE_BOOTSTRAP_CLIENT_H */
+#endif /* KUDU_TSERVER_TABLET_COPY_CLIENT_H */
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_service-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_service-test.cc b/src/kudu/tserver/remote_bootstrap_service-test.cc
index 23fd0be..1b5baf2 100644
--- a/src/kudu/tserver/remote_bootstrap_service-test.cc
+++ b/src/kudu/tserver/remote_bootstrap_service-test.cc
@@ -40,8 +40,8 @@
#define ASSERT_REMOTE_ERROR(status, err, code, str) \
ASSERT_NO_FATAL_FAILURE(AssertRemoteError(status, err, code, str))
-DECLARE_uint64(remote_bootstrap_idle_timeout_ms);
-DECLARE_uint64(remote_bootstrap_timeout_poll_period_ms);
+DECLARE_uint64(tablet_copy_idle_timeout_ms);
+DECLARE_uint64(tablet_copy_timeout_poll_period_ms);
namespace kudu {
namespace tserver {
@@ -56,39 +56,39 @@ using rpc::RpcController;
using std::thread;
using std::vector;
-class RemoteBootstrapServiceTest : public RemoteBootstrapTest {
+class TabletCopyServiceTest : public TabletCopyTest {
public:
- RemoteBootstrapServiceTest() {
+ TabletCopyServiceTest() {
// Poll for session expiration every 10 ms for the session timeout test.
- FLAGS_remote_bootstrap_timeout_poll_period_ms = 10;
+ FLAGS_tablet_copy_timeout_poll_period_ms = 10;
}
protected:
void SetUp() OVERRIDE {
- RemoteBootstrapTest::SetUp();
- remote_bootstrap_proxy_.reset(
- new RemoteBootstrapServiceProxy(client_messenger_, mini_server_->bound_rpc_addr()));
+ TabletCopyTest::SetUp();
+ tablet_copy_proxy_.reset(
+ new TabletCopyServiceProxy(client_messenger_, mini_server_->bound_rpc_addr()));
}
- Status DoBeginRemoteBootstrapSession(const string& tablet_id,
+ Status DoBeginTabletCopySession(const string& tablet_id,
const string& requestor_uuid,
- BeginRemoteBootstrapSessionResponsePB* resp,
+ BeginTabletCopySessionResponsePB* resp,
RpcController* controller) {
controller->set_timeout(MonoDelta::FromSeconds(1.0));
- BeginRemoteBootstrapSessionRequestPB req;
+ BeginTabletCopySessionRequestPB req;
req.set_tablet_id(tablet_id);
req.set_requestor_uuid(requestor_uuid);
return UnwindRemoteError(
- remote_bootstrap_proxy_->BeginRemoteBootstrapSession(req, resp, controller), controller);
+ tablet_copy_proxy_->BeginTabletCopySession(req, resp, controller), controller);
}
- Status DoBeginValidRemoteBootstrapSession(string* session_id,
+ Status DoBeginValidTabletCopySession(string* session_id,
tablet::TabletSuperBlockPB* superblock = nullptr,
uint64_t* idle_timeout_millis = nullptr,
vector<uint64_t>* sequence_numbers = nullptr) {
- BeginRemoteBootstrapSessionResponsePB resp;
+ BeginTabletCopySessionResponsePB resp;
RpcController controller;
- RETURN_NOT_OK(DoBeginRemoteBootstrapSession(GetTabletId(), GetLocalUUID(), &resp, &controller));
+ RETURN_NOT_OK(DoBeginTabletCopySession(GetTabletId(), GetLocalUUID(), &resp, &controller));
*session_id = resp.session_id();
if (superblock) {
*superblock = resp.superblock();
@@ -103,13 +103,13 @@ class RemoteBootstrapServiceTest : public RemoteBootstrapTest {
}
Status DoCheckSessionActive(const string& session_id,
- CheckRemoteBootstrapSessionActiveResponsePB* resp,
+ CheckTabletCopySessionActiveResponsePB* resp,
RpcController* controller) {
controller->set_timeout(MonoDelta::FromSeconds(1.0));
- CheckRemoteBootstrapSessionActiveRequestPB req;
+ CheckTabletCopySessionActiveRequestPB req;
req.set_session_id(session_id);
return UnwindRemoteError(
- remote_bootstrap_proxy_->CheckSessionActive(req, resp, controller), controller);
+ tablet_copy_proxy_->CheckSessionActive(req, resp, controller), controller);
}
Status DoFetchData(const string& session_id, const DataIdPB& data_id,
@@ -127,28 +127,28 @@ class RemoteBootstrapServiceTest : public RemoteBootstrapTest {
req.set_max_length(*max_length);
}
return UnwindRemoteError(
- remote_bootstrap_proxy_->FetchData(req, resp, controller), controller);
+ tablet_copy_proxy_->FetchData(req, resp, controller), controller);
}
- Status DoEndRemoteBootstrapSession(const string& session_id, bool is_success,
+ Status DoEndTabletCopySession(const string& session_id, bool is_success,
const Status* error_msg,
- EndRemoteBootstrapSessionResponsePB* resp,
+ EndTabletCopySessionResponsePB* resp,
RpcController* controller) {
controller->set_timeout(MonoDelta::FromSeconds(1.0));
- EndRemoteBootstrapSessionRequestPB req;
+ EndTabletCopySessionRequestPB req;
req.set_session_id(session_id);
req.set_is_success(is_success);
if (error_msg) {
StatusToPB(*error_msg, req.mutable_error());
}
return UnwindRemoteError(
- remote_bootstrap_proxy_->EndRemoteBootstrapSession(req, resp, controller), controller);
+ tablet_copy_proxy_->EndTabletCopySession(req, resp, controller), controller);
}
// Decode the remote error into a Status object.
Status ExtractRemoteError(const ErrorStatusPB* remote_error) {
- const RemoteBootstrapErrorPB& error =
- remote_error->GetExtension(RemoteBootstrapErrorPB::remote_bootstrap_error_ext);
+ const TabletCopyErrorPB& error =
+ remote_error->GetExtension(TabletCopyErrorPB::tablet_copy_error_ext);
return StatusFromPB(error.status());
}
@@ -163,15 +163,15 @@ class RemoteBootstrapServiceTest : public RemoteBootstrapTest {
}
void AssertRemoteError(Status status, const ErrorStatusPB* remote_error,
- const RemoteBootstrapErrorPB::Code app_code,
+ const TabletCopyErrorPB::Code app_code,
const string& status_code_string) {
ASSERT_TRUE(status.IsRemoteError()) << "Unexpected status code: " << status.ToString()
<< ", app code: "
- << RemoteBootstrapErrorPB::Code_Name(app_code)
+ << TabletCopyErrorPB::Code_Name(app_code)
<< ", status code string: " << status_code_string;
const Status app_status = ExtractRemoteError(remote_error);
- const RemoteBootstrapErrorPB& error =
- remote_error->GetExtension(RemoteBootstrapErrorPB::remote_bootstrap_error_ext);
+ const TabletCopyErrorPB& error =
+ remote_error->GetExtension(TabletCopyErrorPB::tablet_copy_error_ext);
ASSERT_EQ(app_code, error.code()) << error.ShortDebugString();
ASSERT_EQ(status_code_string, app_status.CodeAsString()) << app_status.ToString();
LOG(INFO) << app_status.ToString();
@@ -185,52 +185,52 @@ class RemoteBootstrapServiceTest : public RemoteBootstrapTest {
return data_id;
}
- gscoped_ptr<RemoteBootstrapServiceProxy> remote_bootstrap_proxy_;
+ gscoped_ptr<TabletCopyServiceProxy> tablet_copy_proxy_;
};
-// Test beginning and ending a remote bootstrap session.
-TEST_F(RemoteBootstrapServiceTest, TestSimpleBeginEndSession) {
+// Test beginning and ending a tablet copy session.
+TEST_F(TabletCopyServiceTest, TestSimpleBeginEndSession) {
string session_id;
tablet::TabletSuperBlockPB superblock;
uint64_t idle_timeout_millis;
vector<uint64_t> segment_seqnos;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id,
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id,
&superblock,
&idle_timeout_millis,
&segment_seqnos));
// Basic validation of returned params.
ASSERT_FALSE(session_id.empty());
- ASSERT_EQ(FLAGS_remote_bootstrap_idle_timeout_ms, idle_timeout_millis);
+ ASSERT_EQ(FLAGS_tablet_copy_idle_timeout_ms, idle_timeout_millis);
ASSERT_TRUE(superblock.IsInitialized());
// We should have number of segments = number of rolls + 1 (due to the active segment).
ASSERT_EQ(kNumLogRolls + 1, segment_seqnos.size());
- EndRemoteBootstrapSessionResponsePB resp;
+ EndTabletCopySessionResponsePB resp;
RpcController controller;
- ASSERT_OK(DoEndRemoteBootstrapSession(session_id, true, nullptr, &resp, &controller));
+ ASSERT_OK(DoEndTabletCopySession(session_id, true, nullptr, &resp, &controller));
}
// Test starting two sessions. The current implementation will silently only create one.
-TEST_F(RemoteBootstrapServiceTest, TestBeginTwice) {
+TEST_F(TabletCopyServiceTest, TestBeginTwice) {
// Second time through should silently succeed.
for (int i = 0; i < 2; i++) {
string session_id;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id));
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id));
ASSERT_FALSE(session_id.empty());
}
}
// Regression test for KUDU-1436: race conditions if multiple requests
-// to begin the same remote bootstrap session arrive at more or less the
+// to begin the same tablet copy session arrive at more or less the
// same time.
-TEST_F(RemoteBootstrapServiceTest, TestBeginConcurrently) {
+TEST_F(TabletCopyServiceTest, TestBeginConcurrently) {
const int kNumThreads = 5;
vector<thread> threads;
vector<tablet::TabletSuperBlockPB> sblocks(kNumThreads);
for (int i = 0 ; i < kNumThreads; i++) {
threads.emplace_back([this, &sblocks, i]{
string session_id;
- CHECK_OK(DoBeginValidRemoteBootstrapSession(&session_id, &sblocks[i]));
+ CHECK_OK(DoBeginValidTabletCopySession(&session_id, &sblocks[i]));
CHECK(!session_id.empty());
});
}
@@ -244,7 +244,7 @@ TEST_F(RemoteBootstrapServiceTest, TestBeginConcurrently) {
}
// Test bad session id error condition.
-TEST_F(RemoteBootstrapServiceTest, TestInvalidSessionId) {
+TEST_F(TabletCopyServiceTest, TestInvalidSessionId) {
vector<string> bad_session_ids;
bad_session_ids.push_back("hodor");
bad_session_ids.push_back(GetLocalUUID());
@@ -257,34 +257,34 @@ TEST_F(RemoteBootstrapServiceTest, TestInvalidSessionId) {
data_id.set_type(DataIdPB::BLOCK);
data_id.mutable_block_id()->set_id(1);
Status status = DoFetchData(session_id, data_id, nullptr, nullptr, &resp, &controller);
- ASSERT_REMOTE_ERROR(status, controller.error_response(), RemoteBootstrapErrorPB::NO_SESSION,
+ ASSERT_REMOTE_ERROR(status, controller.error_response(), TabletCopyErrorPB::NO_SESSION,
Status::NotFound("").CodeAsString());
}
// End a non-existent session.
for (const string& session_id : bad_session_ids) {
- EndRemoteBootstrapSessionResponsePB resp;
+ EndTabletCopySessionResponsePB resp;
RpcController controller;
- Status status = DoEndRemoteBootstrapSession(session_id, true, nullptr, &resp, &controller);
- ASSERT_REMOTE_ERROR(status, controller.error_response(), RemoteBootstrapErrorPB::NO_SESSION,
+ Status status = DoEndTabletCopySession(session_id, true, nullptr, &resp, &controller);
+ ASSERT_REMOTE_ERROR(status, controller.error_response(), TabletCopyErrorPB::NO_SESSION,
Status::NotFound("").CodeAsString());
}
}
// Test bad tablet id error condition.
-TEST_F(RemoteBootstrapServiceTest, TestInvalidTabletId) {
- BeginRemoteBootstrapSessionResponsePB resp;
+TEST_F(TabletCopyServiceTest, TestInvalidTabletId) {
+ BeginTabletCopySessionResponsePB resp;
RpcController controller;
Status status =
- DoBeginRemoteBootstrapSession("some-unknown-tablet", GetLocalUUID(), &resp, &controller);
- ASSERT_REMOTE_ERROR(status, controller.error_response(), RemoteBootstrapErrorPB::TABLET_NOT_FOUND,
+ DoBeginTabletCopySession("some-unknown-tablet", GetLocalUUID(), &resp, &controller);
+ ASSERT_REMOTE_ERROR(status, controller.error_response(), TabletCopyErrorPB::TABLET_NOT_FOUND,
Status::NotFound("").CodeAsString());
}
// Test DataIdPB validation.
-TEST_F(RemoteBootstrapServiceTest, TestInvalidBlockOrOpId) {
+TEST_F(TabletCopyServiceTest, TestInvalidBlockOrOpId) {
string session_id;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id));
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id));
// Invalid BlockId.
{
@@ -295,7 +295,7 @@ TEST_F(RemoteBootstrapServiceTest, TestInvalidBlockOrOpId) {
data_id.mutable_block_id()->set_id(1);
Status status = DoFetchData(session_id, data_id, nullptr, nullptr, &resp, &controller);
ASSERT_REMOTE_ERROR(status, controller.error_response(),
- RemoteBootstrapErrorPB::BLOCK_NOT_FOUND,
+ TabletCopyErrorPB::BLOCK_NOT_FOUND,
Status::NotFound("").CodeAsString());
}
@@ -308,7 +308,7 @@ TEST_F(RemoteBootstrapServiceTest, TestInvalidBlockOrOpId) {
data_id.set_wal_segment_seqno(31337);
Status status = DoFetchData(session_id, data_id, nullptr, nullptr, &resp, &controller);
ASSERT_REMOTE_ERROR(status, controller.error_response(),
- RemoteBootstrapErrorPB::WAL_SEGMENT_NOT_FOUND,
+ TabletCopyErrorPB::WAL_SEGMENT_NOT_FOUND,
Status::NotFound("").CodeAsString());
}
@@ -323,7 +323,7 @@ TEST_F(RemoteBootstrapServiceTest, TestInvalidBlockOrOpId) {
ASSERT_TRUE(status.IsRemoteError()) << status.ToString();
ASSERT_STR_CONTAINS(status.ToString(),
"Invalid argument: invalid parameter for call "
- "kudu.tserver.RemoteBootstrapService.FetchData: "
+ "kudu.tserver.TabletCopyService.FetchData: "
"missing fields: data_id.type");
}
@@ -335,7 +335,7 @@ TEST_F(RemoteBootstrapServiceTest, TestInvalidBlockOrOpId) {
data_id.set_type(DataIdPB::LOG_SEGMENT);
Status status = DoFetchData(session_id, data_id, nullptr, nullptr, &resp, &controller);
ASSERT_REMOTE_ERROR(status, controller.error_response(),
- RemoteBootstrapErrorPB::INVALID_REMOTE_BOOTSTRAP_REQUEST,
+ TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST,
Status::InvalidArgument("").CodeAsString());
}
@@ -349,16 +349,16 @@ TEST_F(RemoteBootstrapServiceTest, TestInvalidBlockOrOpId) {
data_id.set_wal_segment_seqno(0);
Status status = DoFetchData(session_id, data_id, nullptr, nullptr, &resp, &controller);
ASSERT_REMOTE_ERROR(status, controller.error_response(),
- RemoteBootstrapErrorPB::INVALID_REMOTE_BOOTSTRAP_REQUEST,
+ TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST,
Status::InvalidArgument("").CodeAsString());
}
}
// Test invalid file offset error condition.
-TEST_F(RemoteBootstrapServiceTest, TestFetchInvalidBlockOffset) {
+TEST_F(TabletCopyServiceTest, TestFetchInvalidBlockOffset) {
string session_id;
tablet::TabletSuperBlockPB superblock;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id, &superblock));
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id, &superblock));
FetchDataResponsePB resp;
RpcController controller;
@@ -367,15 +367,15 @@ TEST_F(RemoteBootstrapServiceTest, TestFetchInvalidBlockOffset) {
Status status = DoFetchData(session_id, AsDataTypeId(FirstColumnBlockId(superblock)),
&offset, nullptr, &resp, &controller);
ASSERT_REMOTE_ERROR(status, controller.error_response(),
- RemoteBootstrapErrorPB::INVALID_REMOTE_BOOTSTRAP_REQUEST,
+ TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST,
Status::InvalidArgument("").CodeAsString());
}
// Test that we are able to fetch an entire block.
-TEST_F(RemoteBootstrapServiceTest, TestFetchBlockAtOnce) {
+TEST_F(TabletCopyServiceTest, TestFetchBlockAtOnce) {
string session_id;
tablet::TabletSuperBlockPB superblock;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id, &superblock));
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id, &superblock));
// Local.
BlockId block_id = FirstColumnBlockId(superblock);
@@ -393,10 +393,10 @@ TEST_F(RemoteBootstrapServiceTest, TestFetchBlockAtOnce) {
}
// Test that we are able to incrementally fetch blocks.
-TEST_F(RemoteBootstrapServiceTest, TestFetchBlockIncrementally) {
+TEST_F(TabletCopyServiceTest, TestFetchBlockIncrementally) {
string session_id;
tablet::TabletSuperBlockPB superblock;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id, &superblock));
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id, &superblock));
BlockId block_id = FirstColumnBlockId(superblock);
Slice local_data;
@@ -421,12 +421,12 @@ TEST_F(RemoteBootstrapServiceTest, TestFetchBlockIncrementally) {
}
// Test that we are able to fetch log segments.
-TEST_F(RemoteBootstrapServiceTest, TestFetchLog) {
+TEST_F(TabletCopyServiceTest, TestFetchLog) {
string session_id;
tablet::TabletSuperBlockPB superblock;
uint64_t idle_timeout_millis;
vector<uint64_t> segment_seqnos;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id,
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id,
&superblock,
&idle_timeout_millis,
&segment_seqnos));
@@ -462,18 +462,18 @@ TEST_F(RemoteBootstrapServiceTest, TestFetchLog) {
AssertDataEqual(slice.data(), slice.size(), resp.chunk());
}
-// Test that the remote bootstrap session timeout works properly.
-TEST_F(RemoteBootstrapServiceTest, TestSessionTimeout) {
+// Test that the tablet copy session timeout works properly.
+TEST_F(TabletCopyServiceTest, TestSessionTimeout) {
// This flag should be seen by the service due to TSO.
// We have also reduced the timeout polling frequency in SetUp().
- FLAGS_remote_bootstrap_idle_timeout_ms = 1; // Expire the session almost immediately.
+ FLAGS_tablet_copy_idle_timeout_ms = 1; // Expire the session almost immediately.
// Start session.
string session_id;
- ASSERT_OK(DoBeginValidRemoteBootstrapSession(&session_id));
+ ASSERT_OK(DoBeginValidTabletCopySession(&session_id));
MonoTime start_time = MonoTime::Now(MonoTime::FINE);
- CheckRemoteBootstrapSessionActiveResponsePB resp;
+ CheckTabletCopySessionActiveResponsePB resp;
do {
RpcController controller;
@@ -484,7 +484,7 @@ TEST_F(RemoteBootstrapServiceTest, TestSessionTimeout) {
SleepFor(MonoDelta::FromMilliseconds(1)); // 1 ms
} while (MonoTime::Now(MonoTime::FINE).GetDeltaSince(start_time).ToSeconds() < 10);
- ASSERT_FALSE(resp.session_is_active()) << "Remote bootstrap session did not time out!";
+ ASSERT_FALSE(resp.session_is_active()) << "Tablet Copy session did not time out!";
}
} // namespace tserver
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_service.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_service.cc b/src/kudu/tserver/remote_bootstrap_service.cc
index a6ea959..f5bd2ae 100644
--- a/src/kudu/tserver/remote_bootstrap_service.cc
+++ b/src/kudu/tserver/remote_bootstrap_service.cc
@@ -50,19 +50,19 @@
} \
} while (false)
-DEFINE_uint64(remote_bootstrap_idle_timeout_ms, 180000,
- "Amount of time without activity before a remote bootstrap "
+DEFINE_uint64(tablet_copy_idle_timeout_ms, 180000,
+ "Amount of time without activity before a tablet copy "
"session will expire, in millis");
-TAG_FLAG(remote_bootstrap_idle_timeout_ms, hidden);
+TAG_FLAG(tablet_copy_idle_timeout_ms, hidden);
-DEFINE_uint64(remote_bootstrap_timeout_poll_period_ms, 10000,
- "How often the remote_bootstrap service polls for expired "
- "remote bootstrap sessions, in millis");
-TAG_FLAG(remote_bootstrap_timeout_poll_period_ms, hidden);
+DEFINE_uint64(tablet_copy_timeout_poll_period_ms, 10000,
+ "How often the tablet_copy service polls for expired "
+ "tablet copy sessions, in millis");
+TAG_FLAG(tablet_copy_timeout_poll_period_ms, hidden);
DEFINE_double(fault_crash_on_handle_rb_fetch_data, 0.0,
"Fraction of the time when the tablet will crash while "
- "servicing a RemoteBootstrapService FetchData() RPC call. "
+ "servicing a TabletCopyService FetchData() RPC call. "
"(For testing only!)");
TAG_FLAG(fault_crash_on_handle_rb_fetch_data, unsafe);
@@ -74,36 +74,36 @@ using strings::Substitute;
using tablet::TabletPeer;
static void SetupErrorAndRespond(rpc::RpcContext* context,
- RemoteBootstrapErrorPB::Code code,
+ TabletCopyErrorPB::Code code,
const string& message,
const Status& s) {
- LOG(WARNING) << "Error handling RemoteBootstrapService RPC request from "
+ LOG(WARNING) << "Error handling TabletCopyService RPC request from "
<< context->requestor_string() << ": "
<< s.ToString();
- RemoteBootstrapErrorPB error;
+ TabletCopyErrorPB error;
StatusToPB(s, error.mutable_status());
error.set_code(code);
- context->RespondApplicationError(RemoteBootstrapErrorPB::remote_bootstrap_error_ext.number(),
+ context->RespondApplicationError(TabletCopyErrorPB::tablet_copy_error_ext.number(),
message, error);
}
-RemoteBootstrapServiceImpl::RemoteBootstrapServiceImpl(
+TabletCopyServiceImpl::TabletCopyServiceImpl(
FsManager* fs_manager,
TabletPeerLookupIf* tablet_peer_lookup,
const scoped_refptr<MetricEntity>& metric_entity,
const scoped_refptr<rpc::ResultTracker>& result_tracker)
- : RemoteBootstrapServiceIf(metric_entity, result_tracker),
+ : TabletCopyServiceIf(metric_entity, result_tracker),
fs_manager_(CHECK_NOTNULL(fs_manager)),
tablet_peer_lookup_(CHECK_NOTNULL(tablet_peer_lookup)),
shutdown_latch_(1) {
CHECK_OK(Thread::Create("remote-bootstrap", "rb-session-exp",
- &RemoteBootstrapServiceImpl::EndExpiredSessions, this,
+ &TabletCopyServiceImpl::EndExpiredSessions, this,
&session_expiration_thread_));
}
-void RemoteBootstrapServiceImpl::BeginRemoteBootstrapSession(
- const BeginRemoteBootstrapSessionRequestPB* req,
- BeginRemoteBootstrapSessionResponsePB* resp,
+void TabletCopyServiceImpl::BeginTabletCopySession(
+ const BeginTabletCopySessionRequestPB* req,
+ BeginTabletCopySessionResponsePB* resp,
rpc::RpcContext* context) {
const string& requestor_uuid = req->requestor_uuid();
const string& tablet_id = req->tablet_id();
@@ -114,27 +114,27 @@ void RemoteBootstrapServiceImpl::BeginRemoteBootstrapSession(
scoped_refptr<TabletPeer> tablet_peer;
RPC_RETURN_NOT_OK(tablet_peer_lookup_->GetTabletPeer(tablet_id, &tablet_peer),
- RemoteBootstrapErrorPB::TABLET_NOT_FOUND,
+ TabletCopyErrorPB::TABLET_NOT_FOUND,
Substitute("Unable to find specified tablet: $0", tablet_id));
- scoped_refptr<RemoteBootstrapSession> session;
+ scoped_refptr<TabletCopySession> session;
{
MutexLock l(sessions_lock_);
if (!FindCopy(sessions_, session_id, &session)) {
LOG(INFO) << Substitute(
- "Beginning new remote bootstrap session on tablet $0 from peer $1"
+ "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 RemoteBootstrapSession(tablet_peer, session_id,
+ session.reset(new TabletCopySession(tablet_peer, session_id,
requestor_uuid, fs_manager_));
RPC_RETURN_NOT_OK(session->Init(),
- RemoteBootstrapErrorPB::UNKNOWN_ERROR,
- Substitute("Error initializing remote bootstrap session for tablet $0",
+ TabletCopyErrorPB::UNKNOWN_ERROR,
+ Substitute("Error initializing tablet copy session for tablet $0",
tablet_id));
InsertOrDie(&sessions_, session_id, session);
} else {
LOG(INFO) << Substitute(
- "Re-sending initialization info for existing remote bootstrap session on tablet $0"
+ "Re-sending initialization info for existing tablet copy session on tablet $0"
" from peer $1 at $2: session_id = $3",
tablet_id, requestor_uuid, context->requestor_string(), session_id);
}
@@ -143,7 +143,7 @@ void RemoteBootstrapServiceImpl::BeginRemoteBootstrapSession(
resp->set_responder_uuid(fs_manager_->uuid());
resp->set_session_id(session_id);
- resp->set_session_idle_timeout_millis(FLAGS_remote_bootstrap_idle_timeout_ms);
+ resp->set_session_idle_timeout_millis(FLAGS_tablet_copy_idle_timeout_ms);
resp->mutable_superblock()->CopyFrom(session->tablet_superblock());
resp->mutable_initial_committed_cstate()->CopyFrom(session->initial_committed_cstate());
@@ -154,16 +154,16 @@ void RemoteBootstrapServiceImpl::BeginRemoteBootstrapSession(
context->RespondSuccess();
}
-void RemoteBootstrapServiceImpl::CheckSessionActive(
- const CheckRemoteBootstrapSessionActiveRequestPB* req,
- CheckRemoteBootstrapSessionActiveResponsePB* resp,
+void TabletCopyServiceImpl::CheckSessionActive(
+ const CheckTabletCopySessionActiveRequestPB* req,
+ CheckTabletCopySessionActiveResponsePB* resp,
rpc::RpcContext* context) {
const string& session_id = req->session_id();
- // Look up and validate remote bootstrap session.
- scoped_refptr<RemoteBootstrapSession> session;
+ // Look up and validate tablet copy session.
+ scoped_refptr<TabletCopySession> session;
MutexLock l(sessions_lock_);
- RemoteBootstrapErrorPB::Code app_error;
+ TabletCopyErrorPB::Code app_error;
Status status = FindSessionUnlocked(session_id, &app_error, &session);
if (status.ok()) {
if (req->keepalive()) {
@@ -172,7 +172,7 @@ void RemoteBootstrapServiceImpl::CheckSessionActive(
resp->set_session_is_active(true);
context->RespondSuccess();
return;
- } else if (app_error == RemoteBootstrapErrorPB::NO_SESSION) {
+ } else if (app_error == TabletCopyErrorPB::NO_SESSION) {
resp->set_session_is_active(false);
context->RespondSuccess();
return;
@@ -182,16 +182,16 @@ void RemoteBootstrapServiceImpl::CheckSessionActive(
}
}
-void RemoteBootstrapServiceImpl::FetchData(const FetchDataRequestPB* req,
+void TabletCopyServiceImpl::FetchData(const FetchDataRequestPB* req,
FetchDataResponsePB* resp,
rpc::RpcContext* context) {
const string& session_id = req->session_id();
- // Look up and validate remote bootstrap session.
- scoped_refptr<RemoteBootstrapSession> session;
+ // Look up and validate tablet copy session.
+ scoped_refptr<TabletCopySession> session;
{
MutexLock l(sessions_lock_);
- RemoteBootstrapErrorPB::Code app_error;
+ TabletCopyErrorPB::Code app_error;
RPC_RETURN_NOT_OK(FindSessionUnlocked(session_id, &app_error, &session),
app_error, "No such session");
ResetSessionExpirationUnlocked(session_id);
@@ -203,7 +203,7 @@ void RemoteBootstrapServiceImpl::FetchData(const FetchDataRequestPB* req,
int64_t client_maxlen = req->max_length();
const DataIdPB& data_id = req->data_id();
- RemoteBootstrapErrorPB::Code error_code = RemoteBootstrapErrorPB::UNKNOWN_ERROR;
+ TabletCopyErrorPB::Code error_code = TabletCopyErrorPB::UNKNOWN_ERROR;
RPC_RETURN_NOT_OK(ValidateFetchRequestDataId(data_id, &error_code, session),
error_code, "Invalid DataId");
@@ -234,60 +234,60 @@ void RemoteBootstrapServiceImpl::FetchData(const FetchDataRequestPB* req,
context->RespondSuccess();
}
-void RemoteBootstrapServiceImpl::EndRemoteBootstrapSession(
- const EndRemoteBootstrapSessionRequestPB* req,
- EndRemoteBootstrapSessionResponsePB* resp,
+void TabletCopyServiceImpl::EndTabletCopySession(
+ const EndTabletCopySessionRequestPB* req,
+ EndTabletCopySessionResponsePB* resp,
rpc::RpcContext* context) {
{
MutexLock l(sessions_lock_);
- RemoteBootstrapErrorPB::Code app_error;
- LOG(INFO) << "Request end of remote bootstrap session " << req->session_id()
+ TabletCopyErrorPB::Code app_error;
+ LOG(INFO) << "Request end of tablet copy session " << req->session_id()
<< " received from " << context->requestor_string();
- RPC_RETURN_NOT_OK(DoEndRemoteBootstrapSessionUnlocked(req->session_id(), &app_error),
+ RPC_RETURN_NOT_OK(DoEndTabletCopySessionUnlocked(req->session_id(), &app_error),
app_error, "No such session");
}
context->RespondSuccess();
}
-void RemoteBootstrapServiceImpl::Shutdown() {
+void TabletCopyServiceImpl::Shutdown() {
shutdown_latch_.CountDown();
session_expiration_thread_->Join();
- // Destroy all remote bootstrap sessions.
+ // Destroy all tablet copy sessions.
vector<string> session_ids;
for (const MonoTimeMap::value_type& entry : session_expirations_) {
session_ids.push_back(entry.first);
}
for (const string& session_id : session_ids) {
- LOG(INFO) << "Destroying remote bootstrap session " << session_id << " due to service shutdown";
- RemoteBootstrapErrorPB::Code app_error;
- CHECK_OK(DoEndRemoteBootstrapSessionUnlocked(session_id, &app_error));
+ LOG(INFO) << "Destroying tablet copy session " << session_id << " due to service shutdown";
+ TabletCopyErrorPB::Code app_error;
+ CHECK_OK(DoEndTabletCopySessionUnlocked(session_id, &app_error));
}
}
-Status RemoteBootstrapServiceImpl::FindSessionUnlocked(
+Status TabletCopyServiceImpl::FindSessionUnlocked(
const string& session_id,
- RemoteBootstrapErrorPB::Code* app_error,
- scoped_refptr<RemoteBootstrapSession>* session) const {
+ TabletCopyErrorPB::Code* app_error,
+ scoped_refptr<TabletCopySession>* session) const {
if (!FindCopy(sessions_, session_id, session)) {
- *app_error = RemoteBootstrapErrorPB::NO_SESSION;
+ *app_error = TabletCopyErrorPB::NO_SESSION;
return Status::NotFound(
- Substitute("Remote bootstrap session with Session ID \"$0\" not found", session_id));
+ Substitute("Tablet Copy session with Session ID \"$0\" not found", session_id));
}
return Status::OK();
}
-Status RemoteBootstrapServiceImpl::ValidateFetchRequestDataId(
+Status TabletCopyServiceImpl::ValidateFetchRequestDataId(
const DataIdPB& data_id,
- RemoteBootstrapErrorPB::Code* app_error,
- const scoped_refptr<RemoteBootstrapSession>& session) const {
+ TabletCopyErrorPB::Code* app_error,
+ const scoped_refptr<TabletCopySession>& session) const {
if (PREDICT_FALSE(data_id.has_block_id() && data_id.has_wal_segment_seqno())) {
- *app_error = RemoteBootstrapErrorPB::INVALID_REMOTE_BOOTSTRAP_REQUEST;
+ *app_error = TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST;
return Status::InvalidArgument(
Substitute("Only one of BlockId or segment sequence number are required, "
"but both were specified. DataTypeID: $0", data_id.ShortDebugString()));
} else if (PREDICT_FALSE(!data_id.has_block_id() && !data_id.has_wal_segment_seqno())) {
- *app_error = RemoteBootstrapErrorPB::INVALID_REMOTE_BOOTSTRAP_REQUEST;
+ *app_error = TabletCopyErrorPB::INVALID_TABLET_COPY_REQUEST;
return Status::InvalidArgument(
Substitute("Only one of BlockId or segment sequence number are required, "
"but neither were specified. DataTypeID: $0", data_id.ShortDebugString()));
@@ -309,20 +309,20 @@ Status RemoteBootstrapServiceImpl::ValidateFetchRequestDataId(
return Status::OK();
}
-void RemoteBootstrapServiceImpl::ResetSessionExpirationUnlocked(const std::string& session_id) {
+void TabletCopyServiceImpl::ResetSessionExpirationUnlocked(const std::string& session_id) {
MonoTime expiration(MonoTime::Now(MonoTime::FINE));
- expiration.AddDelta(MonoDelta::FromMilliseconds(FLAGS_remote_bootstrap_idle_timeout_ms));
+ expiration.AddDelta(MonoDelta::FromMilliseconds(FLAGS_tablet_copy_idle_timeout_ms));
InsertOrUpdate(&session_expirations_, session_id, expiration);
}
-Status RemoteBootstrapServiceImpl::DoEndRemoteBootstrapSessionUnlocked(
+Status TabletCopyServiceImpl::DoEndTabletCopySessionUnlocked(
const std::string& session_id,
- RemoteBootstrapErrorPB::Code* app_error) {
- scoped_refptr<RemoteBootstrapSession> session;
+ TabletCopyErrorPB::Code* app_error) {
+ scoped_refptr<TabletCopySession> 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.
- LOG(INFO) << "Ending remote bootstrap session " << session_id << " on tablet "
+ LOG(INFO) << "Ending tablet copy session " << session_id << " on tablet "
<< session->tablet_id() << " with peer " << session->requestor_uuid();
CHECK_EQ(1, sessions_.erase(session_id));
CHECK_EQ(1, session_expirations_.erase(session_id));
@@ -330,7 +330,7 @@ Status RemoteBootstrapServiceImpl::DoEndRemoteBootstrapSessionUnlocked(
return Status::OK();
}
-void RemoteBootstrapServiceImpl::EndExpiredSessions() {
+void TabletCopyServiceImpl::EndExpiredSessions() {
do {
MutexLock l(sessions_lock_);
MonoTime now = MonoTime::Now(MonoTime::FINE);
@@ -344,13 +344,13 @@ void RemoteBootstrapServiceImpl::EndExpiredSessions() {
}
}
for (const string& session_id : expired_session_ids) {
- LOG(INFO) << "Remote bootstrap session " << session_id
+ LOG(INFO) << "Tablet Copy session " << session_id
<< " has expired. Terminating session.";
- RemoteBootstrapErrorPB::Code app_error;
- CHECK_OK(DoEndRemoteBootstrapSessionUnlocked(session_id, &app_error));
+ TabletCopyErrorPB::Code app_error;
+ CHECK_OK(DoEndTabletCopySessionUnlocked(session_id, &app_error));
}
} while (!shutdown_latch_.WaitFor(MonoDelta::FromMilliseconds(
- FLAGS_remote_bootstrap_timeout_poll_period_ms)));
+ FLAGS_tablet_copy_timeout_poll_period_ms)));
}
} // namespace tserver
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_service.h
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_service.h b/src/kudu/tserver/remote_bootstrap_service.h
index 43c3055..a5eab8c 100644
--- a/src/kudu/tserver/remote_bootstrap_service.h
+++ b/src/kudu/tserver/remote_bootstrap_service.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_REMOTE_BOOTSTRAP_SERVICE_H_
-#define KUDU_TSERVER_REMOTE_BOOTSTRAP_SERVICE_H_
+#ifndef KUDU_TSERVER_TABLET_COPY_SERVICE_H_
+#define KUDU_TSERVER_TABLET_COPY_SERVICE_H_
#include <string>
#include <unordered_map>
@@ -39,54 +39,54 @@ class ReadableLogSegment;
namespace tserver {
-class RemoteBootstrapSession;
+class TabletCopySession;
class TabletPeerLookupIf;
-class RemoteBootstrapServiceImpl : public RemoteBootstrapServiceIf {
+class TabletCopyServiceImpl : public TabletCopyServiceIf {
public:
- RemoteBootstrapServiceImpl(FsManager* fs_manager,
+ TabletCopyServiceImpl(FsManager* fs_manager,
TabletPeerLookupIf* tablet_peer_lookup,
const scoped_refptr<MetricEntity>& metric_entity,
const scoped_refptr<rpc::ResultTracker>& result_tracker);
- virtual void BeginRemoteBootstrapSession(const BeginRemoteBootstrapSessionRequestPB* req,
- BeginRemoteBootstrapSessionResponsePB* resp,
+ virtual void BeginTabletCopySession(const BeginTabletCopySessionRequestPB* req,
+ BeginTabletCopySessionResponsePB* resp,
rpc::RpcContext* context) OVERRIDE;
- virtual void CheckSessionActive(const CheckRemoteBootstrapSessionActiveRequestPB* req,
- CheckRemoteBootstrapSessionActiveResponsePB* resp,
+ virtual void CheckSessionActive(const CheckTabletCopySessionActiveRequestPB* req,
+ CheckTabletCopySessionActiveResponsePB* resp,
rpc::RpcContext* context) OVERRIDE;
virtual void FetchData(const FetchDataRequestPB* req,
FetchDataResponsePB* resp,
rpc::RpcContext* context) OVERRIDE;
- virtual void EndRemoteBootstrapSession(const EndRemoteBootstrapSessionRequestPB* req,
- EndRemoteBootstrapSessionResponsePB* resp,
+ virtual void EndTabletCopySession(const EndTabletCopySessionRequestPB* req,
+ EndTabletCopySessionResponsePB* resp,
rpc::RpcContext* context) OVERRIDE;
virtual void Shutdown() OVERRIDE;
private:
- typedef std::unordered_map<std::string, scoped_refptr<RemoteBootstrapSession> > SessionMap;
+ typedef std::unordered_map<std::string, scoped_refptr<TabletCopySession> > SessionMap;
typedef std::unordered_map<std::string, MonoTime> MonoTimeMap;
// Look up session in session map.
Status FindSessionUnlocked(const std::string& session_id,
- RemoteBootstrapErrorPB::Code* app_error,
- scoped_refptr<RemoteBootstrapSession>* session) const;
+ TabletCopyErrorPB::Code* app_error,
+ scoped_refptr<TabletCopySession>* session) const;
// Validate the data identifier in a FetchData request.
Status ValidateFetchRequestDataId(const DataIdPB& data_id,
- RemoteBootstrapErrorPB::Code* app_error,
- const scoped_refptr<RemoteBootstrapSession>& session) const;
+ TabletCopyErrorPB::Code* app_error,
+ const scoped_refptr<TabletCopySession>& session) const;
// Take note of session activity; Re-update the session timeout deadline.
void ResetSessionExpirationUnlocked(const std::string& session_id);
- // Destroy the specified remote bootstrap session.
- Status DoEndRemoteBootstrapSessionUnlocked(const std::string& session_id,
- RemoteBootstrapErrorPB::Code* app_error);
+ // Destroy the specified tablet copy session.
+ Status DoEndTabletCopySessionUnlocked(const std::string& session_id,
+ TabletCopyErrorPB::Code* app_error);
// The timeout thread periodically checks whether sessions are expired and
// removes them from the map.
@@ -109,4 +109,4 @@ class RemoteBootstrapServiceImpl : public RemoteBootstrapServiceIf {
} // namespace tserver
} // namespace kudu
-#endif // KUDU_TSERVER_REMOTE_BOOTSTRAP_SERVICE_H_
+#endif // KUDU_TSERVER_TABLET_COPY_SERVICE_H_
http://git-wip-us.apache.org/repos/asf/kudu/blob/a6cb942e/src/kudu/tserver/remote_bootstrap_session-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tserver/remote_bootstrap_session-test.cc b/src/kudu/tserver/remote_bootstrap_session-test.cc
index d354699..0f0236a 100644
--- a/src/kudu/tserver/remote_bootstrap_session-test.cc
+++ b/src/kudu/tserver/remote_bootstrap_session-test.cc
@@ -68,9 +68,9 @@ using tablet::TabletPeer;
using tablet::TabletSuperBlockPB;
using tablet::WriteTransactionState;
-class RemoteBootstrapTest : public KuduTabletTest {
+class TabletCopyTest : public KuduTabletTest {
public:
- RemoteBootstrapTest()
+ TabletCopyTest()
: KuduTabletTest(Schema({ ColumnSchema("key", STRING),
ColumnSchema("val", INT32) }, 1)) {
CHECK_OK(ThreadPoolBuilder("test-exec").Build(&apply_pool_));
@@ -110,7 +110,7 @@ class RemoteBootstrapTest : public KuduTabletTest {
new TabletPeer(tablet()->metadata(),
config_peer,
apply_pool_.get(),
- Bind(&RemoteBootstrapTest::TabletPeerStateChangedCallback,
+ Bind(&TabletCopyTest::TabletPeerStateChangedCallback,
Unretained(this),
tablet()->tablet_id())));
@@ -179,12 +179,12 @@ class RemoteBootstrapTest : public KuduTabletTest {
}
void InitSession() {
- session_.reset(new RemoteBootstrapSession(tablet_peer_.get(), "TestSession", "FakeUUID",
+ session_.reset(new TabletCopySession(tablet_peer_.get(), "TestSession", "FakeUUID",
fs_manager()));
ASSERT_OK(session_->Init());
}
- // Read the specified BlockId, via the RemoteBootstrapSession, into a file.
+ // Read the specified BlockId, via the TabletCopySession, 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,
@@ -192,7 +192,7 @@ class RemoteBootstrapTest : public KuduTabletTest {
gscoped_ptr<SequentialFile>* file) {
string data;
int64_t block_file_size = 0;
- RemoteBootstrapErrorPB::Code error_code;
+ TabletCopyErrorPB::Code error_code;
CHECK_OK(session_->GetBlockPiece(block_id, 0, 0, &data, &block_file_size, &error_code));
if (block_file_size > 0) {
CHECK_GT(data.size(), 0);
@@ -213,12 +213,12 @@ class RemoteBootstrapTest : public KuduTabletTest {
scoped_refptr<LogAnchorRegistry> log_anchor_registry_;
gscoped_ptr<ThreadPool> apply_pool_;
scoped_refptr<TabletPeer> tablet_peer_;
- scoped_refptr<RemoteBootstrapSession> session_;
+ scoped_refptr<TabletCopySession> session_;
};
-// Ensure that the serialized SuperBlock included in the RemoteBootstrapSession is
+// Ensure that the serialized SuperBlock included in the TabletCopySession is
// equal to the serialized live superblock (on a quiesced tablet).
-TEST_F(RemoteBootstrapTest, TestSuperBlocksEqual) {
+TEST_F(TabletCopyTest, TestSuperBlocksEqual) {
// Compare content of superblocks.
faststring session_buf;
faststring tablet_buf;
@@ -247,7 +247,7 @@ TEST_F(RemoteBootstrapTest, TestSuperBlocksEqual) {
// Test fetching all files from tablet server, ensure the checksums for each
// chunk and the total file sizes match.
-TEST_F(RemoteBootstrapTest, TestBlocksEqual) {
+TEST_F(TabletCopyTest, TestBlocksEqual) {
TabletSuperBlockPB tablet_superblock;
ASSERT_OK(tablet()->metadata()->ToSuperBlock(&tablet_superblock));
for (int i = 0; i < tablet_superblock.rowsets_size(); i++) {
@@ -290,7 +290,7 @@ TEST_F(RemoteBootstrapTest, TestBlocksEqual) {
// Ensure that blocks are still readable through the open session even
// after they've been deleted.
-TEST_F(RemoteBootstrapTest, TestBlocksAreFetchableAfterBeingDeleted) {
+TEST_F(TabletCopyTest, TestBlocksAreFetchableAfterBeingDeleted) {
TabletSuperBlockPB tablet_superblock;
ASSERT_OK(tablet()->metadata()->ToSuperBlock(&tablet_superblock));
@@ -323,7 +323,7 @@ TEST_F(RemoteBootstrapTest, TestBlocksAreFetchableAfterBeingDeleted) {
for (const BlockId& block_id : data_blocks) {
ASSERT_TRUE(session_->IsBlockOpenForTests(block_id));
string data;
- RemoteBootstrapErrorPB::Code error_code;
+ TabletCopyErrorPB::Code error_code;
int64_t piece_size;
ASSERT_OK(session_->GetBlockPiece(block_id, 0, 0,
&data, &piece_size, &error_code));
|