Commit Graph
28 Commits
Author SHA1 Message Date
022bc2a714 Add sql connection pool metrics (#8071)
## What changed?

Adding sql connection pool metrics from stdlib `Stats`

## Why?

Expose more metrics for config fine tuning

## How did you test it?
- [x] built
- [x] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

---------

Co-authored-by: Roey Berman <[email protected]>
Co-authored-by: Roey Berman <[email protected]>
2025-09-08 17:09:57 -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
Chetan GowdaandGitHub c15f9436be Add tests for the fix in PR #6538 (#6652)
## What changed?
A critical bug was fixed in PR #6538. These are the associated tests to
prevent regression.

## Why?
Adding tests for a bug fix.

## How did you test it?
Reverted the PR locally and ensured the tests catch it.

## Potential risks
N/A
2024-10-15 15:25:58 -04: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
Daniel KimandGitHub 6ac5c584d7 Support sql connector (#5265)
## What changed?
SQL config now supports passing a connect function.

## Why?
It's currently not possible to embed a Temporal server to a host
application where the database connection is managed by the host
application and is provided as a database connector. This allows the
host application to pass a db connector rather than the the individual
sql config strings.

## How did you test it?
I have embedded this code into a custom application and verified that
the connector is working properly.

## Potential risks
This is a non-breaking change with very minimal risks.

## Is hotfix candidate?
No.
2024-05-24 14:39:46 -07: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
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
Rodrigo ZhouandGitHub 2c12548f8e Refactor var names related to visibility mysql8 and postgres12 (#5464)
## What changed?
<!-- Describe what has changed in this PR -->
Rename vars related to visibility.

## Why?
<!-- Tell your future self why have you made these changes -->
Ease to read code.

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

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

## 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) -->
No
2024-02-29 13:54:30 -06:00
Rodrigo ZhouandGitHub 0280e70e5b Remove support for standard visibility (#5387)
## What changed?
<!-- Describe what has changed in this PR -->
Remove support for standard visibility

## Why?
<!-- Tell your future self why have you made these changes -->
Standard visibility is deprecated.

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

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

## 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-02-29 12:05:20 -06:00
wxing1292andGitHub 7258e62519 Separate SQL session management into a dedicated file (#2391)
* Create reusable MySQL session util
* Create reusable PostgreSQL session util
2022-01-19 13:33:07 -08:00
wxing1292andGitHub 827a5afa11 Use mysql.Config for mysql connection string management (#1705)
* Use mysql.Config for mysql connection string management
* Set mysql.Config.RejectReadOnly = true in case mysql encounters automatic failover event
2021-07-02 18:53:30 -07:00
Alex ShtinandGitHub 996824e53c Move config and dynamicconfig packages to the common (#1372) 2021-03-15 10:45:11 -07:00
wxing1292andGitHub 4d3241c47a Make tests execute one SQL / CQL statement at a time (#1365)
* Change test code to execute one SQL / CQL statement at a time.

Some database does not handle well if seeing a batch of sql statements.
This PR breaks the SQL / CQL statements used by test setup and execute
one statement at a time.
2021-03-10 11:01:07 -08: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 b530bb0f5f Add ServiceResolver interface and corresponding ServerOption (#1188) 2021-01-14 21:29:04 -08:00
wxing1292andGitHub 4d8d473fd2 Add TLS configuration for PostgreSQL (#849) 2020-10-13 19:00:26 -07:00
Sergey BykovandGitHub 36faccb366 Enforce minimum TLS version of 1.2 (#831)
* Enforce minimum TLS version of 1.2
2020-10-12 11:04:11 -07:00
wxing1292andGitHub 7b086939f1 Enable PostgreSQL tests on github (#821)
* Enable PostgreSQL tests on Github
* Move some tests around to avoid import cycle
2020-10-09 17:16:40 -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 4a25002ccc Update LICENSE file and all go files with new license header (#285) 2020-04-08 20:39:01 -07:00
Samar AbbasandGitHub 0649f09dda Update cadence references to temporal (#209)
Change all cadence references to temporal references throughout
source code and documentation.

Change docker entry point to tctl as we renamed it from temporal
to tctl.

Update mysql user login info.
2020-03-11 21:45:49 -07:00
Samar Abbas 8e55282c63 merge from cadence 02-18-2020 2020-02-23 01:29:24 -08:00
Andrew DawsonandGitHub 03656dc9c8 Fix lint issues (#3006) 2020-01-28 03:55:29 +07:00
Alex Shtin 0e4ca57040 Merge from uber/cadence on 01-23-20. 2020-01-23 15:37:35 -08:00
Ben JacobsonandVenkat 9ee79dc723 Add support for custom mysql tls configuration (#2913) 2020-01-10 16:43:29 -08:00
Samar Abbas 34bd0a03c2 resolve all merge conflicts and unit tests to work again 2019-12-10 12:20:56 -08:00
Quanzheng LongandGitHub fdee70fac9 Persistence refactoring to be pluggable for any database (#2836) 2019-12-05 15:59:09 -08:00