milvus-io / milvus

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

[Bug]: The directory-based-walk-api of Milvus metaKv can see other directories #36178

Open chyezh opened 2 months ago

chyezh commented 2 months ago

Is there an existing issue for this?

Environment

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

Current Behavior

func (kv *etcdKV) WalkWithPrefix(prefix string, paginationSize int, fn func([]byte, []byte) error) error {
    start := time.Now()
    prefix = path.Join(kv.rootPath, prefix)

    batch := int64(paginationSize)
    opts := []clientv3.OpOption{
        clientv3.WithSort(clientv3.SortByKey, clientv3.SortAscend),
        clientv3.WithLimit(batch),
        clientv3.WithRange(clientv3.GetPrefixRangeEnd(prefix)),
    }

WalkWithPrefix and LoadWithPrefix will truncate the last / of prefix parameter by calling path.Join. so the WalkWithPrefix can see the other directories.

Expected Behavior

No response

Steps To Reproduce

No response

Milvus Log

No response

Anything else?

No response

chyezh commented 2 months ago

/assign

czs007 commented 2 months ago

+1

stale[bot] commented 23 hours ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.