Skip to content

Commit 6b45c42

Browse files
committed
Merge branch 'trunk' into logging
# Conflicts: # metadata.go # metadata_test.go
2 parents 12c71b0 + 90bcc9c commit 6b45c42

24 files changed

+722
-1378
lines changed

.github/actions/setup-environment/action.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 62 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
pull_request:
88
types: [ opened, synchronize, reopened ]
99

10-
env:
11-
CCM_VERSION: "4621dfee5ad73956b831091a8b863d100d25c610"
12-
1310
jobs:
1411
build:
1512
name: Unit tests
@@ -22,9 +19,11 @@ jobs:
2219
- uses: actions/setup-go@v4
2320
with:
2421
go-version: ${{ matrix.go }}
25-
- run: go vet ./...
22+
- name: Run linting
23+
run: make check
2624
- name: Run unit tests
27-
run: go test -v -tags unit -race ./...
25+
run: make test-unit
26+
2827
integration-cassandra:
2928
timeout-minutes: 15
3029
needs:
@@ -45,82 +44,51 @@ jobs:
4544
compressor: "snappy"
4645
steps:
4746
- uses: actions/checkout@v2
48-
- uses: actions/setup-go@v2
47+
48+
- uses: actions/setup-go@v5
4949
with:
5050
go-version: ${{ matrix.go }}
51-
- uses: actions/cache@v4
52-
id: gomod-cache
53-
with:
54-
path: ~/go/pkg/mod
55-
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
56-
restore-keys: |
57-
${{ runner.os }}-go-
58-
- name: Setup environment
59-
uses: ./.github/actions/setup-environment
60-
- name: Start cassandra nodes
61-
run: |
62-
source ~/venv/bin/activate
63-
VERSION=${{ matrix.cassandra_version }}
64-
keypath="$(pwd)/testdata/pki"
65-
conf=(
66-
"client_encryption_options.enabled: true"
67-
"client_encryption_options.keystore: $keypath/.keystore"
68-
"client_encryption_options.keystore_password: cassandra"
69-
"client_encryption_options.require_client_auth: true"
70-
"client_encryption_options.truststore: $keypath/.truststore"
71-
"client_encryption_options.truststore_password: cassandra"
72-
"concurrent_reads: 2"
73-
"concurrent_writes: 2"
74-
"write_request_timeout_in_ms: 5000"
75-
"read_request_timeout_in_ms: 5000"
76-
)
77-
78-
if [[ $VERSION == 3.*.* ]]; then
79-
conf+=(
80-
"rpc_server_type: sync"
81-
"rpc_min_threads: 2"
82-
"rpc_max_threads: 2"
83-
"enable_user_defined_functions: true"
84-
"enable_materialized_views: true"
85-
)
86-
elif [[ $VERSION == 4.0.* ]]; then
87-
conf+=(
88-
"enable_user_defined_functions: true"
89-
"enable_materialized_views: true"
90-
)
91-
else
92-
conf+=(
93-
"user_defined_functions_enabled: true"
94-
"materialized_views_enabled: true"
95-
)
96-
fi
9751

98-
ccm remove test || true
99-
100-
ccm create test -v $VERSION -n 3 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
101-
ccm updateconf "${conf[@]}"
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.10'
55+
cache: 'pip'
56+
cache-dependency-path: Makefile
10257

103-
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
58+
- name: Set up cache for SDKMAN
59+
uses: actions/cache@v3
60+
with:
61+
path: ~/.sdkman
62+
key: ${{ runner.os }}-sdkman
10463

105-
ccm start --wait-for-binary-proto --verbose
106-
ccm status
107-
ccm node1 nodetool status
64+
- name: Set up cache for CCM
65+
uses: actions/cache@v4
66+
with:
67+
path: ~/.ccm/repository
68+
key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }}
10869

109-
args="-gocql.timeout=60s -runssl -proto=${{ matrix.proto_version }} -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
70+
- name: Start cassandra nodes
71+
env:
72+
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
73+
run: |
74+
make cassandra-start
75+
sleep 30s
11076
111-
echo "args=$args" >> $GITHUB_ENV
112-
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
11377
- name: Integration tests
78+
env:
79+
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
80+
TEST_CQL_PROTOCOL: ${{ matrix.proto_version }}
81+
TEST_COMPRESSOR: ${{ matrix.compressor }}
82+
TEST_INTEGRATION_TAGS: ${{ matrix.tags }}
11483
run: |
115-
source ~/venv/bin/activate
116-
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
117-
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
84+
make test-integration
85+
11886
- name: 'Save ccm logs'
11987
if: 'failure()'
12088
uses: actions/upload-artifact@v4
12189
with:
12290
name: ccm-cluster-cassandra-${{ matrix.cassandra_version }}-go-${{ matrix.go }}-tag-${{ matrix.tags }}-proto-version-${{ matrix.proto_version }}-compressor-${{ matrix.compressor }}
123-
path: /home/runner/.ccm/test
91+
path: /home/runner/.ccm/gocql_integration_test
12492
retention-days: 5
12593
integration-auth-cassandra:
12694
timeout-minutes: 15
@@ -144,69 +112,37 @@ jobs:
144112
- uses: actions/setup-go@v4
145113
with:
146114
go-version: ${{ matrix.go }}
147-
- name: Setup environment
148-
uses: ./.github/actions/setup-environment
149-
- name: Start cassandra nodes
150-
run: |
151-
source ~/venv/bin/activate
152-
VERSION=${{ matrix.cassandra_version }}
153-
keypath="$(pwd)/testdata/pki"
154-
conf=(
155-
"client_encryption_options.enabled: true"
156-
"client_encryption_options.keystore: $keypath/.keystore"
157-
"client_encryption_options.keystore_password: cassandra"
158-
"client_encryption_options.require_client_auth: true"
159-
"client_encryption_options.truststore: $keypath/.truststore"
160-
"client_encryption_options.truststore_password: cassandra"
161-
"concurrent_reads: 2"
162-
"concurrent_writes: 2"
163-
"write_request_timeout_in_ms: 5000"
164-
"read_request_timeout_in_ms: 5000"
165-
"authenticator: PasswordAuthenticator"
166-
"authorizer: CassandraAuthorizer"
167-
"enable_user_defined_functions: true"
168-
)
169-
170-
if [[ $VERSION == 3.*.* ]]; then
171-
conf+=(
172-
"rpc_server_type: sync"
173-
"rpc_min_threads: 2"
174-
"rpc_max_threads: 2"
175-
"enable_user_defined_functions: true"
176-
"enable_materialized_views: true"
177-
)
178-
elif [[ $VERSION == 4.0.* ]]; then
179-
conf+=(
180-
"enable_user_defined_functions: true"
181-
"enable_materialized_views: true"
182-
)
183-
else
184-
conf+=(
185-
"user_defined_functions_enabled: true"
186-
"materialized_views_enabled: true"
187-
)
188-
fi
189-
190-
ccm remove test || true
191-
192-
ccm create test -v $VERSION -n 1 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
193-
ccm updateconf "${conf[@]}"
194-
195-
rm -rf $HOME/.ccm/test/node1/data/system_auth
196115

197-
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
116+
- uses: actions/setup-python@v5
117+
with:
118+
python-version: '3.10'
119+
cache: 'pip'
120+
cache-dependency-path: Makefile
198121

199-
ccm start --wait-for-binary-proto --verbose
200-
ccm status
201-
ccm node1 nodetool status
122+
- name: Set up cache for SDKMAN
123+
uses: actions/cache@v3
124+
with:
125+
path: ~/.sdkman
126+
key: ${{ runner.os }}-sdkman
202127

203-
args="-gocql.timeout=60s -runssl -proto=${{ matrix.proto_version }} -rf=3 -clusterSize=1 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
128+
- name: Set up cache for CCM
129+
uses: actions/cache@v4
130+
with:
131+
path: ~/.ccm/repository
132+
key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }}
204133

205-
echo "args=$args" >> $GITHUB_ENV
206-
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
134+
- name: Start cassandra nodes
135+
env:
136+
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
137+
run: |
138+
make cassandra-start
207139
sleep 30s
140+
208141
- name: Integration tests
142+
env:
143+
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
144+
TEST_CQL_PROTOCOL: ${{ matrix.proto_version }}
145+
TEST_COMPRESSOR: ${{ matrix.compressor }}
146+
TEST_INTEGRATION_TAGS: ${{ matrix.tags }}
209147
run: |
210-
source ~/venv/bin/activate
211-
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
212-
go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}
148+
make test-integration-auth

.golangci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: "2"
2+
3+
issues:
4+
max-same-issues: 50
5+
6+
formatters:
7+
enable:
8+
- goimports
9+
10+
settings:
11+
goimports:
12+
local-prefixes:
13+
- github.com/gocql/gocql
14+
- github.com/apache/cassandra-gocql-driver
15+
golines:
16+
max-len: 120
17+
18+
linters:
19+
default: none
20+
enable:
21+
- nolintlint
22+
- govet
23+
settings:
24+
govet:
25+
enable-all: true
26+
disable:
27+
- shadow
28+
- fieldalignment
29+
30+
nolintlint:
31+
allow-no-explanation: [ golines ]
32+
require-explanation: true
33+
require-specific: true

CHANGELOG.md

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,36 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [2.0.0] - Unreleased
99

10-
### Added
10+
### Removed
1111

12-
- Support vector type [CASSGO-11](https://issues.apache.org/jira/browse/CASSGO-11)
12+
- Drop support for old CQL protocol versions: 1 and 2 (CASSGO-75)
1313

14-
- Allow SERIAL and LOCAL_SERIAL on SELECT statements [CASSGO-26](https://issues.apache.org/jira/browse/CASSGO-26)
14+
### Added
1515

16+
- Support vector type (CASSGO-11)
17+
- Allow SERIAL and LOCAL_SERIAL on SELECT statements (CASSGO-26)
1618
- Support of sending queries to the specific node with Query.SetHostID() (CASSGO-4)
17-
18-
- Support for Native Protocol 5. Following protocol changes exposed new API
19-
Query.SetKeyspace(), Query.WithNowInSeconds(), Batch.SetKeyspace(), Batch.WithNowInSeconds() (CASSGO-1)
19+
- Support for Native Protocol 5 (CASSGO-1)
2020

2121
### Changed
2222

2323
- Move lz4 compressor to lz4 package within the gocql module (CASSGO-32)
24-
2524
- Don't restrict server authenticator unless PasswordAuthentictor.AllowedAuthenticators is provided (CASSGO-19)
26-
2725
- Cleanup of deprecated elements (CASSGO-12)
28-
2926
- Remove global NewBatch function (CASSGO-15)
30-
3127
- Detailed description for NumConns (CASSGO-3)
32-
3328
- Change Batch API to be consistent with Query() (CASSGO-7)
34-
3529
- Added Cassandra 4.0 table options support(CASSGO-13)
36-
3730
- Remove deprecated global logger (CASSGO-24)
38-
3931
- Bumped actions/upload-artifact and actions/cache versions to v4 in CI workflow (CASSGO-48)
40-
4132
- Keep nil slices in MapScan (CASSGO-44)
42-
4333
- Improve error messages for marshalling (CASSGO-38)
44-
4534
- Remove HostPoolHostPolicy from gocql package (CASSGO-21)
46-
4735
- Standardized spelling of datacenter (CASSGO-35)
48-
4936
- Refactor HostInfo creation and ConnectAddress() method (CASSGO-45)
50-
5137
- gocql.Compressor interface changes to follow append-like design. Bumped Go version to 1.19 (CASSGO-1)
52-
5338
- Refactoring hostpool package test and Expose HostInfo creation (CASSGO-59)
5439

5540
- Move "execute batch" methods to Batch type (CASSGO-57)
@@ -60,16 +45,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6045

6146
### Fixed
6247
- Cassandra version unmarshal fix (CASSGO-49)
63-
6448
- Retry policy now takes into account query idempotency (CASSGO-27)
65-
6649
- Don't return error to caller with RetryType Ignore (CASSGO-28)
6750
- The marshalBigInt return 8 bytes slice in all cases except for big.Int,
6851
which returns a variable length slice, but should be 8 bytes slice as well (CASSGO-2)
69-
7052
- Skip metadata only if the prepared result includes metadata (CASSGO-40)
71-
7253
- Don't panic in MapExecuteBatchCAS if no `[applied]` column is returned (CASSGO-42)
54+
- Fix deadlock in refresh debouncer stop (CASSGO-41)
55+
56+
- Endless query execution fix (CASSGO-50)
7357

7458
## [1.7.0] - 2024-09-23
7559

0 commit comments

Comments
 (0)