diff --git a/pkg/gateway/backup/handler/grpc/handler.go b/pkg/gateway/backup/handler/grpc/handler.go index 8f86ce8c2b7..f9bb6930ee5 100644 --- a/pkg/gateway/backup/handler/grpc/handler.go +++ b/pkg/gateway/backup/handler/grpc/handler.go @@ -411,7 +411,11 @@ func (s *server) Insert(ctx context.Context, req *payload.Insert_Request) (loc * } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } loc, err = s.gateway.Insert(ctx, req, s.copts...) @@ -587,7 +591,11 @@ func (s *server) MultiInsert(ctx context.Context, reqs *payload.Insert_MultiRequ } return nil, err } - reqs.Requests[i].Config.SkipStrictExistCheck = true + if reqs.Requests[i] != nil { + reqs.Requests[i].Config.SkipStrictExistCheck = true + } else { + reqs.Requests[i].Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } ids = append(ids, uuid) } @@ -726,7 +734,11 @@ func (s *server) Update(ctx context.Context, req *payload.Update_Request) (res * } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Update_Config{SkipStrictExistCheck: true} + } } res, err = s.Remove(ctx, &payload.Remove_Request{ @@ -895,7 +907,11 @@ func (s *server) MultiUpdate(ctx context.Context, reqs *payload.Update_MultiRequ } return nil, err } - vec.Config.SkipStrictExistCheck = true + if vec.Config != nil { + vec.Config.SkipStrictExistCheck = true + } else { + vec.Config = &payload.Update_Config{SkipStrictExistCheck: true} + } } ids = append(ids, vec.GetVector().GetId()) ireqs = append(ireqs, &payload.Insert_Request{ @@ -1251,7 +1267,11 @@ func (s *server) Remove(ctx context.Context, req *payload.Remove_Request) (loc * } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Remove_Config{SkipStrictExistCheck: true} + } } loc, err = s.gateway.Remove(ctx, req, s.copts...) diff --git a/pkg/gateway/filter/handler/grpc/handler.go b/pkg/gateway/filter/handler/grpc/handler.go index 8c278e898b5..224f4bf1e4e 100644 --- a/pkg/gateway/filter/handler/grpc/handler.go +++ b/pkg/gateway/filter/handler/grpc/handler.go @@ -795,7 +795,11 @@ func (s *server) Insert(ctx context.Context, req *payload.Insert_Request) (loc * } return nil, status.WrapWithAlreadyExists(fmt.Sprintf("Insert API ID %s already exists", vec.GetId()), err, info.Get()) } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } targets := req.GetConfig().GetFilters().GetTargets() if len(targets) == 0 && len(s.InsertFilters) == 0 { @@ -932,7 +936,11 @@ func (s *server) Update(ctx context.Context, req *payload.Update_Request) (loc * } return nil, status.WrapWithAlreadyExists(fmt.Sprintf("Update API ID %s already exists", vec.GetId()), err, info.Get()) } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Update_Config{SkipStrictExistCheck: true} + } } targets := req.GetConfig().GetFilters().GetTargets() if len(targets) == 0 && len(s.UpdateFilters) == 0 { @@ -1069,7 +1077,11 @@ func (s *server) Upsert(ctx context.Context, req *payload.Upsert_Request) (loc * } return nil, status.WrapWithAlreadyExists(fmt.Sprintf("Upsert API ID %s already exists", vec.GetId()), err, info.Get()) } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Upsert_Config{SkipStrictExistCheck: true} + } } targets := req.GetConfig().GetFilters().GetTargets() if len(targets) == 0 && len(s.UpsertFilters) == 0 { diff --git a/pkg/gateway/lb/handler/grpc/handler.go b/pkg/gateway/lb/handler/grpc/handler.go index eadb86e28d5..e71a6d7be85 100644 --- a/pkg/gateway/lb/handler/grpc/handler.go +++ b/pkg/gateway/lb/handler/grpc/handler.go @@ -762,7 +762,11 @@ func (s *server) Insert(ctx context.Context, req *payload.Insert_Request) (ce *p } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } mu := new(sync.Mutex) @@ -923,7 +927,11 @@ func (s *server) MultiInsert(ctx context.Context, reqs *payload.Insert_MultiRequ } return nil, err } - reqs.Requests[i].Config.SkipStrictExistCheck = true + if reqs.Requests[i] != nil { + reqs.Requests[i].Config.SkipStrictExistCheck = true + } else { + reqs.Requests[i].Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } ids = append(ids, uuid) } @@ -1041,7 +1049,11 @@ func (s *server) Update(ctx context.Context, req *payload.Update_Request) (res * } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Update_Config{SkipStrictExistCheck: true} + } } res, err = s.Remove(ctx, &payload.Remove_Request{ @@ -1209,7 +1221,11 @@ func (s *server) MultiUpdate(ctx context.Context, reqs *payload.Update_MultiRequ } return nil, err } - vec.Config.SkipStrictExistCheck = true + if vec.Config != nil { + vec.Config.SkipStrictExistCheck = true + } else { + vec.Config = &payload.Update_Config{SkipStrictExistCheck: true} + } } ids = append(ids, vec.GetVector().GetId()) ireqs = append(ireqs, &payload.Insert_Request{ @@ -1561,7 +1577,11 @@ func (s *server) Remove(ctx context.Context, req *payload.Remove_Request) (locs } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Remove_Config{SkipStrictExistCheck: true} + } } var mu sync.Mutex locs = &payload.Object_Location{ diff --git a/pkg/gateway/meta/handler/grpc/handler.go b/pkg/gateway/meta/handler/grpc/handler.go index e68d097c599..69413d6b282 100644 --- a/pkg/gateway/meta/handler/grpc/handler.go +++ b/pkg/gateway/meta/handler/grpc/handler.go @@ -567,7 +567,11 @@ func (s *server) Insert(ctx context.Context, req *payload.Insert_Request) (loc * } return nil, err } - req.Config.SkipStrictExistCheck = true + if req.Config != nil { + req.Config.SkipStrictExistCheck = true + } else { + req.Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } uuid := fuid.String() req.Vector.Id = uuid @@ -756,7 +760,11 @@ func (s *server) MultiInsert(ctx context.Context, reqs *payload.Insert_MultiRequ } return nil, err } - reqs.Requests[i].Config.SkipStrictExistCheck = true + if reqs.Requests[i] != nil { + reqs.Requests[i].Config.SkipStrictExistCheck = true + } else { + reqs.Requests[i].Config = &payload.Insert_Config{SkipStrictExistCheck: true} + } } uuid := fuid.String()