randomUUID() changes after a reset, and a reset can't start after a sideEffect
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Start with WorkflowStateMachines.randomUUID() and WorkflowTaskStateMachine.handleFailed() in the paths linked from the issue, then read the reset behavior and tests around those state machines. The issue asks for documentation and one of two behavior changes, but leaves the design choice open; completion needs a decision on the supported approach, documentation of reset behavior, and tests for the chosen behavior.
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
We use Workflow.randomUUID() to make idempotency keys for activities. The values stay the same across replays and activity retries. After a reset, they stay the same only for code that runs before the reset point:
UUID idempotencyKey1 = Workflow.randomUUID(); // seed: original run id, same after reset
activity1(idempotencyKey1);
// <-- reset here: seed switches to the new run id
UUID idempotencyKey2 = Workflow.randomUUID(); // new value after reset
activity2(idempotencyKey2); // failed mid-operation? reruns with a different key
If activity2 fails partway through its operation and we reset the workflow to fix it, activity2 runs again with a different key. The downstream system cannot tell that it is the same operation, and the operation happens twice.
The SDK does this on purpose. The code is the same from 1.37.0 through 1.41.1 and on main (links to v1.41.1):
WorkflowStateMachines.randomUUID()builds the value fromcurrentRunId + ":" + idCounter.currentRunIdstarts asoriginalExecutionRunIdfromWorkflowExecutionStarted.WorkflowTaskStateMachine.handleFailed()switches it to the new run id onWORKFLOW_TASK_FAILED_CAUSE_RESET_WORKFLOW. The code comment there says the replay "has to use the original runId up to the reset point to maintain the same results".
sideEffect does not help, because a reset cannot start right after it
We tried recording the key with Workflow.sideEffect:
UUID idempotencyKey2 = Workflow.sideEffect(UUID.class, UUID::randomUUID);
activity2(idempotencyKey2);
To keep the key, we would need to reset right after the sideEffect marker, before activity2 is scheduled.
The server does not allow that. It accepts only workflow task events as a reset point.
workflow_resetter.go (v1.32.2) rejects others with:
"Can only reset workflow to event ID in range [WorkflowTaskScheduled +1, WorkflowTaskStarted + 1]".
The marker and the activity2 schedule are commands of the same workflow task, so there is no reset point between them:
10 WorkflowTaskStarted <- reset point
11 WorkflowTaskCompleted <- reset point
12 MarkerRecorded (key2) ┐ commands of one workflow task,
13 ActivityTaskScheduled a2 ┘ no reset point between them
The closest reset point is before the marker, so the reset drops the marker.
The new run calls the function again and activity2 gets a different key.
Describe the solution you'd like
- Document randomUUID behaviour during reset
- One of:
- Keep the original seed after a reset, as an opt-in worker or workflow option. The new run then produces the same
randomUUID()values for the same sequence of calls. - Allow a reset to start after a
MarkerRecordedevent, so the new run keeps thesideEffectvalue and executes again from the next command.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
- 主要言語
- Java
- スター
- 447
- フォーク
- 278
- 平均マージ
- 3日 22時間
- マージ済み PR(30日)
- 28
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
temporalio/sdk-java のほかの issue
-
Support the certificate with linebreak strings from env variable対応中かも @officialasishkumar が 22 日前に担当しました。 オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
temporalio/sdk-java#1825 ·
メンテナーはふだん 1 日以内に返信
-
Spring Boot drops mainDataConverter when a non-root namespace is configured対応中かも @yumingjs が 1 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
temporalio/sdk-java#3245 ·
メンテナーはふだん 1 日以内に返信
-
Spring Boot ignores Ordered on TemporalOptionsCustomizer beans対応中かも @Quinn-With-Two-Ns が 2 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
temporalio/sdk-java#3244 ·
メンテナーはふだん 1 日以内に返信
-
Fix graceful shutdown of the shared worker-command poller対応中かも @yuandrew が 9 日前に担当しました。 オープンsdk-java
temporalio/sdk-java#3234 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Interface bridge methods are considered workflow methods対応中かも @Quinn-With-Two-Ns が 9 日前に担当しました。 オープン
難易度 3/5 半日 初心者へのやさしさ 62/100
temporalio/sdk-java#3233 · コメント 5 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
temporalio/sdk-java の issue をすべて見る
似ている issue
-
area-integrations
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
? - Needs Triage bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA/cudf-spark-jni#5598 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
oracle/graalvm-reachability-metadata#12264 ·
メンテナーはふだん 1 日以内に返信
-
[source-facebook-pages] post stream never returns attachments.media_type対応中かも @v-k-data が今日担当しました。 オープンarea/connectors needs-triage type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
[BUG] AppSync: GetIntrospectionSchema wraps the schema in JSON instead of returning the raw SDL bodyオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
floci-io/floci#10107 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信