Add lock command to fdbcli
This commit is contained in:
parent
f92ef730a4
commit
bb6a8bf7ab
|
@ -211,6 +211,10 @@ The following options are available for use with the ``option`` command:
|
|||
|
||||
``TIMEOUT`` - Set a timeout in milliseconds which, when elapsed, will cause the transaction automatically to be cancelled. Valid parameter values are ``[0, INT_MAX]``. If set to 0, will disable all timeouts. All pending and any future uses of the transaction will throw an exception. The transaction can be used again after it is reset. Like all transaction options, a timeout must be reset after a call to ``onError``. This behavior allows the user to make the timeouts dynamic.
|
||||
|
||||
lock
|
||||
----
|
||||
|
||||
The ``lock`` command locks the database with a randomly generated lockUID.
|
||||
|
||||
include
|
||||
-------
|
||||
|
|
|
@ -565,6 +565,10 @@ void initHelp() {
|
|||
"consistencycheck [on|off]",
|
||||
"permits or prevents consistency checking",
|
||||
"Calling this command with `on' permits consistency check processes to run and `off' will halt their checking. Calling this command with no arguments will display if consistency checking is currently allowed.\n");
|
||||
helpMap["lock"] = CommandHelp(
|
||||
"lock",
|
||||
"lock the database with a randomly generated lockUID",
|
||||
"Randomly generates a lockUID, prints this lockUID, and then uses the lockUID to lock the database.");
|
||||
|
||||
hiddenCommands.insert("expensive_data_check");
|
||||
hiddenCommands.insert("datadistribution");
|
||||
|
@ -2973,6 +2977,19 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (tokencmp(tokens[0], "lock")) {
|
||||
if (tokens.size() != 1) {
|
||||
printUsage(tokens[0]);
|
||||
is_error = true;
|
||||
} else {
|
||||
state UID lockUID = deterministicRandom()->randomUniqueID();
|
||||
printf("Locking database with lockUID: %s\n", lockUID.toString().c_str());
|
||||
wait(makeInterruptable(lockDatabase(db, lockUID)));
|
||||
printf("Database locked.\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tokencmp(tokens[0], "setclass")) {
|
||||
if (tokens.size() != 3 && tokens.size() != 1) {
|
||||
printUsage(tokens[0]);
|
||||
|
|
Loading…
Reference in New Issue