public interface ExecutionInfo
This can be obtained either from a result set for a successful query, or from a driver exception for a failed query.
Modifier and Type | Method and Description |
---|---|
int |
getCompressedResponseSizeInBytes()
The size of the compressed binary response in bytes.
|
Node |
getCoordinator()
The node that acted as a coordinator for the query.
|
List<Map.Entry<Node,Throwable>> |
getErrors()
The errors encountered on previous coordinators, if any.
|
Map<String,ByteBuffer> |
getIncomingPayload()
The custom payload sent back by the server with the response, if any (otherwise the map will be
empty).
|
ByteBuffer |
getPagingState()
The paging state of the query.
|
default QueryTrace |
getQueryTrace()
Convenience method to call
getQueryTraceAsync() and block for the result. |
CompletionStage<QueryTrace> |
getQueryTraceAsync()
Fetches the query trace asynchronously, if tracing was enabled for this query.
|
default Request |
getRequest() |
int |
getResponseSizeInBytes()
The size of the binary response in bytes.
|
int |
getSpeculativeExecutionCount()
The number of speculative executions that were started for this query.
|
Statement<?> |
getStatement()
Deprecated.
Use
getRequest() instead. |
int |
getSuccessfulExecutionIndex()
The index of the execution that completed this query.
|
UUID |
getTracingId()
The tracing identifier if tracing was
enabled for this query,
otherwise null . |
List<String> |
getWarnings()
The server-side warnings for this query, if any (otherwise the list will be empty).
|
boolean |
isSchemaInAgreement()
Whether the cluster reached schema agreement after the execution of this query.
|
@NonNull @Deprecated Statement<?> getStatement()
getRequest()
instead.Request
that was executed, if it can be cast to Statement
.ClassCastException
- If the request that was executed cannot be cast to Statement
.@Nullable Node getCoordinator()
For successful queries, this is never null
. It is the node that sent the response
from which the result was decoded.
For failed queries, this can either be null
if the error occurred before any node
could be contacted (for example a RequestThrottlingException
), or present if a node was
successfully contacted, but replied with an error response (any subclass of CoordinatorException
).
int getSpeculativeExecutionCount()
This does not include the initial, normal execution of the query. Therefore, if speculative executions are disabled, this will always be 0. If they are enabled and one speculative execution was triggered in addition to the initial execution, this will be 1, etc.
SpeculativeExecutionPolicy
int getSuccessfulExecutionIndex()
0 represents the initial, normal execution of the query, 1 the first speculative execution, etc. If this execution info is attached to an error, this might not be applicable, and will return -1.
SpeculativeExecutionPolicy
@NonNull List<Map.Entry<Node,Throwable>> getErrors()
The list is in chronological order, based on the time that the driver processed the error responses. If speculative executions are enabled, they run concurrently so their errors will be interleaved. A node can appear multiple times (if the retry policy decided to retry on the same node).
@Nullable ByteBuffer getPagingState()
This represents the next page to be fetched if this query has multiple page of results. It can be saved and reused later on the same statement.
null
if there is no next page.@NonNull List<String> getWarnings()
This feature is only available with DefaultProtocolVersion.V4
or above; with lower
versions, this list will always be empty.
@NonNull Map<String,ByteBuffer> getIncomingPayload()
This method returns a read-only view of the original map, but its values remain inherently
mutable. If multiple clients will read these values, care should be taken not to corrupt the
data (in particular, preserve the indices by calling ByteBuffer.duplicate()
).
This feature is only available with DefaultProtocolVersion.V4
or above; with lower
versions, this map will always be empty.
boolean isSchemaInAgreement()
After a successful schema-altering query (ex: creating a table), the driver will check if the cluster's nodes agree on the new schema version. If not, it will keep retrying a few times (the retry delay and timeout are set through the configuration).
If this method returns false
, clients can call Session.checkSchemaAgreement()
later to perform the check manually.
Schema agreement is only checked for schema-altering queries. For other query types, this
method will always return true
.
@Nullable UUID getTracingId()
enabled
for this query,
otherwise null
.@NonNull CompletionStage<QueryTrace> getQueryTraceAsync()
Note that each call to this method triggers a new fetch, even if the previous call was
successful (this allows fetching the trace again if the list of events
was incomplete).
This method will return a failed future if tracing was disabled for the query (that is, if
getTracingId()
is null).
@NonNull default QueryTrace getQueryTrace()
getQueryTraceAsync()
and block for the result.
This must not be called on a driver thread.
IllegalStateException
- if getTracingId()
is null.int getResponseSizeInBytes()
This is the size of the protocol-level frame (including the frame header) before it was decoded by the driver, but after decompression (if compression is enabled).
If the information is not available (for example if this execution info comes from an IGNORE
decision of the retry policy), this method returns -1.
getCompressedResponseSizeInBytes()
int getCompressedResponseSizeInBytes()
This is the size of the protocol-level frame (including the frame header) as it came in the TCP response, before decompression and decoding by the driver.
If compression is disabled, or if the information is not available (for example if this
execution info comes from an IGNORE
decision of the retry policy),
this method returns -1.
getResponseSizeInBytes()
Copyright © 2017–2024. All rights reserved.