Skip to content

Commit daaa2bc

Browse files
Merge branch 'apache:trunk' into add-support-for-Cassandra-5-0-table-options
2 parents 189a52e + 37030fb commit daaa2bc

File tree

18 files changed

+401
-105
lines changed

18 files changed

+401
-105
lines changed

.asf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ github:
3434
projects: false
3535
autolink_jira:
3636
- CASSANDRA
37+
- CASSGO
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Setup environment
2+
description: Setup environment for integration tests execution
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up cache for SDKMAN
7+
uses: actions/cache@v3
8+
with:
9+
path: ~/.sdkman
10+
key: ${{ runner.os }}-sdkman
11+
12+
- name: Set up cache for PIP
13+
uses: actions/cache@v3
14+
with:
15+
path: ~/.cache/pip
16+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
17+
restore-keys: |
18+
${{ runner.os }}-pip-
19+
20+
- name: Install Java
21+
shell: bash
22+
run: |
23+
echo "Installing SDKMAN..."
24+
curl -s "https://get.sdkman.io" | bash
25+
source "$HOME/.sdkman/bin/sdkman-init.sh"
26+
echo "sdkman_auto_answer=true" >> ~/.sdkman/etc/config
27+
28+
echo "Installing Java versions..."
29+
sdk install java 11.0.24-zulu
30+
sdk install java 17.0.12-zulu
31+
32+
sdk default java 11.0.24-zulu
33+
sdk use java 11.0.24-zulu
34+
35+
echo "JAVA11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
36+
echo "JAVA17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
37+
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
38+
echo "PATH=$PATH" >> $GITHUB_ENV
39+
40+
- name: Install CCM
41+
shell: bash
42+
run: |
43+
echo "Creating Python virtual environment..."
44+
VENV_DIR="$HOME/venv"
45+
python3 -m venv $VENV_DIR
46+
source $VENV_DIR/bin/activate
47+
pip install --upgrade pip setuptools
48+
49+
echo "Installing CCM..."
50+
pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"

.github/workflows/main.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ jobs:
5151
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
5252
restore-keys: |
5353
${{ runner.os }}-go-
54-
- name: Install CCM
55-
run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
54+
- name: Setup environment
55+
uses: ./.github/actions/setup-environment
5656
- name: Start cassandra nodes
5757
run: |
58+
source ~/venv/bin/activate
5859
VERSION=${{ matrix.cassandra_version }}
5960
keypath="$(pwd)/testdata/pki"
6061
conf=(
@@ -107,6 +108,7 @@ jobs:
107108
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
108109
- name: Integration tests
109110
run: |
111+
source ~/venv/bin/activate
110112
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
111113
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
112114
- name: 'Save ccm logs'
@@ -135,10 +137,11 @@ jobs:
135137
- uses: actions/setup-go@v4
136138
with:
137139
go-version: ${{ matrix.go }}
138-
- name: Install CCM
139-
run: pip install "git+https://github.com/riptano/ccm.git@${CCM_VERSION}"
140+
- name: Setup environment
141+
uses: ./.github/actions/setup-environment
140142
- name: Start cassandra nodes
141143
run: |
144+
source ~/venv/bin/activate
142145
VERSION=${{ matrix.cassandra_version }}
143146
keypath="$(pwd)/testdata/pki"
144147
conf=(
@@ -197,5 +200,6 @@ jobs:
197200
sleep 30s
198201
- name: Integration tests
199202
run: |
203+
source ~/venv/bin/activate
200204
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
201205
go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Changed
1212

13+
- Don't restrict server authenticator unless PasswordAuthentictor.AllowedAuthenticators is provided (CASSGO-19)
14+
15+
- Remove global NewBatch function (CASSGO-15)
16+
17+
- Detailed description for NumConns (CASSGO-3)
18+
19+
- Change Batch API to be consistent with Query() (CASSGO-7)
20+
1321
### Fixed
1422

23+
- Retry policy now takes into account query idempotency (CASSGO-27)
24+
- Don't return error to caller with RetryType Ignore (CASSGO-28)
25+
1526
## [1.7.0] - 2024-09-23
1627

1728
This release is the first after the donation of gocql to the Apache Software Foundation (ASF)
1829

1930
### Changed
2031
- Update DRIVER_NAME parameter in STARTUP messages to a different value intended to clearly identify this
21-
driver as an ASF driver. This should clearly distinguish this release (and future gocql-cassandra-driver
32+
driver as an ASF driver. This should clearly distinguish this release (and future cassandra-gocql-driver
2233
releases) from prior versions. (#1824)
2334
- Supported Go versions updated to 1.23 and 1.22 to conform to gocql's sunset model. (#1825)
2435

CONTRIBUTING.md

Lines changed: 88 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,112 @@
11
# Contributing to the Apache Cassandra GoCQL Driver
22

3-
**TL;DR** - this manifesto sets out the bare minimum requirements for submitting a patch to gocql.
3+
**TL;DR** This manifesto sets out the bare minimum requirements for submitting a patch to gocql. It also offers some suggestions to speed up the review, approve and merge process.
44

55
This guide outlines the process of landing patches in gocql and the general approach to maintaining the code base.
66

77
## Background
88

9-
The goal of the gocql project is to provide a stable and robust CQL driver for Go. This is a community driven project that is coordinated by a small team of developers in and around the Apache Cassandra project. For security, governance and administration issues please refer to the Cassandra Project Management Committee.
9+
The goal of the gocql project is to provide a stable and robust CQL driver for Go. This is a community driven project that is coordinated by a small team of developers in and around the Apache Cassandra project. For security, governance and administration issues please refer to the Cassandra Project Management Committee.
10+
11+
## Engage with the community early
12+
13+
If you are interested in contributing a particular feature or bug fix we heavily encourage you to start a discussion with the community or at the very least announce your interest in working on it before jumping right into writing code. It helps reduce the likelihood of multiple people working on the same issue in parallel when they could be collaborating instead. Getting feedback early in the contribution process will also greatly speed up the review, approval and merge process.
14+
15+
Common ways to engage with the GoCQL community are:
16+
17+
- [CASSGO project on ASF JIRA](https://issues.apache.org/jira/projects/CASSGO/issues/)
18+
- Apache Cassandra dev mailing list - [[email protected]](mailto:[email protected])
19+
- [Subscribe](mailto:[email protected])
20+
- [Archives](https://lists.apache.org/[email protected])
21+
- [#cassandra-drivers channel on ASF Slack](https://the-asf.slack.com/archives/C05LPRVNZV1)
1022

1123
## Minimum Requirement Checklist
1224

1325
The following is a check list of requirements that need to be satisfied in order for us to merge your patch:
1426

15-
* You should raise a pull request to apache/cassandra-gocql-driver on Github
16-
* The pull request has a title that clearly summarizes the purpose of the patch
27+
* A JIRA issue exists in the [CASSGO Project](https://issues.apache.org/jira/projects/CASSGO/issues/) for the proposed changes
28+
* If the proposed changes are significant then ideally a discussion about the implementation approach should happen before a PR is even opened (prototyping is fine though)
29+
* Pull request raised to apache/cassandra-gocql-driver on Github
30+
* The pull request has a title that clearly summarizes the purpose of the patch and references the relevant CASSGO JIRA issue if there is one
1731
* The motivation behind the patch is clearly defined in the pull request summary
32+
* JIRA issue is added to the "UNRELEASED" section of CHANGELOG.md
33+
* If there's no JIRA issue yet then the author is encouraged to create it
34+
* If the author is not able to create the JIRA issue then the committer that merges the PR will take care of this (creating the JIRA and adding it to CHANGELOG.md)
35+
* Updating CHANGELOG.md is not required if the change is not "releasable" (e.g. changes to documentation, CI, etc.)
1836
* You agree that your contribution is donated to the Apache Software Foundation (appropriate copyright is on all new files)
1937
* The patch will merge cleanly
2038
* The test coverage does not fall
2139
* The merge commit passes the regression test suite on GitHub Actions
2240
* `go fmt` has been applied to the submitted code
23-
* Notable changes (i.e. new features or changed behavior, bugfixes) are appropriately documented in CHANGELOG.md, functional changes also in godoc
41+
* Functional changes are documented in godoc
2442
* A correctly formatted commit message, see below
2543

26-
If there are any requirements that can't be reasonably satisfied, please state this either on the pull request or as part of discussion on the mailing list. Where appropriate, the core team may apply discretion and make an exception to these requirements.
44+
If there are any requirements that can't be reasonably satisfied, please state this either on the pull request or as part of discussion on the mailing list, JIRA or slack. Where appropriate, the core team may apply discretion and make an exception to these requirements.
2745

2846
## Commit Message
2947

30-
The Apache Cassandra project has a commit message precendence like
48+
The commit message format should be:
49+
3150
```
32-
<One sentence description, usually Jira title or CHANGES.txt summary>
51+
<short description>
52+
53+
<reason why the change is needed>
3354
34-
patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####
55+
Patch by <authors>; reviewed by <Reviewers> for CASSGO-#####
3556
```
3657

37-
The 'patch by …; reviewed by' line is important. It permits our review-than-commit procedure, allowing commits from non-git-branch patches. It is also parsed to build the project contribulyse statistics found [here](https://nightlies.apache.org/cassandra/devbranch/misc/contribulyze/html/).
58+
Short description should:
59+
* Be a short sentence.
60+
* Start with a capital letter.
61+
* Be written in the present tense.
62+
* Summarize what is changed, not why it is changed.
3863

64+
Short description should not:
65+
* End with a period.
66+
* Use the word Fixes . Most commits fix something.
67+
68+
Long description / Reason:
69+
* Should describe why the change is needed. What is fixed by the change? Why it it was broken before? What use case does the new feature solve?
70+
* Consider adding details of other options that you considered when implementing the change and why you made the design decisions you made.
71+
72+
The `patch by …; reviewed by` line is important. It is parsed to build the [project contribulyse statistics](https://nightlies.apache.org/cassandra/devbranch/misc/contribulyze/html/).
73+
74+
Some tips from the Apache Cassandra Project's "How to Commit" documentation: https://cassandra.apache.org/_/development/how_to_commit.html#tips
75+
76+
#### Example commit message:
77+
78+
```
79+
Increase default timeouts to 11s
3980
40-
Background: https://cassandra.apache.org/_/development/how_to_commit.html#tips
81+
Client timeouts need to be higher than server timeouts,
82+
so that work does not accumulate on the server with retries.
83+
If the client timeout is shorter than a server timeout,
84+
the client can start a retry while the original request
85+
is still running on the server.
86+
87+
The default gocql default timeout was lower
88+
than the Cassandra default timeout.
89+
90+
Cassandra has multiple server timeout options,
91+
most of them are less or equal to 10s by default as of Cassandra 4.1:
92+
93+
read_request_timeout 5s
94+
range_request_timeout 10s
95+
write_request_timeout 2s
96+
counter_write_request_timeout 5s
97+
cas_contention_timeout 1s
98+
truncate_request_timeout 60s
99+
request_timeout 10s
100+
101+
Truncate is an uncommon operation, so we can use 11s as the default
102+
timeout.
103+
104+
patch by John Doe, Jane Doe; reviewed by Bob Smith, Jane Smith for CASSGO-#####
105+
```
106+
107+
### Signing commits
108+
109+
Signing commits with a pgp or ssh key is heavily encouraged although not required.
41110

42111
## Beyond The Checklist
43112

@@ -55,8 +124,14 @@ That said, the point of writing tests is to provide a safety net to catch regres
55124

56125
### Sign Off Procedure
57126

58-
Generally speaking, a pull request can get merged by any one of the project's committers. If your change is minor, chances are that one team member will just go ahead and merge it there and then. As stated earlier, suitable test coverage will increase the likelihood that a single reviewer will assess and merge your change. If your change has no test coverage, or looks like it may have wider implications for the health and stability of the library, the reviewer may elect to refer the change to another team member to achieve consensus before proceeding. Therefore, the tighter and cleaner your patch is, the quicker it will go through the review process.
127+
A Pull Request needs +1s from two committers before it can be merged (or one +1 if the author is a committer).
128+
129+
As stated earlier, suitable test coverage will increase the likelihood that a PR will be approved and merged. If your change has no test coverage, or looks like it may have wider implications for the health and stability of the library, the reviewers may elect to refer the change to other members of the community to achieve consensus before proceeding. Therefore, the tighter and cleaner your patch is, the quicker it will go through the review process.
59130

60131
### Supported Features
61132

62-
gocql is a low level wire driver for Cassandra CQL. By and large, we would like to keep the functional scope of the library as narrow as possible. We think that gocql should be tight and focused, and we will be naturally skeptical of things that could just as easily be implemented in a higher layer. Inevitably you will come across something that could be implemented in a higher layer, save for a minor change to the core API. In this instance, please strike up a conversation in the Cassandra community. Chances are we will understand what you are trying to achieve and will try to accommodate this in a maintainable way.
133+
gocql is a low level wire driver for Cassandra CQL. By and large, we would like to keep the functional scope of the library as narrow as possible. We think that gocql should be tight and focused, and we will be naturally skeptical of things that could just as easily be implemented in a higher layer.
134+
135+
Inevitably you will come across something that could be implemented in a higher layer, save for a minor change to the core API. In this instance, please strike up a conversation in the Cassandra community.
136+
137+
Chances are we will understand what you are trying to achieve and will try to accommodate this in a maintainable way.

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Piotr Dulikowski <[email protected]>
163163
Árni Dagur <[email protected]> *
164164
Tushar Das <[email protected]> *
165165
Maxim Vladimirskiy <[email protected]> *
166-
Bogdan-Ciprian Rusu <[email protected]>
166+
Bogdan-Ciprian Rusu <[email protected]> *
167167
Yuto Doi <[email protected]> *
168168
Krishna Vadali <[email protected]>
169169
Jens-W. Schicke-Uffmann <[email protected]> *

batch_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ func TestBatch_Errors(t *testing.T) {
4747
t.Fatal(err)
4848
}
4949

50-
b := session.NewBatch(LoggedBatch)
51-
b.Query("SELECT * FROM batch_errors WHERE id=2 AND val=?", nil)
52-
if err := session.ExecuteBatch(b); err == nil {
50+
b := session.Batch(LoggedBatch)
51+
b = b.Query("SELECT * FROM gocql_test.batch_errors WHERE id=2 AND val=?", nil)
52+
if err := b.Exec(); err == nil {
5353
t.Fatal("expected to get error for invalid query in batch")
5454
}
5555
}
@@ -68,15 +68,17 @@ func TestBatch_WithTimestamp(t *testing.T) {
6868

6969
micros := time.Now().UnixNano()/1e3 - 1000
7070

71-
b := session.NewBatch(LoggedBatch)
71+
b := session.Batch(LoggedBatch)
7272
b.WithTimestamp(micros)
73-
b.Query("INSERT INTO batch_ts (id, val) VALUES (?, ?)", 1, "val")
74-
if err := session.ExecuteBatch(b); err != nil {
73+
b = b.Query("INSERT INTO gocql_test.batch_ts (id, val) VALUES (?, ?)", 1, "val")
74+
b = b.Query("INSERT INTO gocql_test.batch_ts (id, val) VALUES (?, ?)", 2, "val")
75+
76+
if err := b.Exec(); err != nil {
7577
t.Fatal(err)
7678
}
7779

7880
var storedTs int64
79-
if err := session.Query(`SELECT writetime(val) FROM batch_ts WHERE id = ?`, 1).Scan(&storedTs); err != nil {
81+
if err := session.Query(`SELECT writetime(val) FROM gocql_test.batch_ts WHERE id = ?`, 1).Scan(&storedTs); err != nil {
8082
t.Fatal(err)
8183
}
8284

0 commit comments

Comments
 (0)