randomUUID() changes after a reset, and a reset can't start after a sideEffect
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Java
- Star
- 447
- Fork
- 278
- Merge trung bình
- 3 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 28
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của temporalio/sdk-java
-
Support the certificate with linebreak strings from env variableCó thể đã có người làm @officialasishkumar đã nhận 22 ngày trước. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
temporalio/sdk-java#1825 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Spring Boot drops mainDataConverter when a non-root namespace is configuredCó thể đã có người làm @yumingjs đã nhận 1 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
temporalio/sdk-java#3245 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Spring Boot ignores Ordered on TemporalOptionsCustomizer beansCó thể đã có người làm @Quinn-With-Two-Ns đã nhận 2 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
temporalio/sdk-java#3244 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Fix graceful shutdown of the shared worker-command pollerCó thể đã có người làm @yuandrew đã nhận 9 ngày trước. Đang mởsdk-java
temporalio/sdk-java#3234 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Interface bridge methods are considered workflow methodsCó thể đã có người làm @Quinn-With-Two-Ns đã nhận 9 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 62/100
temporalio/sdk-java#3233 · 5 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của temporalio/sdk-java
Issue tương tự
-
area-integrations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
isXander/YetAnotherConfigLib#376 ·
-
? - Needs Triage bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NVIDIA/cudf-spark-jni#5598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
oracle/graalvm-reachability-metadata#12264 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[source-facebook-pages] post stream never returns attachments.media_typeCó thể đã có người làm @v-k-data đã nhận hôm nay. Đang mởarea/connectors needs-triage type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày