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

vec-379 Support AVS 0.11.x #16

Merged
merged 13 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (c *Client) put(

putReq := &protos.PutRequest{
Key: protoKey,
WriteType: writeType,
WriteType: &writeType,
Fields: fields,
IgnoreMemQueueFull: ignoreMemQueueFull,
}
Expand Down Expand Up @@ -786,12 +786,13 @@ func (c *Client) IndexCreate(
Name: indexName,
},
Dimensions: dimensions,
VectorDistanceMetric: vectorDistanceMetric,
VectorDistanceMetric: &vectorDistanceMetric,
Field: vectorField,
SetFilter: set,
Params: params,
Labels: labels,
Storage: storage,
Type: nil, // defaults to protos.IndexType_HNSW
}

return c.IndexCreateFromIndexDef(ctx, indexDef)
Expand Down
20 changes: 10 additions & 10 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestInsert_Success(t *testing.T) {
StringValue: "testKey",
},
},
WriteType: protos.WriteType_INSERT_ONLY,
WriteType: ptr(protos.WriteType_INSERT_ONLY),
Fields: []*protos.Field{
{
Name: "field1",
Expand Down Expand Up @@ -251,7 +251,7 @@ func TestUpdate_Success(t *testing.T) {
StringValue: "testKey",
},
},
WriteType: protos.WriteType_UPDATE_ONLY,
WriteType: ptr(protos.WriteType_UPDATE_ONLY),
Fields: []*protos.Field{
{
Name: "field1",
Expand Down Expand Up @@ -319,7 +319,7 @@ func TestReplace_Success(t *testing.T) {
StringValue: "testKey",
},
},
WriteType: protos.WriteType_UPSERT,
WriteType: ptr(protos.WriteType_UPSERT),
Fields: []*protos.Field{
{
Name: "field1",
Expand Down Expand Up @@ -385,10 +385,10 @@ func TestGet_Success(t *testing.T) {
},
Projection: &protos.ProjectionSpec{
Include: &protos.ProjectionFilter{
Type: protos.ProjectionType_ALL,
Type: ptr(protos.ProjectionType_ALL),
},
Exclude: &protos.ProjectionFilter{
Type: protos.ProjectionType_NONE,
Type: ptr(protos.ProjectionType_NONE),
},
},
}
Expand Down Expand Up @@ -1012,7 +1012,7 @@ func TestVectorSearchFloat32_Success(t *testing.T) {
mockConn := &connection{
transactClient: mockTransactClient,
}
mockVectorSearchClient := protos.NewMockTransactService_VectorSearchClient(ctrl)
mockVectorSearchClient := protos.NewMockwrappedTransactService_VectorSearchClient(ctrl)

// Set up expectations for connProvider.GetRandomConn()
mockConnProvider.
Expand Down Expand Up @@ -1041,10 +1041,10 @@ func TestVectorSearchFloat32_Success(t *testing.T) {
},
Projection: &protos.ProjectionSpec{
Include: &protos.ProjectionFilter{
Type: protos.ProjectionType_ALL,
Type: ptr(protos.ProjectionType_ALL),
},
Exclude: &protos.ProjectionFilter{
Type: protos.ProjectionType_NONE,
Type: ptr(protos.ProjectionType_NONE),
},
},
}
Expand Down Expand Up @@ -1250,7 +1250,7 @@ func TestVectorSearchFloat32_FailedToRecvAllNeighbors(t *testing.T) {
mockConn := &connection{
transactClient: mockTransactClient,
}
mockVectorSearchClient := protos.NewMockTransactService_VectorSearchClient(ctrl)
mockVectorSearchClient := protos.NewMockwrappedTransactService_VectorSearchClient(ctrl)

// Set up expectations for connProvider.GetRandomConn()
mockConnProvider.
Expand Down Expand Up @@ -1307,7 +1307,7 @@ func TestVectorSearchFloat32_FailedToConvertNeighbor(t *testing.T) {
mockConn := &connection{
transactClient: mockTransactClient,
}
mockVectorSearchClient := protos.NewMockTransactService_VectorSearchClient(ctrl)
mockVectorSearchClient := protos.NewMockwrappedTransactService_VectorSearchClient(ctrl)

// Set up expectations for connProvider.GetRandomConn()
mockConnProvider.
Expand Down
2 changes: 1 addition & 1 deletion docker/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
AVS_IMAGE=aerospike/aerospike-vector-search:0.10.0
AVS_IMAGE=aerospike/aerospike-vector-search:0.11.1
50 changes: 32 additions & 18 deletions integration_single_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ func (suite *SingleNodeTestSuite) TestIndexCreate() {
Name: "index",
},
Dimensions: uint32(10),
VectorDistanceMetric: protos.VectorDistanceMetric_SQUARED_EUCLIDEAN,
Type: protos.IndexType_HNSW,
VectorDistanceMetric: ptr(protos.VectorDistanceMetric_SQUARED_EUCLIDEAN),
SetFilter: nil,
Field: "vector",
},
Expand All @@ -289,15 +288,17 @@ func (suite *SingleNodeTestSuite) TestIndexCreate() {
Labels: map[string]string{
"a": "b",
},
HnswParams: &protos.HnswParams{
EnableVectorIntegrityCheck: ptr(false),
},
},
protos.IndexDefinition{
Id: &protos.IndexId{
Namespace: "test",
Name: "index",
},
Dimensions: uint32(10),
VectorDistanceMetric: protos.VectorDistanceMetric_COSINE,
Type: protos.IndexType_HNSW,
VectorDistanceMetric: ptr(protos.VectorDistanceMetric_COSINE),
SetFilter: ptr("testset"),
Field: "vector",
Storage: &protos.IndexStorage{
Expand All @@ -308,7 +309,9 @@ func (suite *SingleNodeTestSuite) TestIndexCreate() {
"a": "b",
},
Params: &protos.IndexDefinition_HnswParams{
HnswParams: &protos.HnswParams{},
HnswParams: &protos.HnswParams{
EnableVectorIntegrityCheck: ptr(false),
},
},
},
},
Expand Down Expand Up @@ -377,8 +380,7 @@ func (suite *SingleNodeTestSuite) TestIndexUpdate() {
Name: "index",
},
Dimensions: uint32(10),
VectorDistanceMetric: protos.VectorDistanceMetric_COSINE,
Type: protos.IndexType_HNSW,
VectorDistanceMetric: ptr(protos.VectorDistanceMetric_COSINE),
SetFilter: ptr("testset"),
Field: "vector",
Storage: &protos.IndexStorage{
Expand Down Expand Up @@ -413,12 +415,14 @@ func (suite *SingleNodeTestSuite) TestIndexUpdate() {
updateHnsw: &protos.HnswIndexUpdate{
MaxMemQueueSize: ptr(uint32(100)),
BatchingParams: &protos.HnswBatchingParams{
MaxRecords: ptr(uint32(10_001)),
Interval: ptr(uint32(10_002)),
MaxIndexRecords: ptr(uint32(10_001)),
IndexInterval: ptr(uint32(10_002)),
MaxReindexRecords: ptr(uint32(10_001)),
ReindexInterval: ptr(uint32(10_002)),
},
CachingParams: &protos.HnswCachingParams{
IndexCachingParams: &protos.HnswCachingParams{
MaxEntries: ptr(uint64(10_003)),
Expiry: ptr(uint64(10_004)),
Expiry: ptr(int64(10_004)),
},
HealerParams: &protos.HnswHealerParams{
MaxScanRatePerNode: ptr(uint32(10_005)),
Expand All @@ -431,6 +435,11 @@ func (suite *SingleNodeTestSuite) TestIndexUpdate() {
IndexParallelism: ptr(uint32(2)),
ReIndexParallelism: ptr(uint32(3)),
},
RecordCachingParams: &protos.HnswCachingParams{
MaxEntries: ptr(uint64(10_007)),
Expiry: ptr(int64(10_008)),
},
EnableVectorIntegrityCheck: ptr(true),
},
updateLabels: map[string]string{
"c": "d",
Expand All @@ -441,8 +450,7 @@ func (suite *SingleNodeTestSuite) TestIndexUpdate() {
Name: "index",
},
Dimensions: uint32(10),
VectorDistanceMetric: protos.VectorDistanceMetric_COSINE,
Type: protos.IndexType_HNSW,
VectorDistanceMetric: ptr(protos.VectorDistanceMetric_COSINE),
SetFilter: ptr("testset"),
Field: "vector",
Storage: &protos.IndexStorage{
Expand All @@ -457,12 +465,14 @@ func (suite *SingleNodeTestSuite) TestIndexUpdate() {
HnswParams: &protos.HnswParams{
MaxMemQueueSize: ptr(uint32(100)),
BatchingParams: &protos.HnswBatchingParams{
MaxRecords: ptr(uint32(10_001)),
Interval: ptr(uint32(10_002)),
MaxIndexRecords: ptr(uint32(10_001)),
IndexInterval: ptr(uint32(10_002)),
MaxReindexRecords: ptr(uint32(10_001)),
ReindexInterval: ptr(uint32(10_002)),
},
CachingParams: &protos.HnswCachingParams{
IndexCachingParams: &protos.HnswCachingParams{
MaxEntries: ptr(uint64(10_003)),
Expiry: ptr(uint64(10_004)),
Expiry: ptr(int64(10_004)),
},
HealerParams: &protos.HnswHealerParams{
MaxScanRatePerNode: ptr(uint32(10_005)),
Expand All @@ -475,6 +485,10 @@ func (suite *SingleNodeTestSuite) TestIndexUpdate() {
IndexParallelism: ptr(uint32(2)),
ReIndexParallelism: ptr(uint32(3)),
},
RecordCachingParams: &protos.HnswCachingParams{
MaxEntries: ptr(uint64(10_007)),
Expiry: ptr(int64(10_008)),
},
},
},
},
Expand Down Expand Up @@ -1316,7 +1330,7 @@ func (suite *SingleNodeTestSuite) TestAbout() {
{
name: "nil-node",
nodeId: nil,
expectedVersion: "0.10.0",
expectedVersion: "0.11.1",
},
{
name: "node id DNE",
Expand Down
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $(MOCKGEN): $(GOBIN)
go install go.uber.org/mock/mockgen@$(MOCKGEN_VERSION)

.PHONY: mocks
mocks: $(MOCKGEN) $(ROOT_DIR)/client_mock.go $(ROOT_DIR)/connection_provider_mock.go $(PROTO_DIR)/auth_grpc_mock.pb.go $(PROTO_DIR)/index_grpc_mock.pb.go $(PROTO_DIR)/transact_grpc_mock.pb.go $(PROTO_DIR)/types_mock.pb.go $(PROTO_DIR)/user-admin_grpc_mock.pb.go $(PROTO_DIR)/vector-db_grpc_mock.pb.go
mocks: $(MOCKGEN) $(ROOT_DIR)/client_mock.go $(ROOT_DIR)/connection_provider_mock.go $(PROTO_DIR)/auth_grpc_mock.pb.go $(PROTO_DIR)/index_grpc_mock.pb.go $(PROTO_DIR)/transact_grpc_mock.pb.go $(PROTO_DIR)/types_mock.pb.go $(PROTO_DIR)/user-admin_grpc_mock.pb.go $(PROTO_DIR)/vector-db_grpc_mock.pb.go $(PROTO_DIR)/transact_service_vector_search_client_mock.pb.go

$(ROOT_DIR)/client_mock.go: $(ROOT_DIR)/client.go
$(MOCKGEN) --source $< --destination $@ --package avs
Expand All @@ -47,6 +47,9 @@ $(PROTO_DIR)/index_grpc_mock.pb.go: $(PROTO_DIR)/index_grpc.pb.go
$(PROTO_DIR)/transact_grpc_mock.pb.go: $(PROTO_DIR)/transact_grpc.pb.go
$(MOCKGEN) --source $< --destination $@ --package protos

$(PROTO_DIR)/transact_service_vector_search_client_mock.pb.go: $(PROTO_DIR)/transact_service_vector_search_client.go
$(MOCKGEN) --source $< --destination $@ --package protos

$(PROTO_DIR)/types_mock.pb.go: $(PROTO_DIR)/types.pb.go
$(MOCKGEN) --source $< --destination $@ --package protos

Expand Down
52 changes: 11 additions & 41 deletions protos/auth.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading