Skip to content

Commit 6bcb938

Browse files
update some comments
1 parent d482995 commit 6bcb938

5 files changed

Lines changed: 31 additions & 29 deletions

File tree

temporal-sdk/src/main/java/io/temporal/internal/history/VersionMarkerUtils.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public class VersionMarkerUtils {
2121
public static final String MARKER_NAME = "Version";
2222
public static final String MARKER_CHANGE_ID_KEY = "changeId";
2323
public static final String MARKER_VERSION_KEY = "version";
24-
public static final String UPSERT_VERSION_SA_KEY = "upsertSA";
24+
// Key used to store if an upsert version search attribute was written while writing the marker.
25+
public static final String VERSION_SA_UPDATED_KEY = "versionSearchAttributeUpdated";
2526

2627
// TemporalChangeVersion is used as search attributes key to find workflows with specific change
2728
// version.
@@ -75,9 +76,9 @@ public static Integer getVersion(MarkerRecordedEventAttributes markerAttributes)
7576

7677
@Nullable
7778
public static boolean getUpsertVersionSA(MarkerRecordedEventAttributes markerAttributes) {
78-
Boolean upsertSA =
79-
MarkerUtils.getValueFromMarker(markerAttributes, UPSERT_VERSION_SA_KEY, Boolean.class);
80-
return upsertSA != null && upsertSA;
79+
Boolean versionSearchAttributeUpdated =
80+
MarkerUtils.getValueFromMarker(markerAttributes, VERSION_SA_UPDATED_KEY, Boolean.class);
81+
return versionSearchAttributeUpdated != null && versionSearchAttributeUpdated;
8182
}
8283

8384
public static RecordMarkerCommandAttributes createMarkerAttributes(
@@ -88,9 +89,10 @@ public static RecordMarkerCommandAttributes createMarkerAttributes(
8889
MARKER_CHANGE_ID_KEY, DefaultDataConverter.STANDARD_INSTANCE.toPayloads(changeId).get());
8990
details.put(
9091
MARKER_VERSION_KEY, DefaultDataConverter.STANDARD_INSTANCE.toPayloads(version).get());
91-
details.put(
92-
UPSERT_VERSION_SA_KEY,
93-
DefaultDataConverter.STANDARD_INSTANCE.toPayloads(upsertVersionSA).get());
92+
if (upsertVersionSA) {
93+
details.put(
94+
VERSION_SA_UPDATED_KEY, DefaultDataConverter.STANDARD_INSTANCE.toPayloads(true).get());
95+
}
9496
return RecordMarkerCommandAttributes.newBuilder()
9597
.setMarkerName(MARKER_NAME)
9698
.putAllDetails(details)

temporal-sdk/src/main/java/io/temporal/internal/replay/ReplayWorkflowContextImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public void upsertSearchAttributes(@Nonnull SearchAttributes searchAttributes) {
350350
// When we enabled upserting of the search attribute by default, we should consider raising a
351351
// warning here.
352352
log.debug(
353-
"{} is a reserved field. This can be set automatically by the SDK by calling `setEnableUpsertVersionSearchAttributes` on you `WorkflowImplementationOptions`",
353+
"{} is a reserved field. This can be set automatically by the SDK by calling `setEnableUpsertVersionSearchAttributes` on your `WorkflowImplementationOptions`",
354354
TEMPORAL_CHANGE_VERSION.getName());
355355
}
356356
workflowStateMachines.upsertSearchAttributes(searchAttributes);

temporal-sdk/src/test/resources/testGetVersionHistoryUpsertSA.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
}
101101
]
102102
},
103-
"upsertSA": {
103+
"versionSearchAttributeUpdated": {
104104
"payloads": [
105105
{
106106
"metadata": {

temporal-sdk/src/test/resources/testMultipleLargeGetVersionInSignalsHistory.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
}
112112
]
113113
},
114-
"upsertSA": {
114+
"versionSearchAttributeUpdated": {
115115
"payloads": [
116116
{
117117
"metadata": {
@@ -260,7 +260,7 @@
260260
}
261261
]
262262
},
263-
"upsertSA": {
263+
"versionSearchAttributeUpdated": {
264264
"payloads": [
265265
{
266266
"metadata": {
@@ -302,7 +302,7 @@
302302
}
303303
]
304304
},
305-
"upsertSA": {
305+
"versionSearchAttributeUpdated": {
306306
"payloads": [
307307
{
308308
"metadata": {
@@ -344,7 +344,7 @@
344344
}
345345
]
346346
},
347-
"upsertSA": {
347+
"versionSearchAttributeUpdated": {
348348
"payloads": [
349349
{
350350
"metadata": {
@@ -567,7 +567,7 @@
567567
}
568568
]
569569
},
570-
"upsertSA": {
570+
"versionSearchAttributeUpdated": {
571571
"payloads": [
572572
{
573573
"metadata": {
@@ -609,7 +609,7 @@
609609
}
610610
]
611611
},
612-
"upsertSA": {
612+
"versionSearchAttributeUpdated": {
613613
"payloads": [
614614
{
615615
"metadata": {
@@ -651,7 +651,7 @@
651651
}
652652
]
653653
},
654-
"upsertSA": {
654+
"versionSearchAttributeUpdated": {
655655
"payloads": [
656656
{
657657
"metadata": {
@@ -693,7 +693,7 @@
693693
}
694694
]
695695
},
696-
"upsertSA": {
696+
"versionSearchAttributeUpdated": {
697697
"payloads": [
698698
{
699699
"metadata": {
@@ -735,7 +735,7 @@
735735
}
736736
]
737737
},
738-
"upsertSA": {
738+
"versionSearchAttributeUpdated": {
739739
"payloads": [
740740
{
741741
"metadata": {
@@ -777,7 +777,7 @@
777777
}
778778
]
779779
},
780-
"upsertSA": {
780+
"versionSearchAttributeUpdated": {
781781
"payloads": [
782782
{
783783
"metadata": {

temporal-sdk/src/test/resources/testMultipleLargeGetVersionInSignalsUpsertSAHistory.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
}
177177
]
178178
},
179-
"upsertSA": {
179+
"versionSearchAttributeUpdated": {
180180
"payloads": [
181181
{
182182
"metadata": {
@@ -238,7 +238,7 @@
238238
}
239239
]
240240
},
241-
"upsertSA": {
241+
"versionSearchAttributeUpdated": {
242242
"payloads": [
243243
{
244244
"metadata": {
@@ -407,7 +407,7 @@
407407
}
408408
]
409409
},
410-
"upsertSA": {
410+
"versionSearchAttributeUpdated": {
411411
"payloads": [
412412
{
413413
"metadata": {
@@ -469,7 +469,7 @@
469469
}
470470
]
471471
},
472-
"upsertSA": {
472+
"versionSearchAttributeUpdated": {
473473
"payloads": [
474474
{
475475
"metadata": {
@@ -531,7 +531,7 @@
531531
}
532532
]
533533
},
534-
"upsertSA": {
534+
"versionSearchAttributeUpdated": {
535535
"payloads": [
536536
{
537537
"metadata": {
@@ -753,7 +753,7 @@
753753
}
754754
]
755755
},
756-
"upsertSA": {
756+
"versionSearchAttributeUpdated": {
757757
"payloads": [
758758
{
759759
"metadata": {
@@ -815,7 +815,7 @@
815815
}
816816
]
817817
},
818-
"upsertSA": {
818+
"versionSearchAttributeUpdated": {
819819
"payloads": [
820820
{
821821
"metadata": {
@@ -877,7 +877,7 @@
877877
}
878878
]
879879
},
880-
"upsertSA": {
880+
"versionSearchAttributeUpdated": {
881881
"payloads": [
882882
{
883883
"metadata": {
@@ -919,7 +919,7 @@
919919
}
920920
]
921921
},
922-
"upsertSA": {
922+
"versionSearchAttributeUpdated": {
923923
"payloads": [
924924
{
925925
"metadata": {
@@ -961,7 +961,7 @@
961961
}
962962
]
963963
},
964-
"upsertSA": {
964+
"versionSearchAttributeUpdated": {
965965
"payloads": [
966966
{
967967
"metadata": {

0 commit comments

Comments
 (0)