public class DataSizes extends Object
| Constructor and Description |
|---|
DataSizes() |
| Modifier and Type | Method and Description |
|---|---|
static long |
getDataSize(Row row)
Evaluates the data size contained in the given row.
|
static long |
getDataSize(Statement<?> stmt,
ProtocolVersion version,
CodecRegistry registry)
Evaluates the data size contained in the given statement.
|
public static long getDataSize(@NonNull
Statement<?> stmt,
@NonNull
ProtocolVersion version,
@NonNull
CodecRegistry registry)
This method can be used to guess if a given batch statement risks to exceed the thresholds
defined server-side in the in the cassandra.yaml
configuration file for the options batch_size_warn_threshold_in_kb and batch_size_fail_threshold_in_kb. But please note that the actual algorithm used by Apache
Cassandra, which can be found in org.apache.cassandra.db.IMutation.dataSize(), cannot
be easily reproduced client-side. Instead, this method follows a more straight-forward
algorithm that may sometimes underestimate or overestimate the size computed server-side.
Also note: this method does NOT follow the algorithm found in the driver's Sizes class; this method attempts to guess
the mutation size server-side, whereas the latter attempts to guess the size of the encoded
statement, protocol-wise. These can be very different, especially for batch statements.
stmt - The statement to inspect; cannot be null.version - The protocol version to use; cannot be null.registry - The codec registry to use; cannot be null.public static long getDataSize(@NonNull
Row row)
row - The row to inspect; cannot be null.Copyright © 2017–2021 DataStax. All rights reserved.