public class WriteFailureException extends QueryConsistencyException
This happens when some of the replicas that were contacted by the coordinator replied with an error.
This exception is processed by RetryPolicy.onErrorResponseVerdict(Request,
CoordinatorException, int)
, which will decide if it is rethrown directly to the client or if the
request should be retried. If all other tried nodes also fail, this exception will appear in the
AllNodesFailedException
thrown to the client.
Constructor and Description |
---|
WriteFailureException(Node coordinator,
ConsistencyLevel consistencyLevel,
int received,
int blockFor,
WriteType writeType,
int numFailures,
Map<InetAddress,Integer> reasonMap) |
Modifier and Type | Method and Description |
---|---|
DriverException |
copy()
Copy the exception.
|
int |
getNumFailures()
Returns the number of replicas that experienced a failure while executing the request.
|
Map<InetAddress,Integer> |
getReasonMap()
Returns the a failure reason code for each node that failed.
|
WriteType |
getWriteType()
The type of the write for which this failure was raised.
|
getBlockFor, getConsistencyLevel, getReceived
getCoordinator
getExecutionInfo, setExecutionInfo
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public WriteFailureException(@NonNull Node coordinator, @NonNull ConsistencyLevel consistencyLevel, int received, int blockFor, @NonNull WriteType writeType, int numFailures, @NonNull Map<InetAddress,Integer> reasonMap)
@NonNull public WriteType getWriteType()
public int getNumFailures()
@NonNull public Map<InetAddress,Integer> getReasonMap()
At the time of writing, the existing reason codes are:
0x0000
: the error does not have a specific code assigned yet, or the cause is
unknown.
0x0001
: The read operation scanned too many tombstones (as defined by tombstone_failure_threshold
in cassandra.yaml
, causing a TombstoneOverwhelmingException
.
This feature is available for protocol v5 or above only. With lower protocol versions, the map will always be empty.
@NonNull public DriverException copy()
DriverException
This returns a new exception, equivalent to the original one, except that because a new object is created in the current thread, the top-most element in the stacktrace of the exception will refer to the current thread. The original exception may or may not be included as the copy's cause, depending on whether that is deemed useful (this is left to the discretion of each implementation).
This is intended for the synchronous wrapper methods of the driver, in order to produce a more user-friendly stack trace (that includes the line in the user code where the driver rethrew the error).
copy
in class DriverException
Copyright © 2017–2024. All rights reserved.