Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/comdb2ar/comdb2ar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ int main(int argc, char *argv[])
bool support_files_only = false;
bool strip_cluster_info = false;
bool strip_consumer_info = false;
bool strip_external_auth = false;
bool run_full_recovery = true;
bool run_with_done_file = false;
bool force_mode = false;
Expand Down Expand Up @@ -155,6 +156,7 @@ int main(int argc, char *argv[])
} else if(std::strcmp(optarg, "qa") == 0) {
strip_consumer_info = true;
strip_cluster_info = true;
strip_external_auth = true;
} else {
std::cerr << "Unrecognised parameter to -C: " << optarg
<< std::endl;
Expand Down Expand Up @@ -346,6 +348,7 @@ int main(int argc, char *argv[])
p_datadest,
strip_cluster_info,
strip_consumer_info,
strip_external_auth,
run_full_recovery,
comdb2_task,
percent_full,
Expand Down
1 change: 1 addition & 0 deletions tools/comdb2ar/comdb2ar.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void deserialise_database(
const std::string *p_datadestdir,
bool strip_cluster_info,
bool strip_consumer_info,
bool strip_external_auth,
bool run_full_recovery,
const std::string& comdb2_task,
unsigned percent_full,
Expand Down
25 changes: 17 additions & 8 deletions tools/comdb2ar/deserialise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ static void process_lrl(
const std::string& lrltext,
bool strip_cluster_info,
bool strip_consumer_info,
bool strip_external_auth,
std::string& datadestdir,
const std::string& lrldestdir,
std::string& dbname,
Expand Down Expand Up @@ -202,6 +203,14 @@ static void process_lrl(

std::string tok;
if(liness >> tok) {
std::string config_tok(tok);
if(tok == "if") {
std::string machine_type;
liness >> machine_type;
if(!(liness >> config_tok)) {
config_tok.clear();
}
}

if(tok == "name" && dbname.empty()) {
// Get the db name from the first lrl file found,
Expand Down Expand Up @@ -287,18 +296,17 @@ static void process_lrl(
// changes tok, it needs to be the last test
line.insert(0, "# ");
} else if (strip_consumer_info) {
if (tok == "if") {
liness >> tok; /* consume machine type */
liness >> tok; /* read real option */
}

if (tok == "queue" || tok == "procedure" || tok == "consumer")
if (config_tok == "queue" || config_tok == "procedure" ||
config_tok == "consumer")
line.insert(0, "# ");

/* Also strip ssl config from the LRL for QA mode. */
if(strncasecmp(tok.c_str(), "ssl", 3) == 0)
if(strncasecmp(config_tok.c_str(), "ssl", 3) == 0)
line.insert(0, "# ");
}

if(strip_external_auth && config_tok == "externalauth")
line.insert(0, "# ");
}

if(!(of << line << std::endl)) {
Expand Down Expand Up @@ -362,6 +370,7 @@ void deserialise_database(
const std::string *p_datadestdir,
bool strip_cluster_info,
bool strip_consumer_info,
bool strip_external_auth,
bool run_full_recovery,
const std::string& comdb2_task,
unsigned percent_full,
Expand Down Expand Up @@ -886,7 +895,7 @@ void deserialise_database(
} else if (is_lrl) {
std::ostringstream lrldata;
process_lrl(lrldata, filename, text, strip_cluster_info,
strip_consumer_info, datadestdir, lrldestdir, dbname,
strip_consumer_info, strip_external_auth, datadestdir, lrldestdir, dbname,
table_set);
if (!datadestdir.empty()) {
make_dirs(datadestdir);
Expand Down
Loading