[
https://issues.apache.org/jira/browse/CASSGO-98?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18039189#comment-18039189
]
Bohdan Siryk edited comment on CASSGO-98 at 11/18/25 3:19 PM:
--------------------------------------------------------------
{quote}I didn't pick this up yet so feel free to do so\{quote}
{quote}
Cool, I'll start working on this
{quote}I believe that's not enough because that flag is actually what's checked
to see if the segment needs to be compressed.\{quote}
Is this correct? This _framer.finish()_ (1) method is responsible for finishing
frame construction, which includes compressing its body and writing its length
in the header. But compressing here happens only in the case when the proto is
> 4:
{code:java}
if f.proto < protoVersion5 && f.buf[1]&flagCompress == flagCompress {
if f.compres == nil {
panic("compress flag set with no compressor")
}
// TODO: only compress frames which are big enough
compressed, err := f.compres.AppendCompressedWithLength(nil,
f.buf[frameHeadSize:])
if err != nil {
return err
}
f.buf = append(f.buf[:frameHeadSize], compressed...)
}
length := len(f.buf) - frameHeadSize
f.setLength(length) {code}
Compressing of v5 frames happens in _framer.prapareModernLayout()_ (2) __
method:
{code:java}
// Process the buffer in chunks if it exceeds the max payload size
for len(f.buf) > maxSegmentPayloadSize {
if f.compres != nil {
tempBuf, err = newCompressedSegment(f.buf[:maxSegmentPayloadSize],
false, f.compres)
} else {
tempBuf, err = newUncompressedSegment(f.buf[:maxSegmentPayloadSize],
false)
}
if err != nil {
return err
}
adjustedBuf = append(adjustedBuf, tempBuf...)
f.buf = f.buf[maxSegmentPayloadSize:]
selfContained = false
} {code}
It relies on _f.compres !=_ nil condition, not on the compression flag of a
frame.
Probably I missed something?
(1)
[https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/frame.go#L811]
(2)
[https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/frame.go#L2397]
was (Author: JIRAUSER306087):
{quote}I didn't pick this up yet so feel free to do so\{quote}
Cool, I'll start working on this
{quote}I believe that's not enough because that flag is actually what's checked
to see if the segment needs to be compressed.\{quote}
Is this correct? This _framer.finish()_ (1) method is responsible for finishing
frame construction, which includes compressing its body and writing its length
in the header. But compressing here happens only in the case when the proto is
> 4:
{code:java}
if f.proto < protoVersion5 && f.buf[1]&flagCompress == flagCompress {
if f.compres == nil {
panic("compress flag set with no compressor")
}
// TODO: only compress frames which are big enough
compressed, err := f.compres.AppendCompressedWithLength(nil,
f.buf[frameHeadSize:])
if err != nil {
return err
}
f.buf = append(f.buf[:frameHeadSize], compressed...)
}
length := len(f.buf) - frameHeadSize
f.setLength(length) {code}
Compressing of v5 frames happens in _framer.prapareModernLayout()_ (2) __
method:
{code:java}
// Process the buffer in chunks if it exceeds the max payload size
for len(f.buf) > maxSegmentPayloadSize {
if f.compres != nil {
tempBuf, err = newCompressedSegment(f.buf[:maxSegmentPayloadSize],
false, f.compres)
} else {
tempBuf, err = newUncompressedSegment(f.buf[:maxSegmentPayloadSize],
false)
}
if err != nil {
return err
}
adjustedBuf = append(adjustedBuf, tempBuf...)
f.buf = f.buf[maxSegmentPayloadSize:]
selfContained = false
} {code}
It relies on _f.compres !=_ nil condition, not on the compression flag of a
frame.
Probably I missed something?
(1)
[https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/frame.go#L811]
(2)
[https://github.com/apache/cassandra-gocql-driver/blob/0326fae3617dd19b901f2e9a97479c04fc11e05a/frame.go#L2397]
> Frame compression header is being set with v5
> ---------------------------------------------
>
> Key: CASSGO-98
> URL: https://issues.apache.org/jira/browse/CASSGO-98
> Project: Apache Cassandra Go driver
> Issue Type: Bug
> Components: Core
> Reporter: João Reis
> Assignee: Bohdan Siryk
> Priority: Normal
> Fix For: 2.x
>
>
> In protocol v5 the frame (v5 envelope) compression header flag should be
> ignored because compression happens at segment (v5 frame) level. The frame
> body itself is not compressed so this is a bug.
> This was found when trying to connect to
> [ZDM-Proxy|https://github.com/datastax/zdm-proxy/] but connecting to a C*
> 5.0.x cluster works fine (I assume C* is ignoring this flag completely when
> it's a v5 frame).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]