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

[WIP] Add WithoutVector option for VectorRequest to make correction faster #2220

Closed
wants to merge 3 commits into from
Closed
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
1,671 changes: 836 additions & 835 deletions apis/docs/v1/docs.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apis/grpc/v1/agent/core/agent.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/agent/sidecar/sidecar.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/discoverer/discoverer.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/filter/egress/egress_filter.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/filter/ingress/ingress_filter.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/manager/index/index_manager.pb.go

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

340 changes: 176 additions & 164 deletions apis/grpc/v1/payload/payload.pb.go

Large diffs are not rendered by default.

41 changes: 39 additions & 2 deletions apis/grpc/v1/payload/payload_vtproto.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,9 @@ func (m *Object_VectorRequest) CloneVT() *Object_VectorRequest {
return (*Object_VectorRequest)(nil)
}
r := &Object_VectorRequest{
Id: m.Id.CloneVT(),
Filters: m.Filters.CloneVT(),
Id: m.Id.CloneVT(),
Filters: m.Filters.CloneVT(),
WithoutVector: m.WithoutVector,
}
if len(m.unknownFields) > 0 {
r.unknownFields = make([]byte, len(m.unknownFields))
Expand Down Expand Up @@ -2775,6 +2776,9 @@ func (this *Object_VectorRequest) EqualVT(that *Object_VectorRequest) bool {
if !this.Filters.EqualVT(that.Filters) {
return false
}
if this.WithoutVector != that.WithoutVector {
return false
}
return string(this.unknownFields) == string(that.unknownFields)
}

Expand Down Expand Up @@ -5848,6 +5852,16 @@ func (m *Object_VectorRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if m.WithoutVector {
i--
if m.WithoutVector {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
}
if m.Filters != nil {
size, err := m.Filters.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
Expand Down Expand Up @@ -8436,6 +8450,9 @@ func (m *Object_VectorRequest) SizeVT() (n int) {
l = m.Filters.SizeVT()
n += 1 + l + sov(uint64(l))
}
if m.WithoutVector {
n += 2
}
n += len(m.unknownFields)
return n
}
Expand Down Expand Up @@ -13272,6 +13289,26 @@ func (m *Object_VectorRequest) UnmarshalVT(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field WithoutVector", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.WithoutVector = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skip(dAtA[iNdEx:])
Expand Down
2 changes: 1 addition & 1 deletion apis/grpc/v1/rpc/errdetails/error_details.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/filter.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/insert.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/object.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/remove.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/search.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/update.pb.go

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

2 changes: 1 addition & 1 deletion apis/grpc/v1/vald/upsert.pb.go

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

2 changes: 2 additions & 0 deletions apis/proto/v1/payload/payload.proto
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ message Object {
ID id = 1 [(validate.rules).repeated.min_items = 2];
// Filter configurations.
Filter.Config filters = 2;
// Only fetch the vector id and timestamp
bool without_vector = 3;
}

// Represent the ID and distance pair.
Expand Down
7 changes: 7 additions & 0 deletions apis/swagger/v1/vald/apis/proto/v1/vald/object.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
"in": "path",
"required": true,
"type": "string"
},
{
"name": "withoutVector",
"description": "Only fetch the vector id and timestamp.",
"in": "query",
"required": false,
"type": "boolean"
}
],
"tags": ["Object"]
Expand Down
4 changes: 3 additions & 1 deletion pkg/agent/core/ngt/handler/grpc/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ func (s *server) GetObject(ctx context.Context, id *payload.Object_VectorRequest
}
res = payload.Object_VectorFromVTPool()
res.Id = uuid
res.Vector = vec
res.Timestamp = ts
if !id.GetWithoutVector() {
res.Vector = vec
}
return res, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/index/job/correction/service/corrector.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@
Id: &payload.Object_ID{
Id: targetReplica.vec.GetId(),
},
// FIXME: To make the processing faster. We can do this because there's no need to get the vector itself to detect inconsistency.
// If a vector turned out to be corrected, then we need to get the vector again with the vector data.
WithoutVector: true,

Check warning on line 302 in pkg/index/job/correction/service/corrector.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/correction/service/corrector.go#L300-L302

Added lines #L300 - L302 were not covered by tests
})
if err != nil {
if st, ok := status.FromError(err); !ok {
Expand Down
Loading