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

Hide scheduler workflows with new search attribute #3123

Merged
merged 8 commits into from
Aug 9, 2022
Merged

Conversation

dnr
Copy link
Member

@dnr dnr commented Jul 21, 2022

What changed?

  • new predefined TemporalNamespaceDivision search attribute + schema changes
  • set via standard search attributes
  • query with new field in ListWorkflowExecutionsRequest or in query string
  • all queries default to adding a "must not exist" on the new attribute, unless explicitly selected for
  • this only works for ES, standard visibility ignores search attributes and the new queries have no effect

Why?
To hide scheduler, batch operation, other internal workflows from normal visibility operations in user namespaces

How did you test it?
unit tests + manual test

Potential risks

Is hotfix candidate?

@@ -86,6 +87,10 @@ func (ni *nameInterceptor) Name(name string, usage query.FieldNameUsage) (string
}
}

if fieldName == searchattribute.TemporalNamespaceDivision && usage == query.FieldNameFilter {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels icky. Any better ideas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it is supposed to be used.

new_mapping='
{
"properties": {
"TemporalNamespaceDivision": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting kind of annoying. What do you think about auto-registering new pre-defined on upgrade? Or the cli tool?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are starting to get ES schema changes more often and expectation was the opposite. Ideally, special ES CLI tool needs to be added (there is an open #2977 PR for it) which will handle all ES schema updates. I would leave it as is for now.

service/frontend/workflowHandler.go Outdated Show resolved Hide resolved
@yiminc
Copy link
Member

yiminc commented Jul 21, 2022

Looks reasonable to me. cc @alexshtin

@dnr dnr marked this pull request as ready for review July 29, 2022 01:09
@dnr dnr requested a review from a team as a code owner July 29, 2022 01:09
service/frontend/workflowHandler.go Outdated Show resolved Hide resolved
new_mapping='
{
"properties": {
"TemporalNamespaceDivision": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are starting to get ES schema changes more often and expectation was the opposite. Ideally, special ES CLI tool needs to be added (there is an open #2977 PR for it) which will handle all ES schema updates. I would leave it as is for now.

@@ -86,6 +87,10 @@ func (ni *nameInterceptor) Name(name string, usage query.FieldNameUsage) (string
}
}

if fieldName == searchattribute.TemporalNamespaceDivision && usage == query.FieldNameFilter {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how it is supposed to be used.

@dnr dnr enabled auto-merge (squash) August 9, 2022 05:48
@dnr dnr merged commit b27975d into temporalio:master Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants