randomUUID() changes after a reset, and a reset can't start after a sideEffect
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 38/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- java
- Domaine
- backend-api-design
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Java
- Étoiles
- 447
- Forks
- 278
- Merge moyen
- 3 j 22 h
- PR mergées (30 j)
- 28
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de temporalio/sdk-java
-
Support the certificate with linebreak strings from env variablePeut-être pris @officialasishkumar l’a pris il y a 22 jours. Ouverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
temporalio/sdk-java#1825 ·
Les mainteneurs répondent en général sous 1 jour
-
Spring Boot drops mainDataConverter when a non-root namespace is configuredPeut-être pris @yumingjs l’a pris il y a 1 jour. Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 74/100
temporalio/sdk-java#3245 ·
Les mainteneurs répondent en général sous 1 jour
-
Spring Boot ignores Ordered on TemporalOptionsCustomizer beansPeut-être pris @Quinn-With-Two-Ns l’a pris il y a 2 jours. Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
temporalio/sdk-java#3244 ·
Les mainteneurs répondent en général sous 1 jour
-
Fix graceful shutdown of the shared worker-command pollerPeut-être pris @yuandrew l’a pris il y a 9 jours. Ouvertesdk-java
temporalio/sdk-java#3234 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Interface bridge methods are considered workflow methodsPeut-être pris @Quinn-With-Two-Ns l’a pris il y a 9 jours. Ouverte
Difficulté 3/5 Une demi-journée Accessibilité débutants 62/100
temporalio/sdk-java#3233 · 5 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de temporalio/sdk-java
Issues similaires
-
area-integrations
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
? - Needs Triage bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
NVIDIA/cudf-spark-jni#5598 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
oracle/graalvm-reachability-metadata#12264 ·
Les mainteneurs répondent en général sous 1 jour
-
[source-facebook-pages] post stream never returns attachments.media_typePeut-être pris @v-k-data l’a pris aujourd’hui. Ouvertearea/connectors needs-triage type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
Les mainteneurs répondent en général sous 1 jour
-
[BUG] AppSync: GetIntrospectionSchema wraps the schema in JSON instead of returning the raw SDL bodyOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
floci-io/floci#10107 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour