Fix an ASSERT when an fdbcli command times out (#6857)
* Re-throw operation_cancelled There's a few places in fdbcli where we don't rethrow operation cancelled but wait on a future. It's very unusual that you don't want to rethrow operation_cancelled. * Update ASSERT It's possible to get error_code_broken_promise here if the network has already shutdown.
This commit is contained in:
parent
218ab6377c
commit
29cf5f1fbf
|
@ -1191,6 +1191,9 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
ccf = makeReference<ClusterConnectionFile>(resolvedClusterFile.first);
|
||||
wait(ccf->resolveHostnames());
|
||||
} catch (Error& e) {
|
||||
if (e.code() == error_code_operation_cancelled) {
|
||||
throw;
|
||||
}
|
||||
fprintf(stderr, "%s\n", ClusterConnectionFile::getErrorString(resolvedClusterFile, e).c_str());
|
||||
return 1;
|
||||
}
|
||||
|
@ -1236,6 +1239,9 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
wait(delay(3.0) || success(safeThreadFutureToFuture(tr->getReadVersion())));
|
||||
break;
|
||||
} catch (Error& e) {
|
||||
if (e.code() == error_code_operation_cancelled) {
|
||||
throw;
|
||||
}
|
||||
if (e.code() == error_code_cluster_version_changed) {
|
||||
wait(safeThreadFutureToFuture(tr->onError(e)));
|
||||
} else {
|
||||
|
@ -2023,6 +2029,9 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||
TraceEvent(SevInfo, "CLICommandLog", randomID).detail("Command", line).detail("IsError", is_error);
|
||||
|
||||
} catch (Error& e) {
|
||||
if (e.code() == error_code_operation_cancelled) {
|
||||
throw;
|
||||
}
|
||||
if (e.code() == error_code_tenant_name_required) {
|
||||
printAtCol("ERROR: tenant name required. Use the `usetenant' command to select a tenant or enable the "
|
||||
"`RAW_ACCESS' option to read raw keys.",
|
||||
|
|
|
@ -698,9 +698,12 @@ Future<T> safeThreadFutureToFutureImpl(ThreadFuture<T> threadFuture) {
|
|||
try {
|
||||
wait(onReady);
|
||||
} catch (Error& e) {
|
||||
ASSERT(e.code() == error_code_actor_cancelled);
|
||||
// broken_promise can be thrown if the network is already shut down
|
||||
ASSERT(e.code() == error_code_operation_cancelled || e.code() == error_code_broken_promise);
|
||||
// prerequisite: we have exclusive ownership of the threadFuture
|
||||
threadFuture.cancel();
|
||||
if (e.code() == error_code_operation_cancelled) {
|
||||
threadFuture.cancel();
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
// threadFuture should be ready
|
||||
|
|
Loading…
Reference in New Issue