Commit Graph
72 Commits
Author SHA1 Message Date
ba33c258f7 Matching task fairness SQL support (#8099)
## What changed?
Add SQL support for matching task fairness.

Based on #8043 with some changes to reduce code duplication (can be
applied to cassandra later).

## Why?
Support all persistence implementations.

## How did you test it?
- [x] covered by existing tests
- [x] added new unit test(s)

---------

Co-authored-by: sivagirish81 <[email protected]>
2025-07-31 05:01:00 -07:00
Alex ShtinandGitHub 8e8f1b0f7c 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 BehnkeandGitHub 5208970803 Remove NewSQLAdminDB (#7578)
## What changed?
<!-- Describe what has changed in this PR -->

Remove duplicate code: three implementations of `CreateAdminDB` were
exactly identical to the respective `CreateDB`.

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

DRY.

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

Existing tests.

## 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-04-08 00:33:09 +00:00
f4b8a8e0b3 [CHASM] SQL persistence for CHASM nodes (#7455)
## What changed?
SQL persistence support has been added for CHASM nodes. 

- A new `chasm_node_maps` table has been added to SQL schemas
- SQL test suites updated
- SQL execution manager/util updated
- SQL plugins for `chasm_node_map` table

## Why?
- We've landed Cassandra persistence support for CHASM nodes, this
brings SQL support up to parity.

## How did you test it?
- New tests ran on all SQL plugins
- `go test -v ./...`

## Potential risks
- No application paths write chasm_node_maps yet, but change does
involve a schema change

---------

Co-authored-by: Yichao Yang <[email protected]>
2025-03-18 16:05:44 -07:00
Jacob BarzeeandGitHub 06171037f0 Import alignment (#6426)
## What changed?
Make import formatting a part of the build, and test validity with
"ensure-no-changes" target

## Why?
So we never discuss import order again (hopefully)

## How did you test it?
its a build change, so the build will test it!

## Potential risks
As long as build works, the only thing I risk is the ire of coworker who
want imports to be different ;)

## Documentation
N/A

## Is hotfix candidate?
No
2024-08-23 14:48:10 -06:00
Tim Deeb-SwihartandGitHub be7b5514a5 Reconnect to SQL databases when connections fail (#5926)
## What changed?

Both our PostgreSQL and MySQL database backends will now automatically
reconnect to the database when certain errors occur: all errors chosen
have been experienced when testing this behavior through an AWS Aurora
RDS failover of either MySQL or PostgreSQL.

For both backends we will reconnect when we see:
- `ECONNRESET`
- `ECONNABORTED`
- `ECONNREFUSED`
- `io.EOF`
- `io.ErrUnexpectedEOF`
- `database/sql/driver.ErrBadConn`

for postgres we will also reconnect on the following SQLStates:
- `25006` read-only transaction
- `57P03` cannot connect now
- `0A000` feature not supported, but ONLY when the message is `cannot
set transaction read-write mode during recovery`

for mysql we will also reconnect when we see the following error codes:
- `1040` too many connections 
- `1792` read-only transaction (SQLstate `25006`)
- `1836` running in read-only mode

This logic is easily extensible should we discover more failure modes
over time

## Why?

We've had multiple community reports of Temporal problems during RDS
failover. One part of this is the fact that we wouldn't necessarily
reconnect; we were at the whims of our chosen SQL abstraction's
connection pooling logic.

## How did you test it?

I manually tested this functionality in the presence of repeated RDS
failovers: 

- [x] postgres12 plugin with pq driver
- [x] postgres12 plugin with pgx driver
- [x] mysql plugin

Automated testing will be added to our regular testing pipelines once
our infrastructure friends have added the support I need (it's in
progress)

## Potential risks

We're concerned there's a correctness issue in our PostgreSQL backend
that's related to our behavior during an RDS failover. If we merge this
before I figure out what's going on, we could hide the issue and make it
harder to reproduce.

## Documentation
N/A

## Is hotfix candidate?
Yes?
2024-05-17 16:59:15 -07:00
Roey BermanandGitHub f6a0b43a8c Nexus Endpoints (#5855)
## What changed?

- Refactored Nexus Registry code to merge incoming and outgoing into one
registry
- Added separate concept of "endpoints" - which is roughly analogous to
what was previously called "services"
- Upgraded the Nexus Go SDK and API dependencies accordingly
- Command handler interface was modified to accept a context given new
requirements
- Note that invoking a worker endpoint is not yet supported, there will
be some minor restructuring required to enable that
- Requires this unmerged API PR
https://github.com/temporalio/api/pull/403. The two PRs should be merged
together.
## Why?

Part of late redesign. See also https://github.com/nexus-rpc/api/pull/5

## How did you test it?

Modified existing and added new tests.
2024-05-09 12:17:52 -07:00
Tim Deeb-SwihartandGitHub ee2587a8a9 Ban the connect attr interpolateParams for MySQL 8 Vis dbs (#5441)
## What changed?
Attempting to configure a MySQL 8 Visibility database with
go-sql-driver/mysql's `interpolateParams` option will now fail.

## Why?

There are a number of reasons why this doesn't work right now so we're
going to prevent it from happening while we discuss how much we should
invest in fixing it. The current work to fix this is in
https://github.com/temporalio/temporal/pull/5428

## How did you test it?
Added a new test

## Potential risks
There should be none. Any user who has currently set up their database
this way will already have encountered exciting errors like `Cannot
create a JSON value from a string with CHARACTER SET 'binary'` and
`Unable to parse ExecutionStatus value from DB`.

## Is hotfix candidate?

That's up for discussion
2024-03-08 20:03:47 +00:00
55771ce32d Nexus accumulated work (#5225)
This PR is intended to merge 4 months of work in the `nexus` feature
branch into `main`.

The functionality it brings is:
- Dispatching Nexus Tasks by namespace and task queue
- Internal implementation of the Incoming Service Registry - not yet
exposed
- Attaching workflow close callbacks on `StartWorkflowExecutionRequest`
and processing of those callbacks

There's more to come and some of the callback code will be refactored
into a new plugin architecture
(https://github.com/temporalio/temporal/pull/5446) soon.

---------

Co-authored-by: PJ Doerner <[email protected]>
2024-03-05 22:37:21 +00:00
Prathyush PVandGitHub 720ebc5a14 EnqueueMessage and ReadMessage methods for QueueV2 SQL Implementation (#4937)
<!-- Describe what has changed in this PR -->
**What changed?**
Adding EnqueueMessage() and ReadMessage() methods for SQL version of
persistence.QueueV2, which supersedes the persistence.Queue interface.
The implementations for delete and merge are left out for now and will
be implemented later.


<!-- Tell your future self why have you made these changes -->
**Why?**
We plan on using this for the upcoming history task DLQ project.


<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
Unit tests.

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


<!-- Is this PR a hotfix candidate or require that a notification be
sent to the broader community? (Yes/No) -->
**Is hotfix candidate?**
2023-10-10 09:57:37 -07:00
Matt McShaneandGitHub 932003d936 Inline UpdateInfo Storage (#4420)
* Revert "Capture UpdateInfos in MutableState mutation (#4372)"

This reverts commit c78ee02eee.

* Revert "Adds update state indexing to MutableState (#4224)"

This reverts commit f8303d8e7e.

* Add UpdateInfo map to WorkflowExecutionInfo

This inlines the UpdateInfo index into the pre-existing execution blob
so that downstream persistence implementations won't see any change.
2023-05-31 13:46:55 -04:00
Matt McShaneandGitHub f8303d8e7e Adds update state indexing to MutableState (#4224)
Add UpdateInfo records to MutableState

A mechanism for storing pointers into the workflow history representing
update accepted or completed events. Storage added for Cassandra,
PosgtreSQL, MySQL, and SQLite.
2023-05-03 12:24:32 -04:00
Rodrigo ZhouandGitHub 68f0430e78 Advanced visibility for MySQL (#3878) 2023-02-02 16:06:23 -08:00
Rodrigo ZhouandGitHub 7e1ddb70dc Add GetIndexName method to visibility manager (#3820) 2023-01-27 00:44:39 -08:00
Yichao YangandGitHub b5ff033db0 Support arbitrary history task category in SQL persistence (#3489) 2022-10-19 16:08:01 -07:00
Yichao YangandGitHub 13b102065e Remove unused queue processor (#2473) 2022-02-08 10:39:11 -08:00
VitalyandGitHub a12c16d612 Add tiered storage queue processor (#2189) 2021-11-18 21:34:13 -08:00
Alex ShtinandGitHub 996824e53c Move config and dynamicconfig packages to the common (#1372) 2021-03-15 10:45:11 -07:00
wxing1292andGitHub a4e4b37136 Unify db version check (#1299)
* Add version check method to SQL interface
* Remove tools version check method in favor of functions defined in persistence package
* Refactor tests to not depend on tools package
2021-02-18 10:41:44 -08:00
Alex ShtinandGitHub c4d40f4db9 Bugfix: NoopResolver was always used for version compatibility check (#1233) 2021-01-28 07:47:41 -08:00
Alex ShtinandGitHub b530bb0f5f Add ServiceResolver interface and corresponding ServerOption (#1188) 2021-01-14 21:29:04 -08:00
wxing1292andGitHub eb65ab4b26 Add visibility tasks table for SQL (#1055)
* Add SQL visibility_tasks table for Kafka deprecation
2020-12-09 11:17:23 -08:00
wxing1292andGitHub 6b04aa3997 Optimize SQL layer supporting batch delete (#982)
* Optimize SQL layer supporting batch delete
* Split DeleteFromActivityInfoMaps into DeleteFromActivityInfoMaps and DeleteAllFromActivityInfoMaps
* Split DeleteFromTimerInfoMaps into DeleteFromTimerInfoMaps and DeleteAllFromTimerInfoMaps
* Split DeleteFromChildExecutionInfoMaps into DeleteFromChildExecutionInfoMaps and DeleteAllFromChildExecutionInfoMaps
* Split DeleteFromRequestCancelInfoMaps into DeleteFromRequestCancelInfoMaps and DeleteAllFromRequestCancelInfoMaps
* Split DeleteFromSignalInfoMaps into DeleteFromSignalInfoMaps and DeleteAllFromSignalInfoMaps
* Split DeleteFromSignalsRequestedSets into DeleteFromSignalsRequestedSets and DeleteAllFromSignalsRequestedSets
2020-11-16 16:50:30 -08:00
wxing1292andGitHub 24b80b2f91 Add context to all SQL interfaces (#980)
* Add context to all SQL interfaces
* Wire context with SQLx
* Set default execution DB timeout to 5s
* Set default visibility DB timeout to 10s
2020-11-11 16:30:36 -08:00
wxing1292andGitHub ef7860ce5d Add SQL specific tests for messages, part 2 (#914)
* Rewrite queue metadata APIs similar to transfer tasks, timer tasks
* Add queue metadata tests
* Add missing encoding type
2020-11-09 11:57:38 -08:00
wxing1292andGitHub a13e753cd7 Add SQL specific tests for messages, part 1 (#892)
* Rewrite APIs similar to transfer tasks, timer tasks
* Add queue message tests
2020-10-26 19:13:45 -07:00
wxing1292andGitHub 0dc3f9d611 Split remaining SQL persistence interfaces into dedicated files (#872)
* Move ClusterMetadata into dedicated file
* Move HistoryExecutionBuffer into dedicated file
* Move HistoryShard into dedicated file
* Move Namespace into dedicated file
* Move MatchingTask into dedicated file
* Move MatchingTaskQueue into dedicated file
* Use filter struct directly instead of pointer to struct
2020-10-21 10:01:11 -07:00
wxing1292andGitHub 3f4c9d0742 Add SQL specific tests for replication tasks (#859)
* Some minor code structure change
* Add replication tasks tests
* Add replication DLQ tasks tests
2020-10-15 15:55:28 -07:00
wxing1292andGitHub 33e374bbea Add SQL specific tests for history events (#820)
* Add history node tests
* Add history tree tests
2020-10-09 16:55:22 -07:00
wxing1292andGitHub 47ddc73ab1 Add SQL specific tests for visibility, part 1 (#809)
* Add visibility tests
* Unify the behavior on MySQL & PostgreSQL
2020-10-07 19:53:44 -07:00
wxing1292andGitHub 8f7e868b56 Add SQL specific tests for transfer / timer tasks (#802)
* Add history transfer task tests
* Add history timer task tests
* Add missing functionalities
2020-10-06 12:51:55 -07:00
wxing1292andGitHub b28183f9b0 Add SQL specific tests for mutable state, part 1 (#799)
* Add history execution buffer tests
* Add history execution activity tests
* Add history execution child workflow tests
* Add history execution timer tests
2020-10-05 15:37:10 -07:00
wxing1292andGitHub c3f861e075 Add SQL specific tests (#796)
* Add history shard tests
2020-10-05 14:59:24 -07:00
wxing1292andGitHub 1f56c0492a Add SQL specific tests for namespace (#793)
* Add namespace tests
* Remove redundant select during creation of namespace
2020-10-05 14:34:04 -07:00
wxing1292andGitHub c3d126b59a Add SQL persistence specific tests (#789)
* Add matching task tests
2020-10-02 17:58:59 -07:00
wxing1292andGitHub 35272a29e1 Split SQL storage interfaces & definitions (#788) 2020-10-02 11:47:09 -07:00
Shawn HathawayandGitHub 7ae7ab205e ClusterMembership Partition Pin/AutoIncrement Removal (#583) 2020-07-22 10:08:41 -07:00
Shawn HathawayandGitHub 467131c5f6 Add Hash to Task Schema Key, compound TaskQueueId (#557) 2020-07-20 11:12:12 -07:00
Shawn HathawayandGitHub 888f942274 TaskQueue Schema Collapse (#500) 2020-07-16 20:35:41 -07:00
Alex ShtinandGitHub 8446bbfe7f Migrate to new vanity import URLs (#517) 2020-07-08 19:48:20 -07:00
Alex ShtinandGitHub 6a6909e92a Use vanity import package name go.temporal.io/server (#511) 2020-07-08 16:09:12 -07:00
Alex ShtinandGitHub a7b4c34f49 Add proto generated go files (#506) 2020-07-08 09:25:23 -07:00
Alex ShtinandGitHub 5e90af33d3 Fix visibility execution status (#492) 2020-07-06 16:43:35 -07:00
Alex ShtinandGitHub 907f23f007 Rename task list to task queue (#480) 2020-06-27 12:11:25 -07:00
Alex ShtinandGitHub e398c4fe7d Fix buf lint warnings (#449) 2020-06-12 14:55:55 -07:00
Shawn HathawayandGitHub 8163f38c5d Represent UUIDs as String (#375) 2020-05-15 12:46:43 -07:00
Mark MarkaryanandGitHub be70643e67 Consolidate WorkflowState* int constants into WorkflowExecutionState .proto enum (#352) 2020-05-11 19:03:04 -07:00
Alex ShtinandGitHub 6954ffedb4 Remove heartbeat fields from ActivityInfoRaw (#327) 2020-04-24 18:15:01 -07:00
Samar Abbas 888f52ebf3 Merges cadence commits to temporal 2020-04-20 11:27:56 -07:00
Shawn HathawayandGitHub a75ba89bf1 Frozen Namespace to Proto (#281)
* Restructure NamespaceInfo Protos
* System namespace registration is moved to the immutableClusterMetadata path, rather than registering in schema
* Add NewUUID(), Fix Namespace test
* Remove unused import
* Serialization moved to Manager
2020-04-10 11:26:28 -07:00