-
Notifications
You must be signed in to change notification settings - Fork 891
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
Custom search attributes validation per store #4655
Custom search attributes validation per store #4655
Conversation
@@ -95,6 +95,10 @@ var _ store.VisibilityStore = (*visibilityStore)(nil) | |||
var ( | |||
errUnexpectedJSONFieldType = errors.New("unexpected JSON field type") | |||
|
|||
minTime = time.Unix(0, 0).UTC() | |||
maxTime = time.Unix(0, math.MaxInt64).UTC() | |||
maxStringLength = 32766 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think search attribute already has size limit of 2KB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, still better to have this already in place just in case in the future we (or an OSS user) change it limit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, storage specific validators should reflect all storage limitation. DC value can be changed.
} | ||
} | ||
if err != nil { | ||
if ignoreInvalidValues { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we should check ignoreInvalidValues before validation? What is the point of doing the validation then ignore it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the case the task with bad value. We want to check and ignore the value if it's invalid.
9d40345
to
9cd238d
Compare
002a803
to
95088c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, and I would really like to see unit tests for the new validator and unit test in search attributes validator, which tests "integration" between new and old validators. Can be done in separate PR.
95088c7
to
c3ede59
Compare
What changed?
Add custom search attributes validation to
VisibilityStore
interface, and implements ES constraints.Why?
Each store can have different constraint that might reject the value when inserting.
Eg: In ES, dates can only be between 1970 and 2262.
How did you test it?
Potential risks
Is hotfix candidate?