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

Improve index correction performance #2234

Merged
merged 20 commits into from
Nov 22, 2023
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
910 changes: 467 additions & 443 deletions apis/docs/v1/docs.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apis/grpc/v1/agent/core/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ const (
SaveIndexRPCName = "SaveIndex"
CreateAndSaveIndexRPCName = "CreateAndSaveIndex"
IndexInfoRPCName = "IndexInfo"
GetTimestampRPCName = "GetTimestamp"
)
41 changes: 26 additions & 15 deletions 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.

38 changes: 38 additions & 0 deletions apis/grpc/v1/agent/core/agent_vtproto.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type AgentClient interface {
CreateAndSaveIndex(ctx context.Context, in *payload.Control_CreateIndexRequest, opts ...grpc.CallOption) (*payload.Empty, error)
// Represent the RPC to get the agent index information.
IndexInfo(ctx context.Context, in *payload.Empty, opts ...grpc.CallOption) (*payload.Info_Index_Count, error)
// Represent the RPC to get the vector metadata. This RPC is mainly used for index correction process
GetTimestamp(ctx context.Context, in *payload.Object_GetTimestampRequest, opts ...grpc.CallOption) (*payload.Object_Timestamp, error)
}

type agentClient struct {
Expand Down Expand Up @@ -96,6 +98,15 @@ func (c *agentClient) IndexInfo(ctx context.Context, in *payload.Empty, opts ...
return out, nil
}

func (c *agentClient) GetTimestamp(ctx context.Context, in *payload.Object_GetTimestampRequest, opts ...grpc.CallOption) (*payload.Object_Timestamp, error) {
out := new(payload.Object_Timestamp)
err := c.cc.Invoke(ctx, "/core.v1.Agent/GetTimestamp", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

// AgentServer is the server API for Agent service.
// All implementations must embed UnimplementedAgentServer
// for forward compatibility
Expand All @@ -108,6 +119,8 @@ type AgentServer interface {
CreateAndSaveIndex(context.Context, *payload.Control_CreateIndexRequest) (*payload.Empty, error)
// Represent the RPC to get the agent index information.
IndexInfo(context.Context, *payload.Empty) (*payload.Info_Index_Count, error)
// Represent the RPC to get the vector metadata. This RPC is mainly used for index correction process
GetTimestamp(context.Context, *payload.Object_GetTimestampRequest) (*payload.Object_Timestamp, error)
mustEmbedUnimplementedAgentServer()
}

Expand All @@ -127,6 +140,9 @@ func (UnimplementedAgentServer) CreateAndSaveIndex(context.Context, *payload.Con
func (UnimplementedAgentServer) IndexInfo(context.Context, *payload.Empty) (*payload.Info_Index_Count, error) {
return nil, status.Errorf(codes.Unimplemented, "method IndexInfo not implemented")
}
func (UnimplementedAgentServer) GetTimestamp(context.Context, *payload.Object_GetTimestampRequest) (*payload.Object_Timestamp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTimestamp not implemented")
}
func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}

// UnsafeAgentServer may be embedded to opt out of forward compatibility for this service.
Expand Down Expand Up @@ -212,6 +228,24 @@ func _Agent_IndexInfo_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler)
}

func _Agent_GetTimestamp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(payload.Object_GetTimestampRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServer).GetTimestamp(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/core.v1.Agent/GetTimestamp",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServer).GetTimestamp(ctx, req.(*payload.Object_GetTimestampRequest))
}
return interceptor(ctx, in, info, handler)
}

// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
Expand All @@ -235,6 +269,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{
MethodName: "IndexInfo",
Handler: _Agent_IndexInfo_Handler,
},
{
MethodName: "GetTimestamp",
Handler: _Agent_GetTimestamp_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "apis/proto/v1/agent/core/agent.proto",
Expand Down
Loading
Loading