Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: partition name breaks the name rule if trying to create a parititon with name="12name" #32998

Closed
1 task done
yanliang567 opened this issue May 13, 2024 · 5 comments
Closed
1 task done
Assignees
Labels
kind/bug Issues or changes related a bug resolution/won't fix Indicates an issue that can not or will not be fixed triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@yanliang567
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: master-20240508-3d78b90f
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): 2.5.0rc18

Current Behavior

image
"12name" starts with number, so it is not a valid partition name for milvus, but milvus did not check that.

Expected Behavior

As the doc of https://milvus.io/docs/limitations.md says:
image
Milvus shall report error if name is invalid

Steps To Reproduce

No response

Milvus Log

No response

Anything else?

No response

@yanliang567 yanliang567 added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 13, 2024
@yanliang567 yanliang567 self-assigned this May 13, 2024
@yanliang567
Copy link
Contributor Author

/assign @congqixia
/unassign

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 13, 2024
@yanliang567 yanliang567 added this to the 2.4.2 milestone May 13, 2024
congqixia added a commit to congqixia/milvus that referenced this issue May 13, 2024
@congqixia
Copy link
Contributor

It's easy to forbid partition name starting with number, but this will cause legacy partitions unable to be operated on after upgraded to this image.
Can we use non-restrict mode verifying partition name other than CreatePartition?

func validatePartitionTag(partitionTag string, strictCheck bool) error {
partitionTag = strings.TrimSpace(partitionTag)
invalidMsg := "Invalid partition name: " + partitionTag + ". "
if partitionTag == "" {
msg := invalidMsg + "Partition name should not be empty."
return errors.New(msg)
}
if len(partitionTag) > Params.ProxyCfg.MaxNameLength.GetAsInt() {
msg := invalidMsg + "The length of a partition name must be less than " + Params.ProxyCfg.MaxNameLength.GetValue() + " characters."
return errors.New(msg)
}
if strictCheck {
firstChar := partitionTag[0]
if firstChar != '_' && !isAlpha(firstChar) && !isNumber(firstChar) {
msg := invalidMsg + "The first character of a partition name must be an underscore or letter."
return errors.New(msg)
}
tagSize := len(partitionTag)
for i := 1; i < tagSize; i++ {
c := partitionTag[i]
if c != '_' && !isAlpha(c) && !isNumber(c) {
msg := invalidMsg + "Partition name can only contain numbers, letters and underscores."
return errors.New(msg)
}
}
}
return nil
}

@czs007 @xiaofan-luan @yanliang567 WDYGT?

@xiaofan-luan
Copy link
Contributor

keep the old convention?
I don't foresee any reason right now we need to forbid name start with numeric number. but this is not recommneded

@congqixia
Copy link
Contributor

keep the old convention? I don't foresee any reason right now we need to forbid name start with numeric number. but this is not recommneded

lgtm, +1

@yanliang567 yanliang567 added the resolution/won't fix Indicates an issue that can not or will not be fixed label May 13, 2024
@yanliang567
Copy link
Contributor Author

close as won't for compatible with previous releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug resolution/won't fix Indicates an issue that can not or will not be fixed triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants