Skip to content

Commit d2258ce

Browse files
authored
Merge pull request #480 from aerospike/stage
Go Client v8.2.1
2 parents d5f672a + 2fc28bd commit d2258ce

17 files changed

+121
-47
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Change History
22

3+
## April 14 2025: v8.2.1
4+
5+
- **Improvements**
6+
- [CLIENT-3399] Update dependencies due to snyk security reports.
7+
8+
- **Fixes**
9+
- [CLIENT-3384] Panic in BatchGet with using MRT and Filter Expression together.
10+
- [CLIENT-3397] Retries fail on PutPayload command.
11+
- [CLIENT-3398] Fix Backward compatibility broken in Connection.SetTimeout API
12+
313
## March 18 2025: v8.2.0
414

515
- **Fixes**

admin_command.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ func (acmd *AdminCommand) executeCommand(conn *Connection, policy *AdminPolicy)
396396
timeout = policy.Timeout
397397
}
398398

399-
if err := conn.SetTimeout(timeout, timeout); err != nil {
399+
if err := conn.setTimeout(timeout, timeout); err != nil {
400400
return err
401401
}
402402

@@ -426,7 +426,7 @@ func (acmd *AdminCommand) readUsers(conn *Connection, policy *AdminPolicy) ([]*U
426426
timeout = policy.Timeout
427427
}
428428

429-
if err := conn.SetTimeout(timeout, timeout); err != nil {
429+
if err := conn.setTimeout(timeout, timeout); err != nil {
430430
return nil, err
431431
}
432432

@@ -579,7 +579,7 @@ func (acmd *AdminCommand) readRoles(conn *Connection, policy *AdminPolicy) ([]*R
579579
timeout = policy.Timeout
580580
}
581581

582-
if err := conn.SetTimeout(timeout, timeout); err != nil {
582+
if err := conn.setTimeout(timeout, timeout); err != nil {
583583
return nil, err
584584
}
585585

batch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ var _ = gg.Describe("Aerospike", func() {
427427
// gm.Expect(err.Matches(types.BATCH_MAX_REQUESTS_EXCEEDED)).To(gm.BeTrue())
428428
})
429429

430-
gg.It("XXXShould return the error for invalid namespace", func() {
430+
gg.It("Should return the error for invalid namespace", func() {
431431
var brs []as.BatchRecordIfc
432432

433433
for i := 0; i < 1; i++ {

cdt_context.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,6 @@ func CtxMapKeyCreate(key Value, order mapOrderType) *CDTContext {
198198
}
199199

200200
// CtxMapValue defines Lookup map by value.
201-
func CtxMapValue(key Value) *CDTContext {
202-
return &CDTContext{ctxTypeMapValue, key}
201+
func CtxMapValue(value Value) *CDTContext {
202+
return &CDTContext{ctxTypeMapValue, value}
203203
}

client_policy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ type ClientPolicy struct {
3131
// in hashed format. Leave empty for clusters running without restricted access.
3232
Password string
3333

34-
// ClusterName sets the expected cluster ID. If not nil, server nodes must return this cluster ID in order to
34+
// ClusterName sets the expected cluster ID. If not nil, server nodes must return this cluster ID in order to
3535
// join the client's view of the cluster. Should only be set when connecting to servers that
3636
// support the "cluster-name" info command. (v3.10+)
3737
ClusterName string //=""
3838

39-
// Initial host connection timeout duration. The timeout when opening a connection
39+
// Initial host connection timeout duration. The timeout when opening a connection
4040
// to the server host for the first time.
4141
Timeout time.Duration //= 30 seconds
4242

@@ -115,7 +115,7 @@ type ClientPolicy struct {
115115
TendInterval time.Duration //= 1 second
116116

117117
// A IP translation table is used in cases where different clients
118-
// use different server IP addresses. This may be necessary when
118+
// use different server IP addresses. This may be necessary when
119119
// using clients from both inside and outside a local area
120120
// network. Default is no translation.
121121
// The key is the IP address returned from friend info requests to other servers.
@@ -125,7 +125,7 @@ type ClientPolicy struct {
125125
// UseServicesAlternate determines if the client should use "services-alternate" instead of "services"
126126
// in info request during cluster tending.
127127
//"services-alternate" returns server configured external IP addresses that client
128-
// uses to talk to nodes. "services-alternate" can be used in place of providing a client "ipMap".
128+
// uses to talk to nodes. "services-alternate" can be used in place of providing a client "ipMap".
129129
// This feature is recommended instead of using the client-side IpMap above.
130130
//
131131
// "services-alternate" is available with Aerospike Server versions >= 3.7.1.

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ var _ = gg.Describe("Aerospike", func() {
472472

473473
binMap := as.BinMap{
474474
"Aerospike": "value",
475-
"Aerospike1": "value2",
475+
"Aerospike1": strings.Repeat("a", 1e5+1e4),
476476
}
477477

478478
wcmd, err := as.NewWriteCommand(nil, wpolicy, key, nil, binMap)

connection.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func newConnection(address string, timeout time.Duration) (*Connection, Error) {
156156
newConn.limitReader = &io.LimitedReader{R: conn, N: 0}
157157

158158
// set timeout at the last possible moment
159-
if err := newConn.SetTimeout(timeout, timeout); err != nil {
159+
if err := newConn.setTimeout(timeout, timeout); err != nil {
160160
newConn.Close()
161161
return nil, err
162162
}
@@ -333,7 +333,16 @@ func (ctn *Connection) updateDeadline() Error {
333333
}
334334

335335
// SetTimeout sets connection timeout for both read and write operations.
336-
func (ctn *Connection) SetTimeout(totalTimeout, socketTimeout time.Duration) Error {
336+
func (ctn *Connection) setTimeout(totalTimeout, socketTimeout time.Duration) Error {
337+
var deadline time.Time
338+
if totalTimeout > 0 {
339+
deadline = time.Now().Add(totalTimeout)
340+
}
341+
return ctn.SetTimeout(deadline, socketTimeout)
342+
}
343+
344+
// SetTimeout sets connection timeout for both read and write operations.
345+
func (ctn *Connection) SetTimeout(deadline time.Time, socketTimeout time.Duration) Error {
337346
now := time.Now()
338347
ctn.socketTimeout = _DEFAULT_TIMEOUT
339348
ctn.deadline = time.Time{}
@@ -343,10 +352,10 @@ func (ctn *Connection) SetTimeout(totalTimeout, socketTimeout time.Duration) Err
343352
}
344353

345354
// keep the deadline.IsZero() == true if totalTimeout is not set
346-
if totalTimeout > 0 {
347-
ctn.deadline = now.Add(totalTimeout)
355+
if !deadline.IsZero() {
356+
ctn.deadline = deadline
348357
if socketTimeout <= 0 {
349-
ctn.socketTimeout = totalTimeout
358+
ctn.socketTimeout = deadline.Sub(now)
350359
}
351360
}
352361
return nil

connection_heap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (h *singleConnectionHeap) RefreshIdleTail(tendInterval time.Duration) bool
165165

166166
// refresh in a goroutine asynchronously
167167
go func() {
168-
conn.SetTimeout(time.Second, time.Second)
168+
conn.setTimeout(time.Second, time.Second)
169169
conn.refresh()
170170
if _, err := conn.RequestInfo("build"); err == nil {
171171
// return to the pool

connection_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ var _ = gg.Describe("Connection Test", func() {
4343
})
4444

4545
gg.It("Dealines should be calculated correctly", func() {
46+
deadline := func(timeout time.Duration) (res time.Time) {
47+
if timeout > 0 {
48+
res = time.Now().Add(timeout)
49+
}
50+
return res
51+
}
52+
4653
testMatrix := []testExpectations{
4754
{0, 0, time.Time{}, time.Now().Add(as.DefaultTimeout()), as.DefaultTimeout()},
4855
{0, time.Second, time.Time{}, time.Now().Add(time.Second), time.Second},
@@ -52,7 +59,7 @@ var _ = gg.Describe("Connection Test", func() {
5259

5360
for _, matrix := range testMatrix {
5461
gg.By(fmt.Sprintf("TotalTimeout: %v, SocketTimeout: %v", matrix.totalTimeout, matrix.socketTimeout))
55-
err := conn.SetTimeout(matrix.totalTimeout, matrix.socketTimeout)
62+
err := conn.SetTimeout(deadline(matrix.totalTimeout), matrix.socketTimeout)
5663
gm.Expect(err).ToNot(gm.HaveOccurred())
5764

5865
expTotalDeadline, expSocketDeadline, expSocketTimeout, err := conn.UpdateDeadline()
@@ -62,7 +69,7 @@ var _ = gg.Describe("Connection Test", func() {
6269

6370
gm.Expect(expTotalDeadline).To(gm.BeTemporally("~", matrix.expTotalDeadline, time.Millisecond))
6471
gm.Expect(expSocketDeadline).To(gm.BeTemporally("~", matrix.expSocketDeadline, time.Millisecond))
65-
gm.Expect(expSocketTimeout).To(gm.Equal(matrix.expSocketTimeout))
72+
gm.Expect(expSocketTimeout).To(gm.BeNumerically("~", matrix.expSocketTimeout, time.Millisecond))
6673
}
6774
})
6875

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module github.com/aerospike/aerospike-client-go/v8
22

3-
go 1.23
3+
go 1.23.0
44

55
require (
66
github.com/onsi/ginkgo/v2 v2.22.2
77
github.com/onsi/gomega v1.36.2
88
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
99
github.com/yuin/gopher-lua v1.1.1
10-
golang.org/x/sync v0.10.0
10+
golang.org/x/sync v0.12.0
1111
)
1212

1313
require (
@@ -17,10 +17,10 @@ require (
1717
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
1818
github.com/kr/pretty v0.3.1 // indirect
1919
github.com/stretchr/testify v1.10.0 // indirect
20-
golang.org/x/net v0.33.0 // indirect
21-
golang.org/x/sys v0.28.0 // indirect
22-
golang.org/x/text v0.21.0 // indirect
23-
golang.org/x/tools v0.28.0 // indirect
20+
golang.org/x/net v0.37.0 // indirect
21+
golang.org/x/sys v0.31.0 // indirect
22+
golang.org/x/text v0.23.0 // indirect
23+
golang.org/x/tools v0.31.0 // indirect
2424
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2525
gopkg.in/yaml.v3 v3.0.1 // indirect
2626
)

0 commit comments

Comments
 (0)