Commit Graph

18 Commits

Author SHA1 Message Date
Yichao Yang
0c2b360e40 CHASM: Propagate ArchetypeID (#8693)
## What changed?
- Use archetypeID everywhere in history service and pass them to
persistence

## Why?
- Required for separate ID space work.

## How did you test it?
- [x] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit test(s)
- [ ] added new functional test(s)
2025-11-26 16:04:44 -08:00
Alex Shtin
91893f1064 Remove license header from every file (#7689)
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.

## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
2025-05-01 18:50:21 -07:00
Stephan Behnke
530081ccc5 Update protoc-gen-go and protogen (#7528)
WISOTT
2025-03-31 15:16:06 -07:00
Hai Zhao
83a28d7b71 use transition history if enabled when long poll history (#7185)
## What changed?
use transition history if enabled when long poll history

## Why?
For state-based replication, we do allow event version version to go
backwards as long as the overall versioned transition is keep
increasing. So we need to change token to use versioned transition.

## How did you test it?
unit test.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2025-02-05 20:29:39 -08:00
Shahab Tajik
ba07427e4a Support unpinned workflows (#6887)
## What changed?
<!-- Describe what has changed in this PR -->
Add Matching and History changes to properly route unpinned workflow
tasks.

## Why?
<!-- Tell your future self why have you made these changes -->

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Tests will come in separate PR.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-11-26 22:34:04 -08:00
Hai Zhao
0139fc1c91 Add version histories to serviceerrors.SyncState (#6658)
## What changed?
Add version histories to serviceerrors.SyncState

## Why?
<!-- Tell your future self why have you made these changes -->

## How did you test it?
add unit test

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-10-15 11:44:34 -07:00
Hai Zhao
955339876b add BackfillHistoryTask (#6220)
## What changed?
This PR adds BackfillHistoryTask when SyncVersionedTransitionTask is not on current transition history.

## Why?
This PR is part of SyncVersionedTransitionTask.

## How did you test it?
unittest.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
2024-07-23 15:31:12 -07:00
Shahab Tajik
6b92aa58ab Validate build id and reschedule tasks when redirect rule applies (#5681)
## What changed?
<!-- Describe what has changed in this PR -->
- Send BuildIdRedirectInfo from Matching to History on
Record*TaskStarted call containing information about redirect intention.
- History validates the redirect info against current MS and fails the
request if the redirect does not have source build if equal to the
current assigned build of the workflow.
- If redirect is valid, workflow is assigned to the new build id and all
pending but not started task are rescheduled to be sent to the new build
id.

## Why?
<!-- Tell your future self why have you made these changes -->
To prevent the following problems from happening for workflows with
concurrent tasks when redirect rules are deleted or not fully propagated
yet:
1. Assign wf back to an old build id after processing task using a newer
build id
2. Interleaved Starts: for some duration tasks are dispatched to a mix
of old or new build IDs
3. New activity output being fed to old wf
4. Execution gets stuck after being (partially) redirected

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Functional test. More unit tests to be added in a followup PR.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
As it is right now, in rare situations when a redirect rule is applied
to a WF with concurrent activities and some of them are in backoff
period due to failure, we may schedule (and start) them on the newer
build without waiting for the backoff to finish. This is planed to be
improved in the futuer.

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->
None.

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
No.
2024-05-17 15:49:29 -07:00
Tim Deeb-Swihart
049334aa67 Update api-go and sdk-go to allow invalid UTF-8 in protos (#5476)
## What changed?
I've upgraded the version of our Go API in order to allow invalid UTF-8
data in our proto strings.

Please review
5cf979058d
only

## Why?
The version of gogo/protobuf we used allowed invalid UTF-8 in strings
which is a violation of the proto3 spec. We were unaware of this until
our new google/protobuf based structs began failing to deserialize data
we'd used previously

## How did you test it?
I added a new end-to-end test to verify that we can create, describe,
and delete a namespace that contains invalid UTF-8 in multiple
attributes

## Potential risks
This is lower risk than commits prior to this as temporal DBs may
already contain invalid UTF-8 data

## Documentation
I adjusted our docs to mention this behavior and the `protolegacy` tag

## Is hotfix candidate?
Yes: this will be going out as part of our 1.23.0 release. In fact, the
release is blocked on it!

---------

Co-authored-by: David Reiss <david@temporal.io>
2024-03-01 23:21:27 +00:00
Tim Deeb-Swihart
ee3aa2feec Use the new protogen build tool (#5212)
## What changed?
I replaced protoc.sh with
[protogen](https://github.com/temporalio/api-go/pull/139)

## Why?
I've copied some variant of this protoc.sh tool into three repos now.
This is unsustainable, so I've added a little build tool to api-go that
will handle proto generation and post-processing for us.

## How did you test it?
[I ran `make proto` in the PR stacked on this
one](https://github.com/temporalio/temporal/pull/5211)

## Potential risks
None

## Is hotfix candidate?
No
2023-12-11 17:49:10 +00:00
Tim Deeb-Swihart
5ba90bccac Clean up protos (#5157)
**What changed?**
I rebuilt all proto files and bumped the version of our protoc plugin

**Why?**
So as to not pollute the PRs of others

**How did you test it?**
CI

**Potential risks**
None

**Is hotfix candidate?**
No.
2023-11-27 18:11:33 +00:00
Tim Deeb-Swihart
1be76e3583 Replace gogo/protobuf with google/protobuf (#5032)
**What changed?**

gogo/protobuf has been replaced with Google's official go compiler. 

**Why?**

gogo/protobuf has been deprecated for some time and the community is
moving on, building new tools (like vtproto) atop google's v2 compiler.

**How did you test it?**

`make test`

**Potential risks**

1. The change from embedded gogo-generated-structs to
google-generated-pointers-to-structs created a risk of nil pointer
exceptions. I've fixed all the ones our tests found but it's possible
there are more lurking in the new code.
2. This change may cause our performance to decrease. Certainly
encoding/deconding of proto objects will become slower, but the overuse
of pointers by the google compiler may negatively affect our overall
performance. We'll need to keep an eye on the GC stats
3. This breaks the HTTP API. We will not support [shortand payload
encoding](https://github.com/temporalio/proposals/blob/master/api/http-api.md#payload-formatting)
in this first pass; that will come once this initial work is in testing.

**Breaking changes for developers**

- `*time.Time` in proto structs will now be
[timestamppb.Timestamp](https://pkg.go.dev/google.golang.org/protobuf@v1.31.0/types/known/timestamppb#section-documentation)
- `*time.Duration` will now be
[durationpb.Duration](https://pkg.go.dev/google.golang.org/protobuf/types/known/durationpb)
- V2-generated structs embed locks, so you cannot dereference them. `go
vet` will scream at you about this. If you need a copy, use
`proto.Clone`.
- If the performance of this sucks then I will either update our code
generator to add shallow-clone methods or hand-roll the ones we need
- Proto enums will, when formatted to JSON, now be in
`SCREAMING_SNAKE_CASE` rather than `PascalCase`. We decided (in
discussion with the SDK team) that now was as good a time as any to rip
the bandage off.
- Proto objects, or objects embedding protos, cannot be compared using
`reflect.DeepEqual` or _anything_ that uses it. This includes `testify`
and `mock` equality testers!
- You will need to use the `common/testing/protorequire`,
`common/testing/protoassert`, or `common/testing/protomock` packages
instead. I've implemented proto-compatible matchers and assertions there
for all cases I've encountered
- If you need `reflect.DeepEqual` for any reason you can use
`go.temporal.io/api/temporalproto.DeepEqual` instead

Note that history loading will not be impacted by the JSON changes: I
rewrote history loading to dynamically fix incoming history JSON data
(like all our other sdks); you can find this code in [my fork of our go
API](https://github.com/tdeebswihart/temporal-api-go/blob/master/internal/temporalhistoryv1/load.go)
alongside its tests.

**🚨Sharp Edges Introduced🚨**

Beware `*timestamppb.Timestamp.AsTime()`. If you need to extract a time
value from a proto time (timestamppb) **always** make sure to check
whether it's nil first. When the proto object is `nil` `AsTime()` will
return a non-zero time at the proto epoch: UTC midnight on January 1,
1970.

I've made this mistake multiple times during this transition and each
time it's been a pain to debug

**Is hotfix candidate?**

No.
2023-11-21 15:19:37 -08:00
Yimin Chen
be024bf0ae Use public WorkflowNotReady (#2825)
Query workflow need similar error, so we moved the WorkflowNotReady from history internal to public.
2022-05-09 22:37:10 -07:00
Yichao Yang
aa2c98ee44 Verify child completion recorded (#2806) 2022-05-08 22:53:38 -07:00
Yimin Chen
95dfa072fb Fix 5s delay on sticky queue (#2811)
Sticky worker mark workflows as running on sticky queue. But when sticky worker
is gone (gracefully shutdown or forcefully killed), they don't notify server. 
When new workflow task or query is scheduled, server still dispatch them to the 
old sticky queue which now has no worker working on and will only result in 5s 
sticky queue's schedule_to_start timeout. No mater how long after the old 
sticky worker is gone, there is always that 5s delay. This PR fix that by 
checking if if there is no inflight poller for the sticky queue, and no poller 
is seem within 10s. In that case, matching would return a new 
StickyWorkerUnavailable error and history would retry that by using original 
task queue.
2022-05-06 20:13:24 -07:00
Alex Shtin
7bfb0c47f9 Rename RetryReplication in proto (#975) 2020-11-11 11:15:51 -08:00
Alex Shtin
15c8d047a9 Update proto license header (#617) 2020-08-17 11:23:27 -07:00
Alex Shtin
7e994f85ff Move internal service error to the repo (#552) 2020-07-16 17:21:59 -07:00