Skip to content

Commit

Permalink
feat: VEC-231 remove support for hnsw-batch-enabled, update tests to …
Browse files Browse the repository at this point in the history
…0.9.0, upgrade go client
  • Loading branch information
Jesse Schmidt committed Jul 10, 2024
1 parent 3cb5aa3 commit 9e69a5e
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 139 deletions.
1 change: 0 additions & 1 deletion cmd/flags/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const (
Ef = "hnsw-ef"
BatchMaxRecords = "hnsw-batch-max-records"
BatchInterval = "hnsw-batch-interval"
BatchEnabled = "hnsw-batch-enabled"
TLSProtocols = "tls-protocols"
TLSCaFile = "tls-cafile"
TLSCaPath = "tls-capath"
Expand Down
49 changes: 19 additions & 30 deletions cmd/indexCreate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log/slog"
"strings"

avs "github.com/aerospike/avs-client-go"
"github.com/aerospike/avs-client-go/protos"
commonFlags "github.com/aerospike/tools-common-go/flags"
"github.com/spf13/cobra"
Expand All @@ -31,7 +32,6 @@ var indexCreateFlags = &struct {
hnswConstructionEf flags.Uint32OptionalFlag
hnswBatchMaxRecords flags.Uint32OptionalFlag
hnswBatchInterval flags.Uint32OptionalFlag
hnswBatchEnabled flags.BoolOptionalFlag
}{
clientFlags: *flags.NewClientFlags(),
storageNamespace: flags.StringOptionalFlag{},
Expand All @@ -41,7 +41,6 @@ var indexCreateFlags = &struct {
hnswConstructionEf: flags.Uint32OptionalFlag{},
hnswBatchMaxRecords: flags.Uint32OptionalFlag{},
hnswBatchInterval: flags.Uint32OptionalFlag{},
hnswBatchEnabled: flags.BoolOptionalFlag{},
}

func newIndexCreateFlagSet() *pflag.FlagSet {
Expand All @@ -61,7 +60,6 @@ func newIndexCreateFlagSet() *pflag.FlagSet {
flagSet.Var(&indexCreateFlags.hnswEf, flags.Ef, commonFlags.DefaultWrapHelpString("The default number of candidate nearest neighbors shortlisted during search. Larger values provide better recall at the cost of longer search times. The default is 100.")) //nolint:lll // For readability
flagSet.Var(&indexCreateFlags.hnswBatchMaxRecords, flags.BatchMaxRecords, commonFlags.DefaultWrapHelpString("Maximum number of records to fit in a batch. The default value is 10000.")) //nolint:lll // For readability
flagSet.Var(&indexCreateFlags.hnswBatchInterval, flags.BatchInterval, commonFlags.DefaultWrapHelpString("The maximum amount of time in milliseconds to wait before finalizing a batch. The default value is 10000.")) //nolint:lll // For readability
flagSet.Var(&indexCreateFlags.hnswBatchEnabled, flags.BatchEnabled, commonFlags.DefaultWrapHelpString("Enables batching for index updates. Default is true meaning batching is enabled.")) //nolint:lll // For readability
flagSet.AddFlagSet(indexCreateFlags.clientFlags.NewClientFlagSet())

return flagSet
Expand Down Expand Up @@ -90,8 +88,8 @@ For example:
%s
asvec index create -i myindex -n test -s testset -d 256 -m COSINE --%s vector \
--%s test --%s false
`, HelpTxtSetupEnv, flags.VectorField, flags.StorageNamespace, flags.BatchEnabled),
--%s test
`, HelpTxtSetupEnv, flags.VectorField, flags.StorageNamespace),
PreRunE: func(_ *cobra.Command, _ []string) error {
return checkSeedsAndHost()
},
Expand All @@ -113,7 +111,6 @@ asvec index create -i myindex -n test -s testset -d 256 -m COSINE --%s vector \
slog.Any(flags.ConstructionEf, indexCreateFlags.hnswConstructionEf.String()),
slog.Any(flags.BatchMaxRecords, indexCreateFlags.hnswBatchMaxRecords.String()),
slog.Any(flags.BatchInterval, indexCreateFlags.hnswBatchInterval.String()),
slog.Any(flags.BatchEnabled, indexCreateFlags.hnswBatchEnabled.String()),
)...,
)

Expand All @@ -123,26 +120,21 @@ asvec index create -i myindex -n test -s testset -d 256 -m COSINE --%s vector \
}
defer adminClient.Close()

// Inverted to make it easier to understand
var hnswBatchDisabled *bool
if indexCreateFlags.hnswBatchEnabled.Val != nil {
bd := !(*indexCreateFlags.hnswBatchEnabled.Val)
hnswBatchDisabled = &bd
}

indexStorage := &protos.IndexStorage{
Namespace: indexCreateFlags.storageNamespace.Val,
Set: indexCreateFlags.storageSet.Val,
}

hnswParams := &protos.HnswParams{
M: indexCreateFlags.hnswMaxEdges.Val,
Ef: indexCreateFlags.hnswEf.Val,
EfConstruction: indexCreateFlags.hnswConstructionEf.Val,
BatchingParams: &protos.HnswBatchingParams{
MaxRecords: indexCreateFlags.hnswBatchMaxRecords.Val,
Interval: indexCreateFlags.hnswBatchInterval.Val,
Disabled: hnswBatchDisabled,
indexOpts := &avs.IndexCreateOpts{

Check failure on line 123 in cmd/indexCreate.go

View workflow job for this annotation

GitHub Actions / tests

undefined: avs.IndexCreateOpts
Sets: indexCreateFlags.sets,
MetaData: indexCreateFlags.indexMeta,
Storage: &protos.IndexStorage{
Namespace: indexCreateFlags.storageNamespace.Val,
Set: indexCreateFlags.storageSet.Val,
},
HnswParams: &protos.HnswParams{
M: indexCreateFlags.hnswMaxEdges.Val,
Ef: indexCreateFlags.hnswEf.Val,
EfConstruction: indexCreateFlags.hnswConstructionEf.Val,
BatchingParams: &protos.HnswBatchingParams{
MaxRecords: indexCreateFlags.hnswBatchMaxRecords.Val,
Interval: indexCreateFlags.hnswBatchInterval.Val,
},
},
}

Expand All @@ -163,14 +155,11 @@ asvec index create -i myindex -n test -s testset -d 256 -m COSINE --%s vector \
err = adminClient.IndexCreate(
ctx,
indexCreateFlags.namespace,
indexCreateFlags.sets,
indexCreateFlags.indexName,
indexCreateFlags.vectorField,
indexCreateFlags.dimensions,
protos.VectorDistanceMetric(protos.VectorDistanceMetric_value[indexCreateFlags.distanceMetric.String()]),
hnswParams,
indexCreateFlags.indexMeta,
indexStorage,
indexOpts,
)
if err != nil {
logger.Error("unable to create index", slog.Any("error", err))
Expand Down
7 changes: 6 additions & 1 deletion cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ func createClientFromFlags(clientFlags *flags.ClientFlags) (*avs.AdminClient, er
}
}

var creds *avs.UserPassCredentials

Check failure on line 59 in cmd/utils.go

View workflow job for this annotation

GitHub Actions / tests

undefined: avs.UserPassCredentials
if clientFlags.User.Val != nil {
creds = avs.NewCredntialsFromUserPass(*clientFlags.User.Val, *password)

Check failure on line 61 in cmd/utils.go

View workflow job for this annotation

GitHub Actions / tests

undefined: avs.NewCredntialsFromUserPass
}

adminClient, err := avs.NewAdminClient(
ctx, hosts, clientFlags.ListenerName.Val, isLoadBalancer, clientFlags.User.Val, password, tlsConfig, logger,
ctx, hosts, clientFlags.ListenerName.Val, isLoadBalancer, creds, tlsConfig, logger,

Check failure on line 65 in cmd/utils.go

View workflow job for this annotation

GitHub Actions / tests

not enough arguments in call to avs.NewAdminClient
)
if err != nil {
logger.Error("failed to create AVS client", slog.Any("error", err))
Expand Down
1 change: 0 additions & 1 deletion cmd/writers/indexList.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func (itw *IndexTableWriter) AppendIndexRow(index *protos.IndexDefinition, statu
{"Construction Ef", v.HnswParams.GetEfConstruction()},
{"Batch Max Records", v.HnswParams.BatchingParams.GetMaxRecords()},
{"Batch Interval", v.HnswParams.BatchingParams.GetInterval()},
{"Batch Enabled", !v.HnswParams.BatchingParams.GetDisabled()},
})

row = append(row, tHNSW.Render())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ tls:
service-tls:
mutual-auth: false
trust-store:
store-file: /etc/aerospike-proximus/tls/ca.aerospike.com.truststore.jks
store-password-file: /etc/aerospike-proximus/tls/storepass
store-file: /etc/aerospike-vector-search/tls/ca.aerospike.com.truststore.jks
store-password-file: /etc/aerospike-vector-search/tls/storepass
key-store:
store-file: /etc/aerospike-proximus/tls/localhost.keystore.jks
store-password-file: /etc/aerospike-proximus/tls/storepass
key-password-file: /etc/aerospike-proximus/tls/keypass
store-file: /etc/aerospike-vector-search/tls/localhost.keystore.jks
store-password-file: /etc/aerospike-vector-search/tls/storepass
key-password-file: /etc/aerospike-vector-search/tls/keypass

security:
auth-token:
private-key: /etc/aerospike-proximus/jwt/private_key.pem
public-key: /etc/aerospike-proximus/jwt/public_key.pem
private-key: /etc/aerospike-vector-search/jwt/private_key.pem
public-key: /etc/aerospike-vector-search/jwt/public_key.pem
token-expiry: 30_000

# The Proximus service listening ports, TLS and network interface.
Expand Down
2 changes: 1 addition & 1 deletion docker/auth/config/aerospike.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace bar {
}
}

namespace proximus-meta {
namespace avs-meta {
replication-factor 1
nsup-period 100

Expand Down
10 changes: 5 additions & 5 deletions docker/auth/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ services:
ports:
- "3000:3000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/opt/aerospike/etc/aerospike
command:
- "--config-file"
- "/opt/aerospike/etc/aerospike/aerospike.conf"
avs:
image: aerospike.jfrog.io/docker/aerospike/aerospike-proximus-private:0.5.1-SNAPSHOT
image: aerospike/aerospike-vector-search:0.9.0
ports:
- "10000:10000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/etc/aerospike-proximus
- ./config:/etc/aerospike-vector-search

networks:
avs-demo: {}
avs-test: {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ tls:
service-tls:
mutual-auth: true
trust-store:
store-file: /etc/aerospike-proximus/tls/ca.aerospike.com.truststore.jks
store-password-file: /etc/aerospike-proximus/tls/storepass
store-file: /etc/aerospike-vector-search/tls/ca.aerospike.com.truststore.jks
store-password-file: /etc/aerospike-vector-search/tls/storepass
key-store:
store-file: /etc/aerospike-proximus/tls/localhost.keystore.jks
store-password-file: /etc/aerospike-proximus/tls/storepass
key-password-file: /etc/aerospike-proximus/tls/keypass
store-file: /etc/aerospike-vector-search/tls/localhost.keystore.jks
store-password-file: /etc/aerospike-vector-search/tls/storepass
key-password-file: /etc/aerospike-vector-search/tls/keypass

# The Proximus service listening ports, TLS and network interface.
service:
Expand Down
2 changes: 1 addition & 1 deletion docker/mtls/config/aerospike.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace bar {
}
}

namespace proximus-meta {
namespace avs-meta {
replication-factor 1
nsup-period 100

Expand Down
10 changes: 5 additions & 5 deletions docker/mtls/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ services:
ports:
- "3000:3000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/opt/aerospike/etc/aerospike
command:
- "--config-file"
- "/opt/aerospike/etc/aerospike/aerospike.conf"
avs:
image: aerospike.jfrog.io/docker/aerospike/aerospike-proximus-private:0.5.1-SNAPSHOT
image: aerospike/aerospike-vector-search:0.9.0
ports:
- "10000:10000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/etc/aerospike-proximus
- ./config:/etc/aerospike-vector-search

networks:
avs-demo: {}
avs-test: {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ tls:
service-tls:
mutual-auth: false
trust-store:
store-file: /etc/aerospike-proximus/tls/ca.aerospike.com.truststore.jks
store-password-file: /etc/aerospike-proximus/tls/storepass
store-file: /etc/aerospike-vector-search/tls/ca.aerospike.com.truststore.jks
store-password-file: /etc/aerospike-vector-search/tls/storepass
key-store:
store-file: /etc/aerospike-proximus/tls/localhost.keystore.jks
store-password-file: /etc/aerospike-proximus/tls/storepass
key-password-file: /etc/aerospike-proximus/tls/keypass
store-file: /etc/aerospike-vector-search/tls/localhost.keystore.jks
store-password-file: /etc/aerospike-vector-search/tls/storepass
key-password-file: /etc/aerospike-vector-search/tls/keypass

# The Proximus service listening ports, TLS and network interface.
service:
Expand Down
2 changes: 1 addition & 1 deletion docker/tls/config/aerospike.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace bar {
}
}

namespace proximus-meta {
namespace avs-meta {
replication-factor 1
nsup-period 100

Expand Down
10 changes: 5 additions & 5 deletions docker/tls/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ services:
ports:
- "3000:3000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/opt/aerospike/etc/aerospike
command:
- "--config-file"
- "/opt/aerospike/etc/aerospike/aerospike.conf"
avs:
image: aerospike.jfrog.io/docker/aerospike/aerospike-proximus-private:0.5.1-SNAPSHOT
image: aerospike/aerospike-vector-search:0.9.0
ports:
- "10000:10000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/etc/aerospike-proximus
- ./config:/etc/aerospike-vector-search

networks:
avs-demo: {}
avs-test: {}
2 changes: 1 addition & 1 deletion docker/vanilla/config/aerospike.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace bar {
}
}

namespace proximus-meta {
namespace avs-meta {
replication-factor 1
nsup-period 100

Expand Down
10 changes: 5 additions & 5 deletions docker/vanilla/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ services:
ports:
- "3000:3000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/opt/aerospike/etc/aerospike
command:
- "--config-file"
- "/opt/aerospike/etc/aerospike/aerospike.conf"
avs:
image: aerospike.jfrog.io/docker/aerospike/aerospike-proximus-private:0.5.1-SNAPSHOT
image: aerospike/aerospike-vector-search:0.9.0
ports:
- "10000:10000"
networks:
- avs-demo
- avs-test
volumes:
- ./config:/etc/aerospike-proximus
- ./config:/etc/aerospike-vector-search

networks:
avs-demo: {}
avs-test: {}
Loading

0 comments on commit 9e69a5e

Please sign in to comment.