From 87b3c25b15dedc89f85c6d515744a74b9b883e13 Mon Sep 17 00:00:00 2001 From: "yihao.dai" Date: Wed, 13 Mar 2024 10:35:04 +0800 Subject: [PATCH] fix: Fix binlog import (#31205) 1. File type validation is omitted during binlog import. 2. System fields are appended to the schema during binlog import. issue: https://github.com/milvus-io/milvus/issues/28521 Signed-off-by: bigsheeper --- internal/proxy/impl.go | 14 +++++++++----- internal/util/importutilv2/binlog/reader.go | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/internal/proxy/impl.go b/internal/proxy/impl.go index fe8b95e345..e0e0dd5502 100644 --- a/internal/proxy/impl.go +++ b/internal/proxy/impl.go @@ -5631,11 +5631,15 @@ func (node *Proxy) ImportV2(ctx context.Context, req *internalpb.ImportRequest) resp.Status = merr.Status(merr.WrapErrParameterInvalidMsg("import request is empty")) return resp, nil } - for _, file := range req.GetFiles() { - _, err = importutilv2.GetFileType(file) - if err != nil { - resp.Status = merr.Status(err) - return resp, nil + isBackup := importutilv2.IsBackup(req.GetOptions()) + if !isBackup { + // check file type + for _, file := range req.GetFiles() { + _, err = importutilv2.GetFileType(file) + if err != nil { + resp.Status = merr.Status(err) + return resp, nil + } } } importRequest := &internalpb.ImportRequestInternal{ diff --git a/internal/util/importutilv2/binlog/reader.go b/internal/util/importutilv2/binlog/reader.go index b3cd1d8485..2d1763702a 100644 --- a/internal/util/importutilv2/binlog/reader.go +++ b/internal/util/importutilv2/binlog/reader.go @@ -48,6 +48,7 @@ func NewReader(ctx context.Context, tsStart, tsEnd uint64, ) (*reader, error) { + schema = typeutil.AppendSystemFields(schema) r := &reader{ ctx: ctx, cm: cm,