Skip to content

Commit

Permalink
Allow overriding the UUID to be used for new instance metadata for a …
Browse files Browse the repository at this point in the history
…fresh master or tserver

Summary: Allow overriding the UUID to be used for new instance metadata for a fresh master or tserver

Test Plan: Jenkins: build platform: linux, build type: debug

Reviewers: kannan, mihnea, karthik, bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D5173
  • Loading branch information
mbautin committed Aug 3, 2018
1 parent 03079e3 commit 026b582
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/yb/fs/fs_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ DEFINE_string(fs_wal_dirs, "",
"also and that's a reasonable default for most use cases.");
TAG_FLAG(fs_wal_dirs, stable);

DEFINE_string(instance_uuid_override, "",
"When creating local instance metadata (for master or tserver) in an empty data "
"directory, use this UUID instead of randomly-generated one. Can be used to replace "
"a node that had its disk wiped in some scenarios.");

using google::protobuf::Message;
using yb::env_util::ScopedFileDeleter;
using yb::fs::BlockManagerOptions;
Expand Down Expand Up @@ -381,7 +386,11 @@ Status FsManager::CreateInitialFileSystemLayout() {

void FsManager::CreateInstanceMetadata(InstanceMetadataPB* metadata) {
ObjectIdGenerator oid_generator;
metadata->set_uuid(oid_generator.Next());
if (!FLAGS_instance_uuid_override.empty()) {
metadata->set_uuid(FLAGS_instance_uuid_override);
} else {
metadata->set_uuid(oid_generator.Next());
}

string time_str;
StringAppendStrftime(&time_str, "%Y-%m-%d %H:%M:%S", time(nullptr), false);
Expand Down

0 comments on commit 026b582

Please sign in to comment.