mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
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);
|
ccf = makeReference<ClusterConnectionFile>(resolvedClusterFile.first);
|
||||||
wait(ccf->resolveHostnames());
|
wait(ccf->resolveHostnames());
|
||||||
} catch (Error& e) {
|
} catch (Error& e) {
|
||||||
|
if (e.code() == error_code_operation_cancelled) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
fprintf(stderr, "%s\n", ClusterConnectionFile::getErrorString(resolvedClusterFile, e).c_str());
|
fprintf(stderr, "%s\n", ClusterConnectionFile::getErrorString(resolvedClusterFile, e).c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1236,6 +1239,9 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||||||
wait(delay(3.0) || success(safeThreadFutureToFuture(tr->getReadVersion())));
|
wait(delay(3.0) || success(safeThreadFutureToFuture(tr->getReadVersion())));
|
||||||
break;
|
break;
|
||||||
} catch (Error& e) {
|
} catch (Error& e) {
|
||||||
|
if (e.code() == error_code_operation_cancelled) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
if (e.code() == error_code_cluster_version_changed) {
|
if (e.code() == error_code_cluster_version_changed) {
|
||||||
wait(safeThreadFutureToFuture(tr->onError(e)));
|
wait(safeThreadFutureToFuture(tr->onError(e)));
|
||||||
} else {
|
} else {
|
||||||
@ -2023,6 +2029,9 @@ ACTOR Future<int> cli(CLIOptions opt, LineNoise* plinenoise) {
|
|||||||
TraceEvent(SevInfo, "CLICommandLog", randomID).detail("Command", line).detail("IsError", is_error);
|
TraceEvent(SevInfo, "CLICommandLog", randomID).detail("Command", line).detail("IsError", is_error);
|
||||||
|
|
||||||
} catch (Error& e) {
|
} catch (Error& e) {
|
||||||
|
if (e.code() == error_code_operation_cancelled) {
|
||||||
|
throw;
|
||||||
|
}
|
||||||
if (e.code() == error_code_tenant_name_required) {
|
if (e.code() == error_code_tenant_name_required) {
|
||||||
printAtCol("ERROR: tenant name required. Use the `usetenant' command to select a tenant or enable the "
|
printAtCol("ERROR: tenant name required. Use the `usetenant' command to select a tenant or enable the "
|
||||||
"`RAW_ACCESS' option to read raw keys.",
|
"`RAW_ACCESS' option to read raw keys.",
|
||||||
|
@ -698,9 +698,12 @@ Future<T> safeThreadFutureToFutureImpl(ThreadFuture<T> threadFuture) {
|
|||||||
try {
|
try {
|
||||||
wait(onReady);
|
wait(onReady);
|
||||||
} catch (Error& e) {
|
} 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
|
// prerequisite: we have exclusive ownership of the threadFuture
|
||||||
threadFuture.cancel();
|
if (e.code() == error_code_operation_cancelled) {
|
||||||
|
threadFuture.cancel();
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
// threadFuture should be ready
|
// threadFuture should be ready
|
||||||
|
Loading…
x
Reference in New Issue
Block a user