milvus-io / milvus

A cloud-native vector database, storage for next generation AI applications
https://milvus.io
Apache License 2.0
30.03k stars 2.88k forks source link

[Bug]: [GOSDK] String "1" is invalid collection name but valid partition name #34591

Closed ThreadDao closed 3 months ago

ThreadDao commented 3 months ago

Is there an existing issue for this?

Environment

- Milvus version: master-20240710-2f70bbed-amd64
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): go-sdk v2
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

  1. create a collection with name "1" gets error:

    [2024/07/11 11:20:19.127 +08:00] [INFO] [base/milvus_client.go:54] [Response] [method=CreateCollection] [resp="{\"error_code\":5,\"reason\":\"Invalid collection name: 1. the first character of a collection name must be an underscore or letter: invalid parameter\",\"code\":1100,\"detail\":\"Invalid collection name: 1. the first character of a collection name must be an underscore or letter: invalid parameter\"}"]
  2. create a partition with the name "1" succ

    [2024/07/11 11:23:40.622 +08:00] [INFO] [base/milvus_client.go:35] [Request] [method=CreatePartition] [reqs="{\"collection_name\":\"pre_kBJJUG\",\"partition_name\":\"1\"}"]
    [2024/07/11 11:23:40.635 +08:00] [INFO] [base/milvus_client.go:54] [Response] [method=CreatePartition] [resp={}]
    [2024/07/11 11:23:40.635 +08:00] [DEBUG] [base/milvus_client.go:55] [Cost] [method=CreatePartition] [cost=12.374996ms]
    [2024/07/11 11:23:40.635 +08:00] [DEBUG] [testcases/partition_test.go:100] [err] []
    [2024/07/11 11:23:40.635 +08:00] [INFO] [base/milvus_client.go:35] [Request] [method=HasPartition] [reqs="{\"collection_name\":\"pre_kBJJUG\",\"partition_name\":\"1\"}"]
    [2024/07/11 11:23:40.642 +08:00] [INFO] [base/milvus_client.go:54] [Response] [method=HasPartition] [resp="{\"status\":{},\"value\":true}"]
    [2024/07/11 11:23:40.642 +08:00] [DEBUG] [base/milvus_client.go:55] [Cost] [method=HasPartition] [cost=7.384626ms]
    [2024/07/11 11:23:40.642 +08:00] [DEBUG] [testcases/partition_test.go:103] ["has partition '1' "] [has=true]
    [2024/07/11 11:23:40.642 +08:00] [INFO] [base/milvus_client.go:35] [Request] [method=ShowPartitions] [reqs="{\"collection_name\":\"pre_kBJJUG\"}"]
    [2024/07/11 11:23:40.650 +08:00] [INFO] [base/milvus_client.go:54] [Response] [method=ShowPartitions] [resp="{\"status\":{},\"partition_names\":[\"_default\",\"1\"],\"partitionIDs\":[451044672865729760,451044672865729766],\"created_timestamps\":[451062850011529224,451062850024374276],\"created_utc_timestamps\":[1720668220564,1720668220613]}"]
    [2024/07/11 11:23:40.650 +08:00] [DEBUG] [base/milvus_client.go:55] [Cost] [method=ShowPartitions] [cost=8.24947ms]
    [2024/07/11 11:23:40.650 +08:00] [DEBUG] [testcases/partition_test.go:105] [partitions] [names="[_default,1]"]

Expected Behavior

No response

Steps To Reproduce

func TestCreatePartitionInvalidDebug(t *testing.T) {
    ctx := hp.CreateContext(t, time.Second*common.DefaultTimeout)
    mc := createDefaultMilvusClient(ctx, t)

    // create collection
    _, schema := hp.CollPrepare.CreateCollection(ctx, t, mc, hp.NewCreateCollectionParams(hp.Int64Vec), hp.TNewFieldsOption(), hp.TNewSchemaOption())

    // create partition with invalid name
    err := mc.CreatePartition(ctx, client.NewCreatePartitionOption(schema.CollectionName, "1"))
    log.Debug("err", zap.Error(err))

    has, _ := mc.HasPartition(ctx, client.NewHasPartitionOption(schema.CollectionName, "1"))
    log.Debug("has partition '1' ", zap.Bool("has", has))
    pars, _ := mc.ListPartitions(ctx, client.NewListPartitionOption(schema.CollectionName))
    log.Debug("partitions", zap.Strings("names", pars))
}


### Milvus Log

_No response_

### Anything else?

_No response_
yanliang567 commented 3 months ago

/assign @congqixia /unassign

congqixia commented 3 months ago

@yanliang567 we discussed this topic offline, the conclusion was that partition name start with "1" is valid /assign @yanliang567

yanliang567 commented 3 months ago

right, check this issue for discussion: https://github.com/milvus-io/milvus/issues/32998

yanliang567 commented 3 months ago

/assign @ThreadDao won't fix then.

ThreadDao commented 3 months ago

@yanliang567 @congqixia ok. It's just a little weird, because the error message: The first character of a partition name must be an underscore or letter when the name is "%a"