Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go Client v7.6.0 #444

Merged
merged 15 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
run: go run github.com/onsi/ginkgo/v2/ginkgo build -tags="as_performance" .
- name: Build for Google App Engine (unsafe package removed)
run: go run github.com/onsi/ginkgo/v2/ginkgo build -tags="app_engine" .
- name: Build for DBAAS (proxy mode)
run: go run github.com/onsi/ginkgo/v2/ginkgo build -tags="as_proxy" .
- name: Run the tests
run: go run github.com/onsi/ginkgo/v2/ginkgo -coverprofile=./cover_native.out -covermode=atomic -coverpkg=./... -race -keep-going -succinct -randomize-suites -skip="HyperLogLog"
- name: Combine Cover Profiles
Expand Down
26 changes: 20 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
# Change History

## June 27 2024: v7.5.0
## July 17 2024: v7.6.0

Minor fix release.

- **Improvements**
- [CLIENT-3045] Move proxy client build behind a build flag.
This removes the GRPC compilation and potential namespace conflict from the default build and moves it behind the compiler build flag "as_proxy".

- **Fixes**
- [CLIENT-3022] `Close()` throws a `nil` pointer error on `ProxyClient` without Authentication.
- [CLIENT-3044] Circular reference in between `Client`<->`Cluster` causes memory leak when the client is not closed manually.
- [CLIENT-3046] Wrong return type in Single Key Batch Operations with Multiple Ops per Bin.
- [CLIENT-3047] Fix pointer value assignment in baseMultiCommand.parseKey (#443).
- [CLIENT-3048] Use precomputed ops variable in batchIndexCommandGet.executeSingle (#442).

## July 1 2024: v7.5.0

This a minor feature and fix release.

- **New Features**
- [CLIENT-2968] Support new v71 proxy features:
- Info command.
- [CLIENT-2968] Support new v7.1 proxy server features:
- `Info` command.
- `QueryPolicy.QueryDuration`
- [CLIENT-3012] Support new server 7.1 info command error response strings.

- **Improvements**
- [CLIENT-2997] Scans should work in a mixed cluster of v5.7 and v6.4 server nodes.
- [CLIENT-3012] Support new server 7.1 info command error response strings.
- [CLIENT-3020] Change ReadModeSC doc from server to client perspective.
- [CLIENT-3020] Change `ReadModeSC` doc from server to client perspective.

- **Fixes**
- [CLIENT-3019] Prevent Goroutine leak in AuthInterceptor for the Proxy Client.
- [CLIENT-3019] Prevent Goroutine leak in `AuthInterceptor` for the Proxy Client.

## May 20 2024: v7.4.0

Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

[![Aerospike Client Go](https://goreportcard.com/badge/github.com/aerospike/aerospike-client-go/v7)](https://goreportcard.com/report/github.com/aerospike/aerospike-client-go/v7)
[![Godoc](https://godoc.org/github.com/aerospike/aerospike-client-go/v7?status.svg)](https://pkg.go.dev/github.com/aerospike/aerospike-client-go/v7)
[![Tests](https://github.com/aerospike/aerospike-client-go/actions/workflows/build.yml/badge.svg?branch=v7&event=push)](github.com/aerospike/aerospike-client-go/actions)

An Aerospike library for Go.

This library is compatible with Go 1.21+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested).
This library is compatible with Go 1.20+ and supports the following operating systems: Linux, Mac OS X (Windows builds are possible, but untested).

Up-to-date documentation is available in the [![Godoc](https://godoc.org/github.com/aerospike/aerospike-client-go/v7?status.svg)](https://pkg.go.dev/github.com/aerospike/aerospike-client-go/v7).

Expand All @@ -26,6 +27,7 @@ Please refer to [`CHANGELOG.md`](CHANGELOG.md) for release notes, or if you enco
- [API Documentation](#api-documentation)
- [Google App Engine](#google-app-engine)
- [Reflection, and Object API](#reflection-and-object-api)
- [Proxy Client / DBAAS](#proxy-client--dbaas)
- [License](#license)

## Usage
Expand Down Expand Up @@ -87,7 +89,7 @@ Details about the API are available in the [`docs`](docs) directory.
<a name="Prerequisites"></a>
## Prerequisites

[Go](http://golang.org) version v1.21+ is required.
[Go](http://golang.org) version v1.20+ is required.

To install the latest stable version of Go, visit
[http://golang.org/dl/](http://golang.org/dl/)
Expand Down Expand Up @@ -138,40 +140,46 @@ To run all the test cases with race detection:
$ ginkgo -r -race


<a name="Examples"></a>
<a name="examples"></a>
## Examples

A variety of example applications are provided in the [`examples`](examples) directory.

<a name="Tools"></a>
<a name="tools"></a>
### Tools

A variety of clones of original tools are provided in the [`tools`](tools) directory.
They show how to use more advanced features of the library to re-implement the same functionality in a more concise way.

<a name="Benchmarks"></a>
<a name="benchmarks"></a>
## Benchmarks

Benchmark utility is provided in the [`tools/benchmark`](tools/benchmark) directory.
See the [`tools/benchmark/README.md`](tools/benchmark/README.md) for details.

<a name="API-Documentation"></a>
<a name="api-documentation"></a>
## API Documentation

A simple API documentation is available in the [`docs`](docs/README.md) directory. The latest up-to-date docs can be found in [![Godoc](https://godoc.org/github.com/aerospike/aerospike-client-go?status.svg)](https://pkg.go.dev/github.com/aerospike/aerospike-client-go/v7).

<a name="App-Engine"></a>
<a name="google-app-engine"></a>
## Google App Engine

To build the library for App Engine, build it with the build tag `app_engine`. Aggregation functionality is not available in this build.


<a name="Reflection"></a>
<a name="reflection-and-object-api"></a>
## Reflection, and Object API

To make the library both flexible and fast, we had to integrate the reflection API (methods with `[Get/Put/...]Object` names) tightly in the library. In case you wanted to avoid mixing those API in your app inadvertently, you can use the build tag `as_performance` to remove those APIs from the build.


<a name="proxy-client--dbaas"></a>
## Proxy Client / DBAAS

To compile the client for the proxy server in our database-as-a-service (dbaas) environment, pass `-tags as_proxy` to the compiler on build.

<a name="license"></a>
## License

The Aerospike Go Client is made available under the terms of the Apache License, Version 2, as stated in the file `LICENSE`.
Expand Down
1 change: 0 additions & 1 deletion aerospike_bench_reflect_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !as_performance
// +build !as_performance

// Copyright 2014-2022 Aerospike, Inc.
//
Expand Down
1 change: 0 additions & 1 deletion anonymous_fields_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !as_performance
// +build !as_performance

// Copyright 2014-2022 Aerospike, Inc.
//
Expand Down
10 changes: 9 additions & 1 deletion batch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ type batcher interface {
generateBatchNodes(*Cluster) ([]*batchNode, Error)
setSequence(int, int)

executeSingle(*Client) Error
executeSingle(clientIfc) Error
}

type clientIfc interface {
ClientIfc

operate(*WritePolicy, *Key, bool, ...*Operation) (*Record, Error)
execute(policy *WritePolicy, key *Key, packageName string, functionName string, args ...Value) (*Record, Error)
}

type batchCommand struct {
baseMultiCommand

client clientIfc
batch *batchNode
policy *BatchPolicy
sequenceAP int
Expand Down
12 changes: 9 additions & 3 deletions batch_command_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@ type batchCommandDelete struct {
}

func newBatchCommandDelete(
node *Node,
client clientIfc,
batch *batchNode,
policy *BatchPolicy,
batchDeletePolicy *BatchDeletePolicy,
keys []*Key,
records []*BatchRecord,
attr *batchAttr,
) *batchCommandDelete {
var node *Node
if batch != nil {
node = batch.Node
}

res := &batchCommandDelete{
batchCommand: batchCommand{
client: client,
baseMultiCommand: *newMultiCommand(node, nil, false),
policy: policy,
batch: batch,
Expand Down Expand Up @@ -168,7 +174,7 @@ func (cmd *batchCommandDelete) transactionType() transactionType {
return ttBatchWrite
}

func (cmd *batchCommandDelete) executeSingle(client *Client) Error {
func (cmd *batchCommandDelete) executeSingle(client clientIfc) Error {
policy := cmd.batchDeletePolicy.toWritePolicy(cmd.policy)
for i, key := range cmd.keys {
res, err := client.Operate(policy, key, DeleteOp())
Expand Down Expand Up @@ -197,7 +203,7 @@ func (cmd *batchCommandDelete) executeSingle(client *Client) Error {

func (cmd *batchCommandDelete) Execute() Error {
if len(cmd.keys) == 1 {
return cmd.executeSingle(cmd.node.cluster.client)
return cmd.executeSingle(cmd.client)
}
return cmd.execute(cmd)
}
Expand Down
12 changes: 9 additions & 3 deletions batch_command_exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ type batchCommandExists struct {
}

func newBatchCommandExists(
node *Node,
client clientIfc,
batch *batchNode,
policy *BatchPolicy,
keys []*Key,
existsArray []bool,
) *batchCommandExists {
var node *Node
if batch != nil {
node = batch.Node
}

res := &batchCommandExists{
batchCommand: batchCommand{
client: client,
baseMultiCommand: *newMultiCommand(node, nil, false),
policy: policy,
batch: batch,
Expand Down Expand Up @@ -110,7 +116,7 @@ func (cmd *batchCommandExists) transactionType() transactionType {
return ttBatchRead
}

func (cmd *batchCommandExists) executeSingle(client *Client) Error {
func (cmd *batchCommandExists) executeSingle(client clientIfc) Error {
var err Error
for _, offset := range cmd.batch.offsets {
cmd.existsArray[offset], err = client.Exists(&cmd.policy.BasePolicy, cmd.keys[offset])
Expand All @@ -136,7 +142,7 @@ func (cmd *batchCommandExists) executeSingle(client *Client) Error {

func (cmd *batchCommandExists) Execute() Error {
if len(cmd.batch.offsets) == 1 {
return cmd.executeSingle(cmd.node.cluster.client)
return cmd.executeSingle(cmd.client)
}
return cmd.execute(cmd)
}
Expand Down
15 changes: 10 additions & 5 deletions batch_command_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var batchObjectParser func(
) Error

func newBatchCommandGet(
node *Node,
client clientIfc,
batch *batchNode,
policy *BatchPolicy,
keys []*Key,
Expand All @@ -65,8 +65,14 @@ func newBatchCommandGet(
readAttr int,
isOperation bool,
) *batchCommandGet {
var node *Node
if batch != nil {
node = batch.Node
}

res := &batchCommandGet{
batchCommand: batchCommand{
client: client,
baseMultiCommand: *newMultiCommand(node, nil, isOperation),
policy: policy,
batch: batch,
Expand Down Expand Up @@ -158,7 +164,6 @@ func (cmd *batchCommandGet) parseRecordResults(ifc command, receiveSize int) (bo
cmd.objectsFound[batchIndex] = true
if err := batchObjectParser(cmd, batchIndex, opCount, fieldCount, generation, expiration); err != nil {
return false, err

}
}
}
Expand Down Expand Up @@ -216,7 +221,7 @@ func (cmd *batchCommandGet) transactionType() transactionType {
return ttBatchRead
}

func (cmd *batchCommandGet) executeSingle(client *Client) Error {
func (cmd *batchCommandGet) executeSingle(client clientIfc) Error {
for _, offset := range cmd.batch.offsets {
var err Error
if len(cmd.ops) > 0 {
Expand All @@ -226,7 +231,7 @@ func (cmd *batchCommandGet) executeSingle(client *Client) Error {
return newError(types.PARAMETER_ERROR, "Write operations not allowed in batch read").setNode(cmd.node)
}
}
cmd.records[offset], err = client.Operate(cmd.policy.toWritePolicy(), cmd.keys[offset], cmd.ops...)
cmd.records[offset], err = client.operate(cmd.policy.toWritePolicy(), cmd.keys[offset], true, cmd.ops...)
} else if (cmd.readAttr & _INFO1_NOBINDATA) == _INFO1_NOBINDATA {
cmd.records[offset], err = client.GetHeader(&cmd.policy.BasePolicy, cmd.keys[offset])
} else {
Expand Down Expand Up @@ -254,7 +259,7 @@ func (cmd *batchCommandGet) executeSingle(client *Client) Error {

func (cmd *batchCommandGet) Execute() Error {
if cmd.objects == nil && len(cmd.batch.offsets) == 1 {
return cmd.executeSingle(cmd.node.cluster.client)
return cmd.executeSingle(cmd.client)
}
return cmd.execute(cmd)
}
Expand Down
1 change: 0 additions & 1 deletion batch_command_get_reflect.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !as_performance
// +build !as_performance

// Copyright 2014-2022 Aerospike, Inc.
//
Expand Down
Loading
Loading