57 Patch |
5 Review |
34fdeebefcbf183ed7f916f931aa0586fdaa1b40,
12249c42030003a1b78e80cd0c8c2facf01fa6e4,
7a686db6d366bb536c0abce24749af6b33cdd574,
64175cf2bdc63dfaeee16b3604cc76afc2ddbe50,
d4a7befd0a6fc713afedc2256fb4811272313551,
46ebac819ea1ba5efb9e1078b293114815af9e26,
c27e8098fa3e9e2d59e114a63e8d09f3729fc472,
86b5752ed989e8bd1f0e551987a21480000ddabe,
640e5ffe9e3a91d6a035f837d045e3ab5e5b0f02,
66d2761ccde7c5d840ecc0c97102107f4bb90def,
4367d090becb1a32ec585e539e70e62e5235594e,
87a7661401e9f9c08066f1ac8feaf9a88478d789,
3fba474ba052eb3b587a0d6ef14e451294a8311f,
a596d4823d65f246922ad7c40caa99da47f9cc29,
0c281799332f4289766b7e89e52ec837a0750a52,
b90e2262db63962f3a7771dff80f003ae00b89b9,
ebdebffd7952d8ac747e1c6e883aa5d8f810248f,
1697467c840844ed218220e80d71fd852250141b,
ea9b541d083f821e8d74d0d00304fc4554bfd990,
6a82cb4542e249a7c3789343f314838eba8b72b3,
ef327e7c4180ebec920007b96c20ea818e4dd28e,
214d08cda3f729bfaa515ce416dad3e68e0ae06e,
4e63a44d15d40bd1a5b405d3f6030833e318e4b4,
93bf3da72368850af8e46bf1ed164487fe9bc166,
b8c4e1605a585c110d073b5391929755442c51a2,
32d95025ae4e4c28af9be09e85a2ac3dcfb2b393,
1c9ec8f651a2f47e2ac7d7b7e5030b1a6d7a2575,
9ba73717a93897876ef305c77daf4df440de8f90,
e557c0877889384c123329d19ffdd062c636a523,
b25227efea00fa55cda33b28629099bafb08b43a,
381f54556395531a8905a42d54ca357f70966769,
fe55d80b186e16ef11ea79c0cd98065d85886cbe,
c18067a2fb951be118df03ce3a72b7cac8653ec3,
11364d2122af1eb310fa90c97e37fb9c8dda27aa,
53b2437c2bb49994ca6b3bf8974b40f5857174dd,
9cf1e71082de020c21f52a2f77803c4688f578f8,
a1cb849f8513e4644d9500e6d504a3dfeb1156b2,
f13c8b9eb1453ebcaa4bb54b662294f80eae9b5e,
d2ed1bb74f3118a83a352e9ce912be765001efa4,
4650c4d67e1eb2c3ab3587691a41510c4c97a0fc,
66ec1520631c9e3b9b40777d2febd537e09ddaaa,
ae365faf08fb5f4d02bf828fd155fa5109c59a6b,
4d42aa3a5f690598a34453ba94f5a379c83f5c94,
473180d4afd379efd8f069edf4389bf2c0b7c96a,
88fc872e0f99c188e432e2f3be5749593ef65e14,
a5b0ab9200e66350d1b6d8e958026e6f60c16424,
7525cfce1751002e228799467681812d6bb12516,
a58c656e1e06b7b66fc42de7cd84879e04e023cf,
d6ea6644a25d97399c95bdae31058da08013c034,
a61f47f6585ad45068e6ac6f1a75d26300a068b0,
4e5ba558b809cdaea4b4fb777662520b370b703b,
2edce5845d60e95ed1d8d19db1fe400680bc6265,
1268384b22aeea6ae7f83661763abb24bc7f951d,
830d6d032ff1e63d47566a436beb5fcbd630ec69,
344f583233efdf6d48b4091ea6c6a0b70d48514c,
4ee4f6240fc424bfff102846d0f99222db1376d8,
73e4d19fd77f743f76f519e16bf61fc5add70cf2 |
80ea0eb24a0fa66134af6f7f4b38a82e352b3b83,
8194fec699eeed85c1b472699dcb051b6792c136,
16009b37a142e05a479cc778dffd2255c393ceb2,
55a25911e5d2e1d481a43c75b28da1a9e955c0d0,
e83bb39fa76524ed6b375fa9d256ca2b55d4b9df |
80ea0eb24a0fa66134af6f7f4b38a82e352b3b83 | Author: mck <mck@apache.org>
| 2024-09-06 07:36:46+02:00
Mark Marcus King and Jens-W. Schicke-Uffmann as agreed to donate contributions to ASF
ref: https://github.com/apache/cassandra-gocql-driver/issues/1751
patch by Mick Semb Wever; reviewed by Martin Sucha for CASSANDRA-19723
8194fec699eeed85c1b472699dcb051b6792c136 | Author: mck <mck@apache.org>
| 2024-08-24 10:52:53+02:00
Mark Michael Highstead, Oliver Boyle and Bartosz Burclaf, as agreed to donate contributions to ASF
ref: https://github.com/apache/cassandra-gocql-driver/issues/1751
patch by Mick Semb Wever; reviewed by Martin Sucha for CASSANDRA-19723
16009b37a142e05a479cc778dffd2255c393ceb2 | Author: mck <mck@apache.org>
| 2024-07-30 21:08:02+02:00
Add .asf.yml
follows same settings as cassandra-java-driver, with the exception that GH issues are still enabled.
patch by Mick Semb Wever; reviewed by Martin Sucha for CASSANDRA-19799
12249c42030003a1b78e80cd0c8c2facf01fa6e4 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-08-28 10:03:16+02:00
Increase default timeouts
Client timeouts need to be higher than server timeouts,
so that work does not accumulate on the server with retries.
This was not true by default, the gocql default timeout was lower
than the Cassandra default timeout.
Closes https://github.com/gocql/gocql/issues/1671
Closes https://github.com/gocql/gocql/issues/1701
64175cf2bdc63dfaeee16b3604cc76afc2ddbe50 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-07-10 12:14:42+02:00
Add com.scylladb.auth.{SaslauthdAuthenticator,TransitionalAuthenticator} authenticators
These are already allowed in github.com/scylladb/gocql.
Closes https://github.com/gocql/gocql/issues/1703
3fba474ba052eb3b587a0d6ef14e451294a8311f | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-25 11:09:45+02:00
Synchronize access to pools in TestControlConn_ReconnectRefreshesRing
This should fix the following data race:
```
Read at 0x00c000202090 by goroutine 15:
github.com/gocql/gocql.TestControlConn_ReconnectRefreshesRing.func3()
/home/runner/work/gocql/gocql/control_ccm_test.go:121 +0x249
github.com/gocql/gocql.TestControlConn_ReconnectRefreshesRing()
/home/runner/work/gocql/gocql/control_ccm_test.go:129 +0x942
testing.tRunner()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:1629 +0x47
Previous write at 0x00c000202090 by goroutine 83:
runtime.mapdelete_faststr()
/opt/hostedtoolcache/go/1.20.3/x64/src/runtime/map_faststr.go:301 +0x0
github.com/gocql/gocql.(*policyConnPool).removeHost()
/home/runner/work/gocql/gocql/connectionpool.go:265 +0xd5
github.com/gocql/gocql.(*Session).handleNodeDown()
/home/runner/work/gocql/gocql/events.go:244 +0x2b8
github.com/gocql/gocql.(*hostConnPool).fillingStopped()
/home/runner/work/gocql/gocql/connectionpool.go:504 +0x4a8
github.com/gocql/gocql.(*hostConnPool).fill.func1()
/home/runner/work/gocql/gocql/connectionpool.go:456 +0x64
Goroutine 15 (running) created at:
testing.(*T).Run()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:1576 +0x216
testing.runTests()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/opt/hostedtoolcache/go/1.20.3/x64/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:157 +0x2e9
Goroutine 83 (finished) created at:
github.com/gocql/gocql.(*hostConnPool).fill()
/home/runner/work/gocql/gocql/connectionpool.go:452 +0x411
github.com/gocql/gocql.(*hostConnPool).HandleError.func2()
/home/runner/work/gocql/gocql/connectionpool.go:618 +0x39
```
b90e2262db63962f3a7771dff80f003ae00b89b9 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-20 21:29:52+02:00
Upgrade actions to latest version
Old versions use node 12 which is end of life:
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
We should use node 16. The newest actions do.
Removing actions/cache because actions/setup-go has enabled
builtin caching since version 4:
https://github.com/actions/setup-go/tree/dd84a9531a6f8e72c321f2aa3b9048ed359670e4#v4
ebdebffd7952d8ac747e1c6e883aa5d8f810248f | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-20 21:03:02+02:00
Expect 99p for speculative_retry for Cassandra 4.0 and later
Support for case insensitivity and short notation was added in
Cassandra 4.0.
See https://issues.apache.org/jira/browse/CASSANDRA-14293
1697467c840844ed218220e80d71fd852250141b | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-20 20:45:14+02:00
Expect 0 for DcLocalReadRepairChance in Cassandra 4 and later
The option was removed, see CASSANDRA-13910.
ea9b541d083f821e8d74d0d00304fc4554bfd990 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-20 20:16:32+02:00
Use chunk_length_in_kb 16 for Cassandra 4 and later
The default value has changed from 64 to 16 in Cassandra 4.
ef327e7c4180ebec920007b96c20ea818e4dd28e | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-11 10:04:34+02:00
Use Cassandra 4.0.8 and 4.1.1 in CI
We should aim for the latest 2 stable versions.
Also this might help fixing CI.
214d08cda3f729bfaa515ce416dad3e68e0ae06e | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-11 08:05:38+02:00
Store ccm state as artifact on failure
Hopefully there will be some logs to aid debugging.
93bf3da72368850af8e46bf1ed164487fe9bc166 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-11 07:08:51+02:00
Upgrade ccm to latest version
Integration tests are stuck on something with latest Ubuntu version,
let's try to upgrade ccm to the latest version.
b8c4e1605a585c110d073b5391929755442c51a2 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-06 19:34:07+02:00
Fix a deadlock in Session.Close() during control connection reconnect
We switched from separate mutex for closing to sessionStateMu in
312a614907c8d2e19f6b14aff16015436cb78423.
This change introduced a deadlock.
We don't need to hold the mutex for the whole duration of Close(),
we only need to update the status atomically.
Previously IsClosed() returned true only after all closing is done
(because of the deferred unlock).
We can emulate that by setting isClosed at the end of Close().
We need a new variable to ensure that Close() is only executed once.
Fixes https://github.com/gocql/gocql/issues/1687
32d95025ae4e4c28af9be09e85a2ac3dcfb2b393 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2023-04-04 10:15:57+02:00
Use ubuntu-latest OS in CI
ubuntu-18.04 is not available anymore:
https://github.com/actions/runner-images/issues/6002
Increased timeout as the tests failed during the cluster setup phase.
c18067a2fb951be118df03ce3a72b7cac8653ec3 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-10-27 10:35:30+02:00
Check all hosts in host selection policy tests
Most of the tests were missing checks that the list of hosts
is finished, this commit adds them.
Removed checkList so that all tests look similar.
11364d2122af1eb310fa90c97e37fb9c8dda27aa | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-09-06 14:04:20+02:00
Reformat code using go fmt v 1.19
There are different format rules for Go 1.19, reformat the comments
with the new version so that the formatting changes do not show up in
unrelated merge requests.
53b2437c2bb49994ca6b3bf8974b40f5857174dd | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-09-06 10:44:30+02:00
Use Go 1.19 in CI
We generally support the last two stable versions of Go,
updating the CI to test against them.
a1cb849f8513e4644d9500e6d504a3dfeb1156b2 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-07-15 15:23:48+02:00
Allocate map with the initial size during unmarshal
We know the number of elements in the map in advance, so we can
preallocate the map to avoid allocations when growing.
d2ed1bb74f3118a83a352e9ce912be765001efa4 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-07-04 16:09:58+02:00
Marshal missing UDT fields as null instead of failing
We can't return an error in case a field is added to the UDT,
otherwise existing code would break by simply altering the UDT in the
database. For extra fields at the end of the UDT, we can either omit
them or put nulls.
The Java driver[1] and Python driver[2] serialize nulls when they
don't have a value for a field even for fields in the middle, so let's
do that. This behaviour matches even gocql when serializing structs.
[1] https://github.com/datastax/java-driver/blob/ef56d561d97adcae48e0e6e8807f334aedc0d783/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/UdtCodec.java#L86
[2] https://github.com/datastax/python-driver/blob/15d715f4e686032b02ce785eca1d176d2b25e32b/cassandra/cqltypes.py#L1036
ae365faf08fb5f4d02bf828fd155fa5109c59a6b | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-06-24 08:57:02+02:00
Reformat ClusterConfig to have doc comments above fields
This change is to make maintanance easier.
With comments above the fields, each field is indented separately,
so we can insert new fields into the struct and update the documentation
comments without gofmt reformating the whole struct.
This should reduce diffs in commits and minimize conflicts when
merging to forks.
4d42aa3a5f690598a34453ba94f5a379c83f5c94 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-06-21 12:58:20+02:00
Upgrade Cassandra versions used in CI
This should fix CI that fails because of URISyntaxException in nodetool
(CASSANDRA-17581).
66ec1520631c9e3b9b40777d2febd537e09ddaaa | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-06-14 16:46:45+02:00
Add HostDialer interface
There are multiple use cases where the Dialer interface is not
sufficient.
When using TLS, users need to control also TLS context per host.
For example, host certificates might be either UUID in common name,
some hostname, IP address per host, etc.
Hosted instances or instances deployed in Kubernetes cluster tend
to be behind proxies. A proxy might use TLS server name indication
to identify which database host to connect to.
d6ea6644a25d97399c95bdae31058da08013c034 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-04-01 15:47:20+02:00
Make TestUnmarshalUDT more readable
Suggested at https://github.com/gocql/gocql/pull/1583/files#r774983890
a61f47f6585ad45068e6ac6f1a75d26300a068b0 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-03-18 11:42:32+01:00
Run tests with Go 1.18
Go 1.18 was released, let's test with 1.17 and 1.18 as those
are the only supported versions of Go now.
a5b0ab9200e66350d1b6d8e958026e6f60c16424 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2022-01-27 17:35:32+01:00
Make sure policies are not reused between sessions
Sharing a policy between sessions is not supported because the policy
receives state updates from the session.
Let's update the documentation and add a panic in TokenAwareHostPolicy
constructor. It is better to panic early than to have races and
undefined behavior later.
See also discussion in https://github.com/scylladb/gocql/issues/94
7525cfce1751002e228799467681812d6bb12516 | Author: Martin Sucha <git@mm.ms47.eu>
| 2021-12-23 20:54:11+01:00
Don't panic when there is no Go type available
When there is no corresponding Go type available,
unmarshaling panics. We want to return an error instead.
Unfortunately, TypeInfo.New() can't return an error.
We can't change the signature of New as it might be used
externally. For New(), the only option is to keep panicking.
We now at least provide a more useful panic message.
We are adding a new method to interface TypeInfo that returns
as error instead of panicking. Changing the interface is a
breaking change for users that implement custom TypeInfo.
I don't expect any custom implementations of this interface
though, so I think this change is safe.
An alternative to adding the method to the interface would
be to add a separate interface and a function to use the
new interface when available, with fallback to TypeInfo:
type TypeInfo2 interface {
TypeInfo
NewWithError() (interface{}, error)
}
func NewFromType(t TypeInfo) (interface{}, error) {
if t2, ok := t.(TypeInfo2); ok {
return t2.NewWithError()
}
return t.New(), nil
}
However, I think that is overkill in this case as it's unlikely there
are custom implementations of TypeInfo and NewFromType still wouldn't
guarantee no panics.
Related gocql/gocql#1148
4e5ba558b809cdaea4b4fb777662520b370b703b | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-06-16 17:24:38+02:00
Fix deadlock in closeWithError
We have seen goroutines stuck at:
select
github.com/gocql/gocql.(*Conn).closeWithError
/go/pkg/mod/github.com/kiwicom/gocql@v1.8.0/conn.go:569
github.com/gocql/gocql.(*Conn).exec
/go/pkg/mod/github.com/kiwicom/gocql@v1.8.0/conn.go:1113
github.com/gocql/gocql.(*Conn).executeQuery
/go/pkg/mod/github.com/kiwicom/gocql@v1.8.0/conn.go:1414
semacquire
sync.runtime_SemacquireMutex
/usr/local/go/src/runtime/sema.go:71
sync.(*Mutex).lockSlow
/usr/local/go/src/sync/mutex.go:138
sync.(*Mutex).Lock
/usr/local/go/src/sync/mutex.go:81
github.com/gocql/gocql.(*Conn).exec
/go/pkg/mod/github.com/kiwicom/gocql@v1.8.0/conn.go:1058
github.com/gocql/gocql.(*Conn).executeQuery
/go/pkg/mod/github.com/kiwicom/gocql@v1.8.0/conn.go:1414
github.com/gocql/gocql.(*Query).execute
When closeWithError is notifying callReqs about the error, it
selects between writing to call.resp or until call.timeout is closed.
There were branches leading to return with missing close(call.timeout)
calls in exec. When exec returned without either closing call.timeout or
reading the call.resp, this left the call without any further progress.
closeWithError selected between two conditions that never happened.
2edce5845d60e95ed1d8d19db1fe400680bc6265 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-06-16 17:05:55+02:00
Don't hold connection mutex when closing callReqs
Previously when closing the connection, closeWithError would send
connection close errors to all currently outstanding callReqs while
holding the connection mutex. During this time, other goroutines trying
to start a request on this connection are blocked. These goroutines
could have created new callReqs for this connection and started trying
to write. The write would be probably canceled by closing the
underlying connection.
This commit changes the behaviour so that connection is marked as closed
and no new callReqs are created for the connection nor any more frames
are read. Taking all the callReqs to the goroutine that is closing
the connection allows us to iterate the callReqs without holding the
connection lock. If the iteration takes long (or if there is a
deadlock), only one goroutine is affected instead of any goroutine that
would try to create a request on this connection.
1268384b22aeea6ae7f83661763abb24bc7f951d | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-04-09 14:03:24+02:00
Add a separate write timeout
Using the same write timeout and read timeout means that the query
can take cfg.Timeout * 2 time. We want a shorter write timeout.
830d6d032ff1e63d47566a436beb5fcbd630ec69 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-04-07 17:01:19+02:00
Make write to connection cancellable
There were a few issues with the original implementation:
- deadlineWriter didn't use a critical section around
SetWriteDeadline/Write pair, so an incoming writer moved the deadline
for pending writes.
- There was a lock around Write in the writeCoalescer implementation.
This means that all goroutines trying to write to the connection could
be stuck if Write blocks (i.e. when the TCP buffer is full, probably
because of the remote node not reading fast enough).
- If a write was queued before the long Write call, it would be added to
buffers (I'm not sure if an attempt would be made to write it before
the connection is closed, but it seems possible).
When a connection is stuck in Write and there are other writes queueing
up, we want to abort them if the context is canceled and the write
waiting in queue was not started yet.
We can't cancel writes that are blocked in Write when the context
is canceled because context can be canceled due to external factors
like a user disconnecting. Canceling the pending Write could result
in partial write of a frame, clobbering the connection state.
Added checks for SetWriteDeadline errors, since not setting the
deadline could stuck the write goroutines potentially for infinitely
long, so it seems better to just return error.
It seems that SetWriteDeadline could fail only if the network connection
does not use a facility like epoll, which is highly unlikely. I found
checked Go code and as far as I can tell, only some file descriptors
other that network connections don't support the deadline.
Also added correct return values (written byte count) since returning
0 when an error is made is misleading.
344f583233efdf6d48b4091ea6c6a0b70d48514c | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-04-06 16:51:23+02:00
Split request and response framer
There is no need to share the write buffer with read goroutine,
so I'm splitting the code to use a separate framer for
request and response. This should help prevent accidental
reuse of framer in the future.
4ee4f6240fc424bfff102846d0f99222db1376d8 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-04-06 16:49:33+02:00
Don't reset connection on non-write errors
If there is an error like too big frame that we are sending,
we don't want to close the connection as we abort before trying
to write there. We don't clobber the data stream in this case.
As framer is basically a buffer of frame data,
I moved the I/O operations to separate methods with
explicit reader/writer arguments so that we can
distinguish when IO fails.
73e4d19fd77f743f76f519e16bf61fc5add70cf2 | Author: Martin Sucha <martin.sucha@kiwi.com>
| 2021-01-05 16:30:05+01:00
Add ability to observe streams
This allows to get metrics like current count of inflight streams.
A StreamObserver that does not want to store any context per stream
can always return the same value.