diff --git a/worker/export.go b/worker/export.go index f4fc53021b5..dc4adf1339a 100644 --- a/worker/export.go +++ b/worker/export.go @@ -32,6 +32,7 @@ import ( "github.com/hypermodeinc/dgraph/v25/enc" "github.com/hypermodeinc/dgraph/v25/posting" "github.com/hypermodeinc/dgraph/v25/protos/pb" + "github.com/hypermodeinc/dgraph/v25/tok/hnsw" "github.com/hypermodeinc/dgraph/v25/types" "github.com/hypermodeinc/dgraph/v25/types/facets" "github.com/hypermodeinc/dgraph/v25/x" @@ -821,6 +822,10 @@ func exportInternal(ctx context.Context, in *pb.ExportRequest, db *badger.DB, return false } } + + if strings.Contains(pk.Attr, hnsw.VecKeyword) { + return false + } return pk.IsData() } diff --git a/worker/mutation.go b/worker/mutation.go index c3d29a8cc62..929b13274d0 100644 --- a/worker/mutation.go +++ b/worker/mutation.go @@ -9,6 +9,7 @@ import ( "bytes" "context" "math" + "strings" "sync" "sync/atomic" "time" @@ -31,6 +32,7 @@ import ( "github.com/hypermodeinc/dgraph/v25/posting" "github.com/hypermodeinc/dgraph/v25/protos/pb" "github.com/hypermodeinc/dgraph/v25/schema" + "github.com/hypermodeinc/dgraph/v25/tok/hnsw" "github.com/hypermodeinc/dgraph/v25/types" "github.com/hypermodeinc/dgraph/v25/x" ) @@ -512,6 +514,10 @@ func ValidateAndConvert(edge *pb.DirectedEdge, su *pb.SchemaUpdate) error { return nil } + if strings.Contains(su.Predicate, hnsw.VecKeyword) { + return errors.Errorf("Not allowed to insert mutations in vector index keys, edge: [%v]", edge) + } + storageType := posting.TypeID(edge) schemaType := types.TypeID(su.ValueType)