Content-Length: 389019 | pFad | http://github.com/temporalio/sdk-java/pull/2464

67 Set TemporalChangeVersion when workflow version is updated by Quinn-With-Two-Ns · Pull Request #2464 · temporalio/sdk-java · GitHub
Skip to content

Set TemporalChangeVersion when workflow version is updated #2464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 28, 2025

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

@Quinn-With-Two-Ns Quinn-With-Two-Ns commented Apr 1, 2025

Set TemporalChangeVersion when workflow version is updated

This PR adds an option to WorkflowImplementationOptions that if set to true will cause GetVersion to automatically upsert TemporalChangeVersion with a list of version. The reason why this is behind a flag is to allow for safe rollback and to help users who are already manually upserting a search attribute migrate.

Note for reviewers: I still need to fix the parametrized test to cover both the flag being enabled and disable, and add more replay tests, but all the tests I intended to add are here otherwise. I welcome suggestions for more test coverage

closes #587

@Quinn-With-Two-Ns Quinn-With-Two-Ns changed the title Issue 587 Set TemporalChangeVersion when workflow version is updated Apr 1, 2025
@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review April 1, 2025 22:16
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner April 1, 2025 22:16
Comment on lines 111 to 93
details.put(
UPSERT_VERSION_SA_KEY,
DefaultDataConverter.STANDARD_INSTANCE.toPayloads(upsertVersionSA).get());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you help me understand the changing of the marker value here. Do other SDKs do this and/or are we using it as a flag of sorts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes Go does the same thing, it tells the SDK if it should expect a search attribute after the marker.

@@ -508,6 +534,14 @@ private void handleCommandEvent(HistoryEvent event) {
if (handleLocalActivityMarker(event)) {
return;
}
if (shouldSkipUpsertVersionSA) {
if (handleNonMatchingUpsertSearchAttribute(event)) {
shouldSkipUpsertVersionSA = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this bool only valid for this one event? Does setting it back to false here make a difference, or is it just to be safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is only valid for one event

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit I didn't do a deep dive, but the test coverage does provide some comfort here couple with the fact that it's not even enabled by default today. May be worth getting review from others if needing multiple opinions/eyes.

* with running workflows. However, if this options is enabled, it is not safe to rollback to a
* previous version of the SDK that does not support this option.
*
* <p>The default value is false. This may change in future releases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we need an issue to track enabling this by default after a release or two

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this does indeed match Core

@Quinn-With-Two-Ns Quinn-With-Two-Ns force-pushed the issue-587 branch 2 times, most recently from 8b49685 to 3bd0dd6 Compare May 27, 2025 22:35
log

update tests

fixes

fix test

fix up

clean up

Add more docs

typo

Test when a users upserts TemporalChangeVersion

Fix error in test
@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit 44d9abe into temporalio:master May 28, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set TemporalChangeVersion when workflow version is updated
3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/temporalio/sdk-java/pull/2464

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy