public interface ContinuousSession extends Session
Continuous paging is a new method of streaming bulk amounts of records from Datastax Enterprise (DSE) to the Datastax Java Driver, available since DSE 5.1. It is mainly intended to be leveraged by DSE Analytics and Apache Sparkā¢, or by any similar analytics tool that needs to read large portions of a table in one single operation, as quick and reliably as possible.
Continuous paging requires the following three conditions to be met on the client side:
LoadBalancingPolicy
,
then this condition is met);
ONE
(or LOCAL_ONE
).
It's the caller's responsibility to make sure that the above conditions are met. If this is not the case, continuous paging will silently degrade into a normal read operation, and the coordinator will retrieve pages one by one from replicas.
Note that when the continuous paging optimization kicks in (range read at ONE
performed directly on a replica), the snitch is bypassed and the coordinator will always chose
itself as a replica. Therefore, other functionality such as probabilistic read repair and
speculative retry is also not available when contacting a replica at ONE
.
Continuous paging is disabled by default and needs to be activated server-side. See Enabling continuous paging in the DSE docs to learn how to enable it.
OSS_DRIVER_COORDINATES
Modifier and Type | Method and Description |
---|---|
default ContinuousResultSet |
executeContinuously(Statement<?> statement)
Executes the provided query with continuous paging synchronously.
|
default CompletionStage<ContinuousAsyncResultSet> |
executeContinuouslyAsync(Statement<?> statement)
Executes the provided query with continuous paging asynchronously.
|
checkSchemaAgreement, checkSchemaAgreementAsync, execute, getContext, getKeyspace, getMetadata, getMetrics, getName, isSchemaMetadataEnabled, refreshSchema, refreshSchemaAsync, setSchemaMetadataEnabled
close, closeAsync, closeFuture, forceCloseAsync, isClosed
@NonNull default ContinuousResultSet executeContinuously(@NonNull Statement<?> statement)
This method takes care of chaining the successive results into a convenient iterable, provided that you always access the result from the same thread. For more flexibility, consider using the asynchronous variant of this method instead.
statement
- the query to execute.@NonNull default CompletionStage<ContinuousAsyncResultSet> executeContinuouslyAsync(@NonNull Statement<?> statement)
The server will push all requested pages asynchronously, according to the options defined in the current execution profile. The client should consume all pages as quickly as possible, to avoid blocking the server for too long. The server will adjust the rate according to the client speed, but it will give up if the client does not consume any pages in a period of time equal to the read request timeout.
statement
- the query to execute.Copyright © 2017–2019. All rights reserved.