-
Notifications
You must be signed in to change notification settings - Fork 882
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
Support visibility dual write to different ES indices #2359
Conversation
if overStartTime { | ||
params.Sorter = append(params.Sorter, elastic.NewFieldSort(searchattribute.StartTime).Desc()) | ||
} else { | ||
params.Sorter = append(params.Sorter, elastic.NewFieldSort(searchattribute.CloseTime).Desc()) | ||
} | ||
|
||
// RunID is explicit tiebreaker. | ||
params.Sorter = append(params.Sorter, elastic.NewFieldSort(searchattribute.RunID).Desc()) | ||
// RunID is explicit tiebreaker. | ||
params.Sorter = append(params.Sorter, elastic.NewFieldSort(searchattribute.RunID).Desc()) | ||
} |
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.
Please add TODO to remove this else
block together with v2IndexPrefix
const as soon as new approach is proven to work.
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.
Changed to use the default sorting order in all cases.
@@ -138,7 +179,7 @@ func NewStandardManager( | |||
} | |||
|
|||
func NewAdvancedManager( | |||
defaultIndexName string, | |||
indexName string, |
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.
The reason is was called defaultIndexName
because there is partial support for index per namespace. Metadata has indexName
field which is not propagated and used yet. The one from config supposed to be default index name if it is not configured on namespace level. I think you should rename it back.
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.
reverted
common/dynamicconfig/constants.go
Outdated
@@ -70,7 +70,9 @@ var Keys = map[Key]string{ | |||
AdvancedVisibilityPersistenceMaxReadQPS: "system.advancedVisibilityPersistenceMaxReadQPS", | |||
AdvancedVisibilityPersistenceMaxWriteQPS: "system.advancedVisibilityPersistenceMaxWriteQPS", | |||
AdvancedVisibilityWritingMode: "system.advancedVisibilityWritingMode", | |||
EnableWriteToSecondaryVisibility: "system.enableWriteToSecondaryVisibility", |
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.
may be:
EnableWriteToSecondaryVisibility: "system.enableWriteToSecondaryVisibility", | |
EnableWriteToSecondaryAdvancedVisibility: "system.enableWriteToSecondaryAdvancedVisibility", |
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.
done
@@ -44,7 +44,7 @@ func NewManager( | |||
persistenceCfg config.Persistence, | |||
persistenceResolver resolver.ServiceResolver, | |||
|
|||
defaultIndexName string, | |||
esConfig *esclient.Config, |
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 would pass both index names here rather than taking dependency on the config.
@@ -80,12 +81,18 @@ type ( | |||
// GetVisibilityIndex return visibility index name from Elasticsearch config or empty string if it is not defined. | |||
func (cfg *Config) GetVisibilityIndex() string { | |||
if cfg == nil { | |||
// Empty string is be used as default index name when Elasticsearch is not configured. |
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 was important comment. Why did you remove it? It had grammar errors though.
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 will add this back. But how is it supposed to work if user does not specify index name?
managerSelector interface { | ||
readManager(namespace namespace.Name) manager.VisibilityManager | ||
writeManagers() ([]manager.VisibilityManager, error) | ||
} | ||
|
||
sqlToESManagerSelector struct { | ||
enableAdvancedVisibilityRead dynamicconfig.BoolPropertyFnWithNamespaceFilter | ||
advancedVisibilityWritingMode dynamicconfig.StringPropertyFn | ||
stdVisibilityManager manager.VisibilityManager | ||
advVisibilityManager manager.VisibilityManager | ||
} | ||
|
||
esManagerSelector struct { |
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.
Please place all these structs and their methods in separate files. I hate to mix structs with methods in one file (I know we have many of those but it is just a legacy and I am constantly fixing it).
common/dynamicconfig/constants.go
Outdated
@@ -383,8 +385,12 @@ const ( | |||
AdvancedVisibilityPersistenceMaxWriteQPS | |||
// AdvancedVisibilityWritingMode is key for how to write to advanced visibility | |||
AdvancedVisibilityWritingMode | |||
// EnableWriteToSecondaryAdvancedVisibility is the config to enable write to secondary visibility for elastic search |
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.
// EnableWriteToSecondaryAdvancedVisibility is the config to enable write to secondary visibility for elastic search | |
// EnableWriteToSecondaryAdvancedVisibility is the config to enable write to secondary visibility for Elasticsearch. |
common/dynamicconfig/constants.go
Outdated
// EnableReadVisibilityFromES is key for enable read from elastic search | ||
EnableReadVisibilityFromES | ||
// EnableReadFromSecondaryAdvancedVisibility is the config to enable read from secondary elastic search |
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.
// EnableReadFromSecondaryAdvancedVisibility is the config to enable read from secondary elastic search | |
// EnableReadFromSecondaryAdvancedVisibility is the config to enable read from secondary Elasticsearch. |
* Change order by clauses in query and update V1 index template. Index created by the old template will continue to function, but won't see the query performance improvement. * Support visibility dual write to different ES indices. * Add additional dynamic configs to control visibility dual write behavior.
* Change order by clauses in query and update V1 index template. Index created by the old template will continue to function, but won't see the query performance improvement. * Support visibility dual write to different ES indices. * Add additional dynamic configs to control visibility dual write behavior.
PR temporalio#2359 added support for dual write to different ES indices. There was no change to the config template to enable this feature.
PR temporalio#2359 added support for dual write to different ES indices. There was no change to the config template to enable this feature. This commit will set secondary_visibility if env ES_SEC_VIS_INDEX is set.
What changed?
Support visibility dual write to different ES indices
Add additional dynamic configs to control visibility dual write and read behavior
Why?
To support seamless switch to new ES visibility index
How did you test it?
Local test with 2 ES indices
Potential risks
No. The old index should only be deleted after the new index is verified working.
Is hotfix candidate?
No