9 Commits

Author SHA1 Message Date
Vladyslav Simonenko
400e2ad37f Add external payload size and count to Visibility Schema (#9007)
## What changed?
Added TemporalExternalPayloadSizeBytes and TemporalExternalPayloadCount
to Visibility Schema as pre-defined search attribute.

## Why?
We are planning to expose external payload size and count as the search
attributes. They are pre-defined, rather than system, because they won't
be set on every single workflow, but only ones which store large
payloads externally (e.g. in S3).

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
Incorrectly modified schema
2026-01-23 11:42:08 -08:00
Shahab Tajik
882268cc71 Add TemporalUsedWorkerDeploymentVersions SA (#8886)
## What changed?
Add `TemporalUsedWorkerDeploymentVersions` search attribute to contain
all the Deployment Versions that completed at least one workflow tasks
for the execution.

This Search Attribute replaces, now deprecated, `BuildIds` Search
attribute.

## Why?
Needed a replacement for `BuildIds` Search attribute which holds
internal values and prefixes.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit test(s)
- [x] added new functional test(s)

## Potential risks
None.
2026-01-04 21:36:44 -05:00
Alan Wu
c2da806973 Update Visibility Schema with new TemporalLowCardinalityKeyword01 column (#8729)
## What changed?
Update Visibility Schema with new TemporalLowCardinalityKeyword01
column.

## Why?
Allocate additional column/ES mapping for CHASM Low Cardinality Keyword
search attribute, meant for CHASM Archetype execution status.

TemporalLowCardinalityKeyword fields are stored no differently than
Keyword fields, but have a user requirement that values are from a low
cardinal set, eg. Enums, since they support GROUP BY filtering. Normal
Keyword fields do not support GROUP BY query filters.

Each archetype can track its own execution status as any CHASM Low
Cardinality Keyword field.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [X] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-12-05 17:49:03 +00:00
Alan Wu
19ac3385fc Add Archetype search attributes for CHASM Visibility (#8390)
## What changed?
Adds Archetype search attributes schema for CHASM Visibility. Functions
similarly to custom search attributes, where pre-allocated column names
or explicit properties, called field names, will map to user aliased
Archetype search attributes.

Adds Archetype search attributes to ClusterMetadata to save all
pre-allocated field name to type mappings in the Cassandra backed
ClusterMetadata store.

## Why?
Required for CHASM Visibility support. Component authors will register a
component with tagged attribute values for querying (List, Count APIs
for now), and executions of the registered component will be tagged with
these attributes.

Archetype name used for querying is left out of this schema change, may
require further discussion.

## How did you test it?
- [X] built
- [X] run locally and tested manually
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-10-31 15:24:26 -04:00
Rob Holland
389d1ab7d1 Fix command line flag argument parsing for elasticsearch-tool. (#8445)
## What changed?
Reverts to urlfav/cli v1 as per other tools and uses shared flag aliases
where appropriate for more consistency with the other tools.

Works around Go embed's lack of support for symlinks by hard coding the
path to the index template to use. Adds a test to ensure this doesn't
get out of sync with the latest.

## Why?
Better consistency with other tools and being able to actually find the
index template :)

## How did you test it?
- [x] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-10-08 07:49:42 +01:00
Rob Holland
1dc6264f4f Add Elasticsearch CLI tool (#8296)
## What changed?

- Revive and update original PR #2977 for Elasticsearch CLI tool

Replaces manual curl invocations with a proper CLI tool that leverages
Temporal's built-in Elasticsearch auth providers and provides better
error handling and logging.

## How did you test it?
- [x] built
- [x] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks

None, net new.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces `temporal-elasticsearch-tool` for ES schema/index
management and ping, extends ES client APIs, embeds ES schema, and
updates Makefile to use the tool.
> 
> - **Tools**:
> - New `temporal-elasticsearch-tool` CLI with commands: `setup-schema`,
`update-schema`, `create-index`, `drop-index`, `ping`; supports AWS auth
and uses embedded schema files.
> - Adds entrypoint `cmd/tools/elasticsearch`, README, and basic tests.
> - **Elasticsearch Client**:
> - Extends `CLIClient` with `ClusterPutSettings`, `IndexPutTemplate`,
`IndexPutMapping`, `Ping` and implements them (v7) using raw requests
where needed; allows custom HTTP client from config (e.g., AWS-signed).
> - **Schema**:
> - Embeds ES v7 cluster settings and index template
(`schema.Embedded...` accessors).
> - **Build/Makefile**:
> - Adds build target and binary cleanup for
`temporal-elasticsearch-tool`; updates `install-schema-es` and
`install-schema-xdc` to use the CLI instead of curl.
> - Includes binary in `.goreleaser.yml`; excludes it in
`.dockerignore`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b37864809a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2025-10-02 10:52:21 +01:00
Alex Shtin
91893f1064 Remove license header from every file (#7689)
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.

## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
2025-05-01 18:50:21 -07:00
Gary Lee
20156eb1ad Fix sql tool error in windows (#7519)
## What changed?
Use `path.Join()` instead of `filepath.Join()`

## Why?
#7454

## How did you test it?
Tested locally

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
None

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->
None

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
No
2025-04-11 18:51:14 +00:00
Carly de Frondeville
46e90391f4 support embedded schema for cassandra and sql update-schema and setup-schema (#5195)
## What changed?


This change adds a flag to `temporal-sql-tool` and
`temporal-cassandra-tool`'s `update-schema` and `setup-schema` to
specify an embedded schema instead of a path to the schema directory or
schema file.

```
NAME:
   temporal-cassandra-tool update-schema - update cassandra schema to a specific version

USAGE:
   temporal-cassandra-tool update-schema [command options] [arguments...]

OPTIONS:
   --version value, -v value      target version for the schema update, defaults to latest
   --schema-dir value, -d value   path to directory containing versioned schema
   --schema-name value, -s value  name of embedded versioned schema, one of: [cassandra/temporal cassandra/visibility]
```

```
NAME:
   temporal-sql-tool update-schema - update sql schema to a specific version

USAGE:
   temporal-sql-tool update-schema [command options] [arguments...]

OPTIONS:
   --version value, -v value      target version for the schema update, defaults to latest
   --schema-dir value, -d value   path to directory containing versioned schema
   --schema-name value, -s value  name of embedded versioned schema, one of: [mysql/v57/temporal mysql/v57/visibility mysql/v8/temporal mysql/v8/visibility postgresql/v96/temporal postgresql/v96/visibility postgresql/v12/temporal postgresql/v12/visibility]
```


## Why?
We want to embed the db schemas in the `temporal-sql-tool` and
`temporal-cassandra-tool` with `go:embed` so that customers can simply
specify which schema they want using a flag instead of having to copy
the schema files to wherever they're running the db tool and passing the
path to the schema.

https://github.com/temporalio/temporal/issues/2059

## How did you test it?
I wrote a new unit test for reading the embedded file system, and the
existing codepath of the changed functions are all tested by the
existing unit tests. I also updated the unit test for config validation
to reflect the new changes.

I tested this locally with a locally running Postgres. Since the more
complex changes are in `updatetask.go`, which is shared by the sql and
the cassandra tool, I think there is no need to also test with a real
cassandra db. I also built the cassandra command line tool and confirmed
that the flags and validation checks behaved as expected.

## Potential risks
Schema updates could fail. But the changes are pretty contained to the
new `-s` flag which isn't used anywhere in production yet, so the risk
is very low. The code for the `-d` flag remained basically the same.

## Is hotfix candidate?
No
2023-12-05 12:22:06 -08:00