-
Notifications
You must be signed in to change notification settings - Fork 911
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Worker versioning - add BuildIDs search attribute (#4284)
- Loading branch information
Showing
37 changed files
with
687 additions
and
294 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule api
updated
4 files
+4 −0 | temporal/api/common/v1/message.proto | |
+1 −0 | temporal/api/history/v1/message.proto | |
+4 −0 | temporal/api/workflow/v1/message.proto | |
+0 −5 | temporal/api/workflowservice/v1/request_response.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
versioned/v4/index_template_v7.json | ||
versioned/v5/index_template_v7.json |
87 changes: 87 additions & 0 deletions
87
schema/elasticsearch/visibility/versioned/v5/index_template_v7.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"order": 0, | ||
"index_patterns": ["temporal_visibility_v1*"], | ||
"settings": { | ||
"index": { | ||
"number_of_shards": "1", | ||
"number_of_replicas": "0", | ||
"auto_expand_replicas": "0-2", | ||
"search.idle.after": "365d", | ||
"sort.field": ["CloseTime", "StartTime", "RunId"], | ||
"sort.order": ["desc", "desc", "desc"], | ||
"sort.missing": ["_first", "_first", "_first"] | ||
} | ||
}, | ||
"mappings": { | ||
"dynamic": "false", | ||
"properties": { | ||
"NamespaceId": { | ||
"type": "keyword" | ||
}, | ||
"TemporalNamespaceDivision": { | ||
"type": "keyword" | ||
}, | ||
"WorkflowId": { | ||
"type": "keyword" | ||
}, | ||
"RunId": { | ||
"type": "keyword" | ||
}, | ||
"WorkflowType": { | ||
"type": "keyword" | ||
}, | ||
"StartTime": { | ||
"type": "date_nanos" | ||
}, | ||
"ExecutionTime": { | ||
"type": "date_nanos" | ||
}, | ||
"CloseTime": { | ||
"type": "date_nanos" | ||
}, | ||
"ExecutionDuration": { | ||
"type": "long" | ||
}, | ||
"ExecutionStatus": { | ||
"type": "keyword" | ||
}, | ||
"TaskQueue": { | ||
"type": "keyword" | ||
}, | ||
"TemporalChangeVersion": { | ||
"type": "keyword" | ||
}, | ||
"BatcherNamespace": { | ||
"type": "keyword" | ||
}, | ||
"BatcherUser": { | ||
"type": "keyword" | ||
}, | ||
"BinaryChecksums": { | ||
"type": "keyword" | ||
}, | ||
"HistoryLength": { | ||
"type": "long" | ||
}, | ||
"StateTransitionCount": { | ||
"type": "long" | ||
}, | ||
"TemporalScheduledStartTime": { | ||
"type": "date_nanos" | ||
}, | ||
"TemporalScheduledById": { | ||
"type": "keyword" | ||
}, | ||
"TemporalSchedulePaused": { | ||
"type": "boolean" | ||
}, | ||
"HistorySizeBytes": { | ||
"type": "long" | ||
}, | ||
"BuildIds": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"aliases": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu -o pipefail | ||
|
||
# Prerequisites: | ||
# - jq | ||
# - curl | ||
|
||
# Input parameters. | ||
: "${ES_SCHEME:=http}" | ||
: "${ES_SERVER:=127.0.0.1}" | ||
: "${ES_PORT:=9200}" | ||
: "${ES_USER:=}" | ||
: "${ES_PWD:=}" | ||
: "${ES_VERSION:=v7}" | ||
: "${ES_VIS_INDEX_V1:=temporal_visibility_v1_dev}" | ||
: "${AUTO_CONFIRM:=}" | ||
: "${SLICES_COUNT:=auto}" | ||
|
||
es_endpoint="${ES_SCHEME}://${ES_SERVER}:${ES_PORT}" | ||
|
||
echo "=== Step 0. Sanity check if Elasticsearch index is accessible ===" | ||
|
||
if ! curl --silent --fail --user "${ES_USER}":"${ES_PWD}" "${es_endpoint}/${ES_VIS_INDEX_V1}/_stats/docs" --write-out "\n"; then | ||
echo "Elasticsearch index ${ES_VIS_INDEX_V1} is not accessible at ${es_endpoint}." | ||
exit 1 | ||
fi | ||
|
||
echo "=== Step 1. Add new builtin search attributes ===" | ||
|
||
new_mapping=' | ||
{ | ||
"properties": { | ||
"BuildIds": { | ||
"type": "keyword" | ||
} | ||
} | ||
} | ||
' | ||
|
||
if [ -z "${AUTO_CONFIRM}" ]; then | ||
read -p "Add new builtin search attributes to the index ${ES_VIS_INDEX_V1}? (N/y)" -n 1 -r | ||
echo | ||
else | ||
REPLY="y" | ||
fi | ||
if [ "${REPLY}" = "y" ]; then | ||
curl --silent --fail --user "${ES_USER}":"${ES_PWD}" -X PUT "${es_endpoint}/${ES_VIS_INDEX_V1}/_mapping" -H "Content-Type: application/json" --data-binary "$new_mapping" | jq | ||
# Wait for mapping changes to go through. | ||
until curl --silent --user "${ES_USER}":"${ES_PWD}" "${es_endpoint}/_cluster/health/${ES_VIS_INDEX_V1}" | jq --exit-status '.status=="green" | .'; do | ||
echo "Waiting for Elasticsearch index ${ES_VIS_INDEX_V1} become green." | ||
sleep 1 | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
schema/mysql/v8/visibility/versioned/v1.3/add_build_ids_search_attribute.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE executions_visibility ADD COLUMN BuildIds JSON GENERATED ALWAYS AS (search_attributes->'BuildIds'); | ||
CREATE INDEX by_build_ids ON executions_visibility (namespace_id, (CAST(BuildIds AS CHAR(255) ARRAY)), (COALESCE(close_time, CAST('9999-12-31 23:59:59' AS DATETIME))) DESC, start_time DESC, run_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"CurrVersion": "1.3", | ||
"MinCompatibleVersion": "0.1", | ||
"Description": "add history size bytes", | ||
"Description": "add history size bytes and build IDs visibility columns and indices", | ||
"SchemaUpdateCqlFiles": [ | ||
"add_history_size_bytes.sql" | ||
"add_history_size_bytes.sql", | ||
"add_build_ids_search_attribute.sql" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
schema/postgresql/v12/visibility/versioned/v1.3/add_build_ids_search_attribute.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE executions_visibility ADD COLUMN BuildIds JSONB GENERATED ALWAYS AS (search_attributes->'BuildIds') STORED; | ||
CREATE INDEX by_build_ids ON executions_visibility USING GIN (namespace_id, BuildIds jsonb_path_ops); |
5 changes: 3 additions & 2 deletions
5
schema/postgresql/v12/visibility/versioned/v1.3/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"CurrVersion": "1.3", | ||
"MinCompatibleVersion": "0.1", | ||
"Description": "add history size bytes", | ||
"Description": "add history size bytes and build IDs visibility columns and indices", | ||
"SchemaUpdateCqlFiles": [ | ||
"add_history_size_bytes.sql" | ||
"add_history_size_bytes.sql", | ||
"add_build_ids_search_attribute.sql" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.