[
https://issues.apache.org/jira/browse/CASSGO-100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
João Reis reassigned CASSGO-100:
--------------------------------
Assignee: Bohdan Siryk
> Add frames batching into a single segment
> -----------------------------------------
>
> Key: CASSGO-100
> URL: https://issues.apache.org/jira/browse/CASSGO-100
> Project: Apache Cassandra Go driver
> Issue Type: Improvement
> Components: Core
> Reporter: Bohdan Siryk
> Assignee: Bohdan Siryk
> Priority: Normal
> Fix For: 2.x
>
>
> Support for protocol v5 was introduced in CASSGO-1. However, a current
> implementation lacks the batching feature of proto v5, which allows wrapping
> multiple frames into a single *self-contained* segment. It allows the driver
> to reduce the number of messages to the C*.
> Currently, gocql wraps frames into a segment/segments as [a part of the
> framer|https://github.com/apache/cassandra-gocql-driver/blob/f1e31a58f7e0c25e58e2e2a0a0c6de358e643e8b/frame.go#L2390],
> which is not the right way to handle this. Ideally, we should have a wrapper
> around {_}writerContext{_}, which is responsible for preparing segments and
> probably passing them to the writeCoalescer...
> So the call chain would be:
> Conn.execInternal() -> segmentWriter.writeContext()
> ->writeCoalscer.writeContext() -> etc.
> However, I'm unsure what it should look like from a design perspective.
> Currently, _writeCoalscer_ in a separate go-routine runs a timer with a
> {_}WriteCoalesceWaitTime{_}, and for each tick, it triggers flushing of the
> underlying frame buffers, which are populated by
> _writeCoalscer.writeContext()_ method... So, actually making a wrapper around
> the _writeCoalescer_ won't allow us to reuse the existing flush-by-time
> approach, as segmentWriter will have its own internal state.
> I see 2 potential approaches to resolve this:
> # Implement segmentWriter with coalesce to trigger flushing segments. The
> problem here is that we introduce a new writer who won't reuse existing
> _writeCoalscer_
> # Refactor writeContext to take a data provider instead of a raw bytes slice
> to play around with this, which is a much more complex change
> Reference in Java Driver:
> [https://github.com/apache/cassandra-java-driver/blob/595cb29912dc8b55663cc13bafe3f17dc4f91ce6/core/src/main/java/com/datastax/oss/driver/internal/core/protocol/ByteBufSegmentBuilder.java#L39]
> [https://github.com/apache/cassandra-java-driver/blob/595cb29912dc8b55663cc13bafe3f17dc4f91ce6/core/src/main/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandler.java#L386]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]