Commit Graph

321 Commits

Author SHA1 Message Date
Rodrigo Zhou
847a76923b Unified query converter for Visibility (#8307)
## What changed?
Unify Visibility query converters.

The new query converter is the struct `query.QueryConverter[ExprT]`. The
generic parameter specify the output type of the converter (in ES is
`elastic.Query`, in SQL is `sqlparser.Expr`).

The query converter has a `query.StoreQueryConverter[ExprT]`. This is
the Visibility store specific implementation for building the output
query.

For example, the store needs to implement `BuildAndExpr(exprs)` to tell
the query converter how to build the `AND` expression. In SQL, it's
`*sqlparser.AndExpr{exprs}`. In Elasticsearch, it's
`elastic.NewBoolQuery().Filter(exprs)`.

The store query converter for SQL needs a plugin query converter called
`sqlplugin.VisibilityQueryConverter` which is implemented by each plugin
(MySQL, PostgreSQL, SQLite). This interface is needed to build DB
specific syntax for `KeywordList` and `Text` searches as well as to
build the final `SELECT` statements.

Added dynamic config `system.VisibilityEnableUnifiedQueryConverter` that
acts as switch between the legacy and the unified query converters.

## Why?
There are two query converters: one for Elasticsearch, and another for
SQL.
They are somewhat similar, and have quite a few code duplications for
validation, modifying the query, etc.
Unifying the query converter ensures that we provide the exact same
behavior across different Visibility stores.

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

I've added a lot of unit tests for the new code with coverage close to
100%.

Note that there has been basically no changes to functional tests, which
suggests that the change works well.

## Potential risks
There might be some edge cases that either query converters that this
unified query converter might deal differently.
2025-11-11 01:48:34 +00:00
Shivam
497195390c worker-versioning GA: revision number to handle async workflow inconsistencies. (#8553)
## What changed?
- This PR adds revision number mechanics to handle task dispatch
inconsistencies that could arise since our versioning API's are becoming
eventually-consistent.

## Why?
- Making our versioning API's eventually consistent.

## 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
- There are risks but they are gated by a dynamic config.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Adds revision-number semantics to task dispatch/versioning and
introduces a new per-deployment TQ user-data schema, updating APIs,
persistence, and server logic (DC-gated) with comprehensive tests.
> 
> - **APIs (proto changes)**:
> - Add `revision_number` to `taskqueue.v1.TaskVersionDirective` and
propagate `task_dispatch_revision_number` in History
`Record*TaskStarted` requests.
> - Matching `SyncDeploymentUserDataRequest`: new fields
`deployment_name`, `update_routing_config`, `upsert_versions_data`,
`forget_versions`; response includes `routing_config_changed`. Deprecate
old `update_version_data`/`forget_version` oneof.
> - Deployment API: add `WorkerDeploymentVersionData`; mark
`DeploymentVersionData` deprecated where applicable.
> - **Persistence (task queue user data)**:
> - Extend `DeploymentData` with `deployments_data` (map of deployment →
`WorkerDeploymentData` holding `RoutingConfig` and per-build version
data). Deprecate legacy `versions` and `unversioned_ramp_data` fields.
> - **Server logic**:
> - Matching/History: compute target version using revision numbers;
start workflow deployment transitions using revision-aware decisions;
support mixed old/new schemas when calculating current/ramping.
> - Matching: new helpers to migrate/clean old-format entries, apply
routing-config updates atomically, and prevent query blackholes using
status.
> - Task dispatch carries and records revision number; internal task
struct/plumbing updated.
> - **Dynamic config**:
> - Add `system.useRevisionNumberForWorkerVersioning` (plumbed through
History/Matching) to gate new behavior.
> - **Tests**:
> - Add/expand unit and functional tests covering new schema,
routing-config updates, revision-number behavior, and propagation.
> - **Misc**:
> - Describe/Stats paths updated to read both schemas; minor build/deps
update (api-go replace).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e84f484506. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: ShahabT <shahab.tajik@temporal.io>
2025-11-10 15:11:38 -05:00
michaely520
079e85c479 Gate activity retry stamp behind feature flag (#8607)
## What changed?
- Gating stamp increment on activity retries from
https://github.com/temporalio/temporal/pull/8536/files behind a feature
flag
- Returning err when dropping stale activities on passive so we have
metrics emitted
 
## Why?
- We need stamp increments to only occur after the change from the PR
has fully rolled out to all clusters, else we risk compatibility issues
and dropped tasks.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-11-10 09:30:53 -08:00
Yichao Yang
2075d1685a CHASM: Best effort pure task deletion (#8531)
## What changed?
- CHASM: Best effort pure task deletion

## Why?
- Performance improvement, prevent invalid physical pure tasks from
firing.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-11-06 14:21:10 -08:00
Yimin Chen
8e5d0b85dc Drop repeated workflow task failures (#8587)
## What changed?
Drop repeated workflow task failure reports

## Why?
To avoid busy loop of repeated workflow task failures

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

## Potential risks
No
2025-11-04 05:30:00 +00:00
Sean Kane
bb1589e040 Degraded workflow visibility (#8223)
## What changed? 
Add a new search attribute `TemporalReportedProblems` when a workflow
task fails or timeouts N consecutive times

## Why?
Enables users to easily discover workflows that are not making progress.
After a workflow task fails or times out N consecutive times a Search
Attribute, `TemporalReportedProblems` a `KeywordList`, will be added
with two entries, a `cause` and a `category`. These search attributes
will be queryable by users with queries like:
* `TemporalReportedProblems IS NOT NULL`
* `TemporalReportedProblems IN ('category=WorkflowTaskFailed')` or
`TemporalReportedProblems IN ('category=WorkflowTaskTimedout')`
* `'TemporalReportedProblems IN ("cause=UnhandledApplicationFailure")'
OR 'TemporalReportedProblems IN ("cause=ScheduleToCloseTimeout")'`

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

## Potential risks
Flapping _could_ happen with this change, but is unlikely. There's a
possibility of overloading the visibility system, but these changes are
protected with a dynamic config.

---------

Co-authored-by: Roey Berman <roey@temporal.io>
2025-10-08 14:51:09 -06:00
Prathyush PV
339d571bf2 Optimize WorkflowTask Timeouts (#8412)
## What changed?
Optimize workflow task timeouts by completing them when the workflow
task finishes.
This optimization is enabled when the dynamic config
system.enableDeleteHistoryTasksOnUpdate is turned on.
It is disabled by default, as it can cause performance degradation in
cassandra based persistence.

## Why?
A large fraction of all timer tasks processed is workflow task timeouts.
In most of the cases, these are no-ops.
We can complete these tasks when the corresponding workflow task
finishes. This will reduce the number of timer tasks processes.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-10-03 18:12:59 +00:00
Yichao Yang
b87fb75035 Improve multi-cursor actions (#8416)
## What changed?
- Introduced a new "move (task) group" action replacing the "incorrect"
slice-predicate action. See inline comment for how it works.
- Improve task Predicate AND/OR calculation to reduce predicate size.
- Skip empty slices when adding queue slices to readers.

## Why?
- Better namespace isolation.

## 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)

## Potential risks
- The new action can be disabled via dc.
2025-10-02 22:48:23 -07:00
Yu Xia
2c1b6e172c Make replicate stream liveness check dynamic configurable (#8409)
## What changed?
Make replicate stream liveness check dynamic configurable

## Why?
Easy to adjust the liveness check internal without restart servers.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-10-02 11:58:58 -07:00
michaely520
4bef195126 Move StreamSender and ExecutableTask to use dynamic config (#8405)
## What changed?
Moving StreamSender and ExecutableTask in our replication stack to use
dynamic config.

## Why?
Gives us the ability to dynamically modify the retry config of the
replication stream on source cluster and retry config during application
on the target side.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-09-30 23:15:34 +00:00
Alex Stanfield
b1dae486cf Add V2 Scheduler Dynamic Configs (#8373)
## What changed?
Added 2 new namespace specific dynamic configs that allows use to
control the rollout of the new CHASM Scheduler.

## Why?
Once CHASM Scheduler is feature complete we need the ability to control
whether or not it's enabled.

---------

Co-authored-by: alex stanfield <chaptersix@users.noreply.github.com>
2025-09-26 12:22:04 -05:00
Prathyush PV
60d0dabe2b Add metrics for data loss events (#8310)
## What changed?
Add metrics for dataloss events that containe workflowID, runID and
namespaceID.
This metric will only be emitted if config
`system.enableDataLossMetrics` is enabled.

## Why?
To find affected workflow runs if there are any dataloss errors.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-09-19 09:44:47 -07:00
Will Duan
d945b74d27 Remove Eager Refresh Namespace Dynamic Config (#8285)
## What changed?
Remove Eager Refresh Namespace Dynamic Config

## Why?
The feature is enabled for long time and we can enable it by default and
no dc is required.

## 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)

## Potential risks
no risk.
2025-09-05 09:54:16 -07:00
Alfred Landrum
2237b4f04e support background entry removal for workflow cache (#7902)
## What changed?
This adds support to the lru cache to actively expire entries older than
the TTL, by spawning a background goroutine that periodically deletes
old entries. A dynamic config, off by default, is added that can enable
this feature for the workflow cache.

## Why?
This can reduce the memory usage, and associated Go GC resource usage,
for workflow entries that won't be utilized since they are past their
TTL.

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

Also running this in test setups to verify expected memory reduction.

## Potential risks
2025-07-25 10:04:29 -07:00
Will Duan
44e68a4cce Deprecate ndc_history_resender code (#8032)
## What changed?
Deprecate ndc_history_resender code

## Why?
It is replaced by Resend Handler which support resend local generated
events.

## 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)

## Potential risks
no risk. The dynamic config is enabled long time in prod.
2025-07-11 14:03:34 -07:00
Stephan Behnke
97d86deccc UwS returns retryable error on workflow close (#7949)
## What changed?

Follow-up to https://github.com/temporalio/temporal/pull/7921 which
introduced a server-side retry for an UwS that was aborted due to a
closing workflow. This changed the status code so it's retryable by the
client as well.

## Why?

If an UwS didn't perform a start and was aborted due to a closing
workflow, we want to retry the UwS.

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

## Potential risks

Added a dynamic config to turn off the new behavior if unforeseen issues
arise.
2025-06-25 09:22:14 -07:00
Stephan Behnke
a085bb0948 Update-with-Start retry on aborted Update (#7921)
## What changed?

Added a server-side retry for when the Update of Update-with-Start was
aborted due to a closing workflow.

## Why?

Users expect it to retry.

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

## Potential risks

In case the change goes badly (for technical or user reasons), there's a
dynamic config to disable it again.
2025-06-16 07:41:05 -07:00
Yu Xia
32058b749a Add config flag for replication rate limiter (#7895)
## What changed?
Add config flag for replication rate limiter

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-06-12 09:28:45 -07:00
Yu Xia
f1022f97d4 Add monitor in stream sender on sync status (#7877)
## What changed?
Add monitor in stream sender on sync status

## Why?
Receiver send replication status per seconds.
Sender should monitor on this signal and assume the receiver side is
stop if it loses this sync status.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-06-11 13:27:56 -07:00
Stephan Behnke
1e7c8532b5 Revert "Add MultiOperation error logging" (#7887)
Reverts temporalio/temporal#7839 - no longer needed.
2025-06-09 15:37:57 -07:00
Yu Xia
372223be39 Add replication heartbeat to sync replication state when no task (#7875)
## What changed?
Add replication heartbeat to sync replication state when no task

## Why?
We want to have this to monitor stream liveness.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-06-06 11:26:42 -07:00
Lanie Hei
9425ec0994 Add health signal recording to interceptor (#7773)
This adds an interceptor to the handler service that logs latency and
errors from handlers, and can be reused in other services.

Adds the interceptor to the history service, that takes a health
aggregator provider. This provider is also added to the handler such
that we can read these values in the DeepHealthCheck handler within the
history service.

A future PR will add this check to the other services.
2025-06-03 09:44:58 -07:00
Yichao Yang
4a94967967 Remove shard level workflow cache logic (#7763)
## What changed?
- Remove shard level workflow cache logic and always use host level
workflow cache.

## Why?
- Simplify code. Host level workflow cache has been enabled by default
for a long time.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-05-30 19:50:24 -07:00
Stephan Behnke
0c745fd69a Add MultiOperation error logging (#7839)
## What changed?

Added a log for every MultiOperation error in history.

## Why?

Track down a race condition.

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

## Potential risks

Since it's only logging errors, I expect the log volume to be
reasonable/low.
2025-05-31 00:46:36 +00:00
Will Duan
352934a5f3 Remove max retry times for replication stream (#7722)
## What changed?
1. Remove max retry times for replication stream
2. Improve log msg

## Why?
We have separate the ReplicationService error and ReplicationStream
error. It is not necessary to disconnect the stream if it is service
error.

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

## Potential risks
No risk. We have proper metrics and alert on it.
2025-05-28 20:58:35 +00:00
Stephan Behnke
a6cf57cb81 Remove FollowReusePolicyAfterConflictPolicyTerminate (#7810)
## What changed?

Removed config option `FollowReusePolicyAfterConflictPolicyTerminate`.

## Why?

It was [put in place](https://github.com/temporalio/temporal/pull/7099)
to have the ability to roll back a behavior change. It's been 4+ months
and it's okay to remove it now.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2025-05-28 13:17:00 -07:00
Hai Zhao
0ad74795ae Resend parent for standby child completion verification (#7757)
## What changed?
Resend parent for standby child completion verification.

## Why?
In the case that standby fails to verify child completion when parent
workflow is not found or not ready, standby should request resend parent
from active so standby can finish verification earlier.

## 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)

## Potential risks
New calls will be made to active. But this will only happen after the
new config maxLocalParentWorkflowVerificationDuration. So impacts to
active will be low.
2025-05-14 13:35:36 -07:00
Yichao Yang
8c5e61e22b CHASM: Engine Update/ReadComponent implementation (#7696)
## What changed?
- Implement chasm engine Update/Read Component method

## Why?
- CHASM work stream

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [ ] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-05-08 19:21:27 -07:00
Rodrigo Zhou
4149888704 Dynamic config to enable generating request id reference links (#7712)
## What changed?
<!-- Describe what has changed in this PR -->
Dynamic config to enable generating request id reference links

## Why?
<!-- Tell your future self why have you made these changes -->

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-05-05 19:37:54 -05: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
Yichao Yang
dc563bbd5b Support updating closed workflows by mutation (#7420)
## What changed?
<!-- Describe what has changed in this PR -->
- Support update closed workflow by mutation

## Why?
<!-- Tell your future self why have you made these changes -->
- Today, any updates (e.g. update callbacks after workflows & update
branch token. With CHASM, there will be more cases) for closed workflows
require persisting the entire mutable snapshot using the
`SetWorkflowExecution` persistence API in order to skip the current
record validation.
- Application logic is complex and have to call different APIs based on
workflow state
- Performance is also bad as we are writing unnecessary data when
persisting a snapshot, even if they haven't been mutated.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
- Unit & persistence integration tests

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

## 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/`? -->

## 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-28 15:29:57 -07:00
Prathyush PV
cce06c6b11 Send raw history events from history to frontend service (#7342)
## What changed?
Change to send raw history blobs from history service to frontend
service. History service returns a new proto message that has a repeated
bytes history field.
This response is wire compatible with the original response which has
temporal.api.history.v1.History type for this field. This allows history
service to not deserialize events from this data blob. This considerably
reduces CPU usage.

History service still needs event_id and version decoded from history
events. For this we use a new proto message StrippedHistoryEvent which
has these two fields only. It takes considerably less CPU to decode
events to this struct.

## Why?
We have seen incidents of high history CPU usage when large number of
GetWorkflowExecutionHistory calls are made to workflows which has large
history. With this change we can reduce the CPU burden on history
service during this API call.

## How did you test it?
Existing unit and functional tests.

## Potential risks

## Documentation

## Is hotfix candidate?
2025-02-21 22:21:25 +00:00
Stephan Behnke
50cd0aed91 Update Registry suggest CAN (#7247)
## What changed?
<!-- Describe what has changed in this PR -->

Added support for Update Registry to suggest CAN.

## Why?
<!-- Tell your future self why have you made these changes -->

To allow Workflow to CAN before it reaches the Update limit.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Added unit tests.

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-02-06 08:16:58 -08:00
Stephan Behnke
3bf03e2a0f Remove Subscription from Update Registry (#7251)
## What changed?
<!-- Describe what has changed in this PR -->

Reverts https://github.com/temporalio/temporal/pull/7224 but keeps the
bug fix.

## Why?
<!-- Tell your future self why have you made these changes -->

Change was unnecessary.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Modified existing tests.

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-02-05 20:49:31 +00:00
Stephan Behnke
74e715a3a7 Dynamic config subscriber in Update Registry (#7224)
## What changed?
<!-- Describe what has changed in this PR -->

Using the new dynamic config subscribers in the Update registry.

## Why?
<!-- Tell your future self why have you made these changes -->

To keep the Update registry's settings up-to-date.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Updated existing tests.

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-02-05 10:32:03 -08:00
Rodrigo Zhou
72c62184da Add OnConflictOptions to StartWorkflowExecution (#7080)
## What changed?
<!-- Describe what has changed in this PR -->
Add `OnConflictOptions` to `StartWorkflowExecution`.
- if the workflow id conflict policy is not `USE_EXISTING`, then no-op;
- if the field is nil, then no-op;
- otherwise, then it will add a `WorkflowExecutionOptionsUpdatedEvent`
to the existing running workflow.

## Why?
<!-- Tell your future self why have you made these changes -->
Ability to attach completion callbacks to existing running workflows.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
WIP: writing tests

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-02-03 15:53:42 -06:00
David Reiss
cccd932cfa Add history.alignMembershipChange setting (#6510)
## What changed?
Add `history.alignMembershipChange` to allow history to use aligned
membership changes also.

## Why?
Better behavior during restarts/deployments.

## How did you test it?
not yet
2025-01-30 14:29:46 -08:00
Stephan Behnke
e08772a9f0 Follow ReusePolicy AllowDuplicateFailedOnly with TerminateExisting (#7097)
## What changed?
<!-- Describe what has changed in this PR -->

Make WorkflowIdConflictPolicy TerminateExisting follow the
WorkflowIdReusePolicy after an _unsuccessful_ termination.

NOTE: The frontend change was made in
https://github.com/temporalio/temporal/pull/7099

## Why?
<!-- Tell your future self why have you made these changes -->

When the termination from TerminateExisting fails, the user would expect
the WorkflowIdReusePolicy to be applied as the Workflow is not running.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Well ... there's no way to test this well right now. There are no unit
tests; and the functional test cannot be written without the use of
[testhooks](https://github.com/temporalio/temporal/pull/6938) since
there is no other way to simulate the race condition here.

I manually added a `sync.Once` into the code that terminates the
workflow and can confirm the expected behavior.

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-01-17 18:41:07 +00:00
Stephan Behnke
af83e08715 Update Registry size limit warning (#7092)
## What changed?
<!-- Describe what has changed in this PR -->

Adding log for when update registry size limit is reached.

## Why?
<!-- Tell your future self why have you made these changes -->

To identify a update registry size limit; and then enforce it in the
next change.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

Added test. And ran functional test with limit.

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



## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-01-17 00:44:10 +00:00
Jacob Barzee
2296fac17f Log visibility queries which take longer than 1s (#6944)
## What changed?
Visibility Queries slower than 1s (configurable with dynamic config) are
logged for analysis.

## Why?
To better understand the profile of the slowest queries.

## How did you test it?
Run a query which exceeds the dynamicConfig threshold. 

## Potential risks
Threshold is too low, causing excessive logging. Existing metrics for
Query Latency were evaluated in largest cells to check f or rate. Expect
>1 log per hour, per cell.

## Documentation
N/A

## Is hotfix candidate?
No
2024-12-11 14:08:28 -07:00
Lina Jodoin
79fcf6fe15 Remove experimental HSM scheduler prototype (#6934)
## What changed?
Removed the experimental HSM scheduler code.

## Why?
Now that we've started the productionized implementation, we'd like to
avoid naming conflicts between the two. Experimental HSM scheduler isn't
in use.

## How did you test it?
- `make && make lint && make unit-test`

## Potential risks
- None

## Documentation

## Is hotfix candidate?
2024-12-06 16:02:41 -08:00
Chetan Gowda
2cdc0a5da9 [Reset] Dynamic config to allow resetting with pending children (#6927)
## What changed?
Added a dynamic config (default `false`) to gate the resetting with
pending children feture.

## Why?
The feature is still in development. So we don't want to expose it yet.

## How did you test it?
Existing tests since it's just wiring the config.

## Potential risks
N/A

## Documentation
N/A

## Is hotfix candidate?
No
2024-12-06 10:57:04 -08:00
Alex Shtin
b2fb628cd3 Workflow Update: drop speculative WFT even if it had events (#6709)
## What changed?
<!-- Describe what has changed in this PR -->
Drop speculative WFT even if it had events.

## Why?
<!-- Tell your future self why have you made these changes -->
Special compatibility flag was
[added](https://github.com/temporalio/api/pull/467) to
`RespondWorkflowTaskCompletedRequest`. If this flag is set to true, then
server can drop speculative WFT with update rejections, even if it
shipped events to the worker. SDK support will be added later.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Added new unit tests.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
No risks. Compatibility flag is used to support backward compatibility
and don't drop speculative WFT if worker doesn't support it (old go
SDKs).

## 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/`? -->
Yes, updated.

## 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.
2024-11-18 15:26:19 -08:00
Prathyush PV
b9a288061c Clean inactive namespace channels from InterleavedWeightedRoundRobinScheduler (#6718)
## What changed?
Clean inactive namespace channels from
InterleavedWeightedRoundRobinScheduler after a specified delay.
This delay can be specified through the dynamic config option
history.taskSchedulerInactiveNamespaceChannelDeletionDelay.

## Why?
Older namespace stay in the flattened list forever. This is making task
scheduler slow.

## How did you test it?
Unit test

## Potential risks

## Documentation

## Is hotfix candidate?
No

---------

Co-authored-by: Yichao Yang <yichao@temporal.io>
2024-11-02 01:07:55 +00:00
Alex Shtin
571b0ba11e Revert "Treat serviceerror.Internal as non-retryable" (#6729)
Reverts temporalio/temporal#6622
2024-10-29 18:30:28 -07:00
Rodrigo Zhou
f5a374bbb6 Add dynamic configs for min size to remove attributes from mutable state and disabling fetch from visibility (#6686)
## What changed?
<!-- Describe what has changed in this PR -->
Added two dynamic configs:
- min blob size of memo or search attributes to be removed from mutable
state after the close visibility task is done.
- disabling fetch those attributes from visibility in the describe
workflow API.

## Why?
<!-- Tell your future self why have you made these changes -->

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Unit tests, and verified locally.

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-10-25 12:33:59 -05:00
Yichao Yang
5d55d6c707 Treat serviceerror.Internal as non-retryable (#6622)
## What changed?
<!-- Describe what has changed in this PR -->
- Treat serviceerror.Internal as non-retryable
- Deprecate `history.TaskDLQInternalErrors` and always DLQ history tasks
when internal error is returned.

## Why?
<!-- Tell your future self why have you made these changes -->

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-10-08 11:04:31 -07:00
Yichao Yang
4ae488f23e Track sub state machine tombstones (#6422)
## What changed?
<!-- Describe what has changed in this PR -->
- Track sub state machine tombstones in mutable state

## Why?
<!-- Tell your future self why have you made these changes -->
- For new state-based replication stack

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
- Unit test

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
- N/A, feature flag not enabled.

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-09-03 15:37:33 -07:00
Roey Berman
1ed0b3eeae Add dynamic config to limit multi cursor predicate size (#6458)
## What changed?

Add dynamic config to limit multi-cursor predicate size.
There are two separate configs:
- `history.queueMaxPredicateSize` for all history queues except for the
outbound queue - set to unlimited by default to avoid changing behavior
- `history.outboundQueueMaxPredicateSize` for the outbound queue - set
to 10K by default

## Why?

Limit the size of the shard info record. In stress test scenarios we've
seen this record grow to over 10MB.

## How did you test it?

Added unit tests.

## Is hotfix candidate?

This should be applied to any server deployments enabling Nexus
workloads.
2024-08-29 17:21:16 +00:00
Hai Zhao
4d6dc36144 Add a host level replication progress cache (#6356)
## What changed?
Add a host level replication progress cache. The cache will be updated whenever a SyncVersionedTransition replication task is sent or SyncState API is called.

## Why?
To reduce the duplication of replication tasks.

## How did you test it?
unittest.

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

## 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/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->

---------

Co-authored-by: Will Duan <xinw.duan@gmail.com>
Co-authored-by: Roey Berman <roey@temporal.io>
Co-authored-by: Yichao Yang <yichao@temporal.io>
2024-08-20 09:54:44 -07:00