Skip to content

Commit 13ce00c

Browse files
committed
Support frame to segment batching
Previously, the driver encoded each individual frame in a single segment despite segments ability to hold multiple frames. This patch introduces a mechanism that allows driver collect multiple frames before encoding them as a batch. To achieve this, segmentWriter was introduced. Patch by Bohdan Siryk; reviewed by TBD for CASSGO-100
1 parent c65c762 commit 13ce00c

8 files changed

Lines changed: 1275 additions & 666 deletions

File tree

cassandra_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,7 +3300,7 @@ func TestNegativeStream(t *testing.T) {
33003300
return f.finish()
33013301
})
33023302

3303-
frame, err := conn.exec(context.Background(), writer, nil)
3303+
frame, err := conn.execInternal(context.Background(), writer, nil)
33043304
if err == nil {
33053305
t.Fatalf("expected to get an error on stream %d", stream)
33063306
} else if frame != nil {
@@ -3311,7 +3311,9 @@ func TestNegativeStream(t *testing.T) {
33113311
func TestManualQueryPaging(t *testing.T) {
33123312
const rowsToInsert = 5
33133313

3314-
session := createSession(t)
3314+
session := createSession(t, func(cfg *ClusterConfig) {
3315+
cfg.Logger = NewLogger(LogLevelDebug)
3316+
})
33153317
defer session.Close()
33163318

33173319
if err := createTable(session, "CREATE TABLE gocql_test.testManualPaging (id int, count int, PRIMARY KEY (id))"); err != nil {
@@ -4003,18 +4005,18 @@ func TestQueryCompressionNotWorthIt(t *testing.T) {
40034005
session := createSession(t)
40044006
defer session.Close()
40054007

4006-
if err := createTable(session, "CREATE TABLE IF NOT EXISTS gocql_test.compression_now_worth_it(id int, text_col text, PRIMARY KEY (id))"); err != nil {
4008+
if err := createTable(session, "CREATE TABLE IF NOT EXISTS gocql_test.compression_not_worth_it(id int, text_col text, PRIMARY KEY (id))"); err != nil {
40074009
t.Fatal(err)
40084010
}
40094011

40104012
str := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+"
4011-
err := session.Query("INSERT INTO gocql_test.large_size_query (id, text_col) VALUES (?, ?)", "1", str).Exec()
4013+
err := session.Query("INSERT INTO gocql_test.compression_not_worth_it (id, text_col) VALUES (?, ?)", "1", str).Exec()
40124014
if err != nil {
40134015
t.Fatal(err)
40144016
}
40154017

40164018
var result string
4017-
err = session.Query("SELECT text_col FROM gocql_test.large_size_query").Scan(&result)
4019+
err = session.Query("SELECT text_col FROM gocql_test.compression_not_worth_it").Scan(&result)
40184020
if err != nil {
40194021
t.Fatal(err)
40204022
}

0 commit comments

Comments
 (0)