Commit Graph
11 Commits
Author SHA1 Message Date
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
Alex ShtinandGitHub 3e6639d573 Replace golang.org/x/exp with stdlib where possible (#6366)
## What changed?
<!-- Describe what has changed in this PR -->
Replace `golang.org/x/exp` with stdlib where possible. Unfortunately,
`maps` doesn't provide all methods that `expmaps` does, so I still have
`golang.org/x/exp` in `go.mod`.

## Why?
<!-- Tell your future self why have you made these changes -->
Follow up to #6018.

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

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

## 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/`? -->
No.

## 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-08-01 19:33:04 +00: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
David ReissandGitHub 12c24cc4e6 Ensure we don't open sqlite multiple times (#5532)
## What changed?
Sort sqlite connect attributes to ensure a deterministic string so the
sqlite pool logic works correctly.

## Why?
I noticed a lot of `database is locked (5) (SQLITE_BUSY)` errors when
using a local dev server, and tracked it down to multiple services
having separate connection to the db. The sqlite connection pool is
supposed to prevent this, but it depends on the mapping from
`ConnectAttributes` to a string being deterministic. The code that
constructed the string was iterating over a `map[string]string` without
sorting the keys making it nondeterministic.

## How did you test it?
local testing, saw no more SQLITE_BUSY errors
2024-03-14 10:57:44 -07:00
Rodrigo ZhouandGitHub 49ababab77 Advanced visibility for SQLite (#3895) 2023-02-03 00:46:58 -08:00
3f359ab721 add support for multiple pragma statements and driver syntax (#3031)
* add support for multiple pragma statements and driver syntax

* Update common/persistence/sql/sqlplugin/sqlite/driver.go

Co-authored-by: Alex Shtin <[email protected]>

* Update common/persistence/sql/sqlplugin/sqlite/plugin.go

Co-authored-by: Alex Shtin <[email protected]>

Co-authored-by: Alex Shtin <[email protected]>
2022-06-30 12:56:31 -07:00
Jeremy BreidingandGitHub efcfd1c538 Revert back to using file URI for sqlite dsn (#2731) 2022-04-19 19:47:35 -07:00
Jeremy BreidingandGitHub d3b480cab9 replace sqlite3 with modernc (#2704)
* replace sqlite3 with modernc

* file mode tests

* Expand tests to include file persistence for sqlite
2022-04-13 15:29:38 -07:00
Anton TitovandGitHub 1eb5f58597 Single binary server (SQLite) and concurrency bugfixes for in memory storages (#2114) 2022-01-31 22:34:33 -08:00
Alex ShtinandGitHub 87c5e9873a Enable cgo by default and disable it explicitly for docker image build (#2396) 2022-01-20 17:06:23 -08:00
Jacob LeGroneandGitHub c6eee98792 Add SQLite storage driver (#1968)
* Import SQLite driver from Temporalite: these files originated from https://github.com/DataDog/temporalite
* Add SQLite driver layer & UT
* Use mattn SQLite driver

NOTE: SQLite support is still in development stage
2021-09-29 14:20:40 -07:00