Граф коммитов

101 Коммитов

Автор SHA1 Сообщение Дата
Harshit Gangal c7116c9075
test: deflake TestIdleTimeoutCreateFail (#11411)
Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-10-03 13:04:53 +05:30
Harshit Gangal 4b58cb702e
generate settings plan in tablet with query and reset setting query (#11181)
* feat: generate setting plan and simplicy the logic and cache the plan for reuse

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: reset settings over closing when settings do not match

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* refactor: setting interface to struct

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: inifinite session test having connection settings

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-09-13 12:21:39 +05:30
Max Englander 3e3365eecd
decouple olap tx timeout from oltp tx timeout (#10946)
* decouple olap tx timeout from oltp tx timeout

Since workload=olap bypasses the query timeouts
(--queryserver-config-query-timeout) and also row limits, the natural
assumption is that it also bypasses the transaction timeout.

This is not the case, e.g. for a tablet where the
--queryserver-config-transaction-timeout is 10.

This commit:

 * Adds new CLI flag and YAML field to independently configure TX
   timeouts for OLAP workloads (--queryserver-config-olap-transaction-timeout).
 * Decouples TX kill interval from OLTP TX timeout via new CLI flag and
   YAML field (--queryserver-config-transaction-killer-interval).

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: pr comments #1

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: pr comments #2 consolidate timeout logic in sc

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: remove unused tx killer flag

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: update 15_0_0_summary.md

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: fix race cond

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: pr comments #3 -txProps.timeout, +sc.expiryTime

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: pr comments #4 -atomic.Value for expiryTime

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: fix race cond (without atomic.Value)

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: pr comments #5 -unused funcs, fix comments, set ticks interval once

Signed-off-by: Max Englander <max@planetscale.com>

* decouple ol{a,t}p tx timeouts: pr comments #5 +txkill tests

Signed-off-by: Max Englander <max@planetscale.com>

* revert fmt changes

Signed-off-by: Max Englander <max@planetscale.com>

* implement pr review suggestion

Signed-off-by: Max Englander <max@planetscale.com>

Signed-off-by: Max Englander <max@planetscale.com>
2022-09-07 22:37:27 +05:30
Harshit Gangal 3fce3e90c1
feat: added setting pool metrics (#11175)
Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-09-07 14:17:58 +05:30
Harshit Gangal 1643e90e65
feat: return resource back to pool and apply settings failure (#11096)
Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-08-25 19:31:13 +05:30
Harshit Gangal d0466c07e0
System Settings connections pool implementation (#11037)
* feat: added connections with settings logic to resource pool

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: support refresh pool for settings connection channel and added benchmark for settings connection

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: take from settings channel and reset the conn if nothing present in non-setting channel

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* fix: return 0 for setting hash for resource where it does not exists

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: added benchmark for applying settings individual set statement and single statement

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: added mixed settings benchmarks

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: close idle resources in settings pool andadded unit tests

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* refactor: removed settingHash from Put method of pool

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* fix: better channel select in get, avoid closing connection when no setting is applied on the connection in getwithsettings and only apply the settings on that connection

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: added addtional unit test

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* feat: compare the two settings rather than using hash

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* added comment for a SetCapacity code for better explaination

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* select channel is enough to block till a resource is not received, removed for loop around it

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-08-25 17:10:45 +05:30
Harshit Gangal f4f50ad1df
Remove prefill logic from resource pool (#11002)
* refactor: removed prefill parallelism, removed unnecessary tracing, added pool benchmark

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* updated doc and mark flag deprecation

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: fix test expectation

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-08-18 21:22:25 +05:30
Matt Lord 94861104f7
Run latest gofmt on everything & address linter warnings (#11008)
* Run latest gofmt on everything & address linter warnings

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Rebuild proto impls with new protoc

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Field name is needed for zk

Signed-off-by: Matt Lord <mattalord@gmail.com>

* Make protos with 1.18.4

Signed-off-by: Matt Lord <mattalord@gmail.com>

Signed-off-by: Matt Lord <mattalord@gmail.com>
2022-08-16 13:53:42 -07:00
Harshit Gangal 072229633f
refactor: make resource pool as interface and pool refresh as common (#10784)
* refactor: add resource pool as interface

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: mark resource pool test as non-flaky

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* test: adds a benchmark test

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* refactor: pull refresh pool code out from pool implementation

Signed-off-by: Harshit Gangal <harshit@planetscale.com>

* addressed review comments

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2022-07-28 01:03:19 +05:30
Vicent Marti 8de235531d all: gofmt -w -r 'interface{} -> any' src
Signed-off-by: Vicent Marti <vmg@strn.cat>
2022-03-22 09:39:55 +01:00
dleibovic 15df6fcd7d Harmonize error codes for pool timeouts expiring across all pools
Previously, the transaction pool overrode the error codes for pool timeouts expiring. Let's use consistent error codes across the pools.

Signed-off-by: dleibovic <dleibovic@etsy.com>
2022-02-08 14:23:00 -05:00
Jacques Grove cb46471e42 Add mutex to protect resource_pool.reopen
Remove superfluous else
Minor log message changes

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2021-09-30 10:44:02 -07:00
Andres Taylor 31820ccb7c updated test to use testify
Signed-off-by: Andres Taylor <andres@planetscale.com>
2021-09-30 08:09:45 +02:00
Jacques Grove cbcdb4e1c6 Fix logging; add logging when reopening pool.
Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2021-09-27 10:29:28 -07:00
Jacques Grove 2d024326fa Refactor DNS refresh changes
Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2021-09-17 15:28:02 -07:00
Jacques Grove fe8a6f0e11 First cut at reworking the pool DNS refresh mechanism by making it more
general.  We now drain the pool and re-open when we see a DNS change,
instead of reconnecting when the connection is pulled from the pool.

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2021-09-17 01:05:43 -07:00
Andrew Mason d82eca326b add cluster debug info
Signed-off-by: Andrew Mason <amason@slack-corp.com>
2021-07-12 18:55:41 -04:00
Andrew Mason db46646a85 Add RPCPool implementation
An RPCPool is a special case of the ResourcePool, where the actual
"resources" in the pool are essentially a lease to perform an RPC (or
access any shared resource) with differing timeout semantics than the
sync2.Semaphore.

Signed-off-by: Andrew Mason <amason@slack-corp.com>
2021-07-06 11:16:31 -04:00
Vicent Marti f681e00146 cache: make the cache implementation swappable
Signed-off-by: Vicent Marti <vmg@strn.cat>
2021-02-02 17:50:04 +01:00
Vicent Marti cbbba9ed94 cache: abstract into a Cache interface
The `cache.LRUCache` struct has now been abstracted behind a generic
Cache interface so that it can be swapped with more complex Cache
implementations.

Signed-off-by: Vicent Marti <vmg@strn.cat>
2021-02-02 11:27:21 +01:00
Aditya Sharma 47611bca39 goimports -local vitess.io/vitess -w .
Signed-off-by: Aditya Sharma <git@adi.run>
2021-01-04 18:27:04 -05:00
Aditya Sharma c9b6d608f7 run go fix ./...
Signed-off-by: Aditya Sharma <git@adi.run>
2021-01-01 13:29:32 -05:00
imxyb bb4a844db0 doc: fix comment for IDPool
Signed-off-by: imxyb <xyb4638@gmail.com>
2020-12-22 10:43:49 +08:00
Sugu Sougoumarane b5b1354432 pools: Numbered.GetByFilter
Needed for extracting no-transactional stateful connections.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-11-09 19:28:59 -08:00
Rafael Chacon 28878bcf03 Adds better error when there are timeouts in resource pools
Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2020-11-06 16:45:03 -08:00
Jacques Grove b3cf0f2b38 * Return to an id pool for binlog server ID, but randomize initial value
* Rename sc to bc;  legacy of SlaveConnection
* Rename connID to serverID to reflect what it actually represents

Signed-off-by: Jacques Grove <aquarapid@gmail.com>
2020-10-24 12:52:14 -07:00
Andres Taylor 999c7e7936 added endtoend tests
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-08-14 12:33:44 +02:00
Harshit Gangal 0bf6776ca5 close idle reserved connections and rollback idle transactions
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
2020-08-11 18:17:41 +05:30
Andres Taylor 9cb9f395ff Fixed test failures
Signed-off-by: Andres Taylor <andres@planetscale.com>
2020-05-25 10:10:21 +05:30
Sugu Sougoumarane 6abab7ed41 vttablet: plumb context through all pool connects
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-04-13 17:05:28 -07:00
Sugu Sougoumarane 932e4cb7b5 componentization: clean up dbconnpool
The DBConnPool stats vars were not used by anyone other than
vttablet. So, I've moved them into tabletserver's connnpool,
which simplifies DBConnPool.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2020-04-08 14:22:50 -07:00
Lloyd Cabancla 6b8b6b460e Used callback to log resource pool wait time
Signed-off-by: Lloyd Cabancla <lcabancla@squareup.com>
2020-02-13 17:13:14 -05:00
Lloyd Cabancla 5d172c4c2d Added resource pool wait time histogram metrics
Signed-off-by: Lloyd Cabancla <lcabancla@squareup.com>
2020-02-13 17:01:41 -05:00
Morgan Tocker 64e1ad3e40 Move flaky test to _flaky_
Signed-off-by: Morgan Tocker <tocker@gmail.com>
2020-01-01 10:39:27 -07:00
Rafael Chacon e25bb3c740 Update test due to changes
Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-10-30 09:50:53 -07:00
Rafael Chacon 8a0e96f6fb Better granularity for errors that come out of the pool
* This PR adds a new error that distinguishes between actual timeouts from the
  pool and errors due to contexts being already expired by the time it gets to
  the pool.

Signed-off-by: Rafael Chacon <rafael@slack-corp.com>
2019-10-29 11:00:24 -07:00
yuxiaobo 03e83d6c30 add license in /go file
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-10-21 22:30:02 +08:00
Adam Saponara 0426fc324f Track number of times pool had zero available slots
Signed-off-by: Adam Saponara <as@php.net>
2019-09-12 15:30:06 -04:00
Enrique Bris 879b190e57 fixed typo in pools.NewResourcePool docs comments
Signed-off-by: Enrique Bris <cubanhenry5@gmail.com>
2019-07-22 15:44:58 -04:00
Sugu Sougoumarane 61655c05c6 pools: address more review comments
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-06-05 23:29:11 -07:00
Sugu Sougoumarane 94a33b4e6a pools: address review comments
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-06-02 10:07:43 -07:00
Sugu Sougoumarane 9cebb4079b pools: unify constructor to NewResourcePool
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-05-25 07:14:47 -07:00
Sugu Sougoumarane ba54ddcf0d pools: solidfy prefill code and add tests
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-05-24 08:42:27 -07:00
Sugu Sougoumarane ec490355e2 pools: option to prefill
Background: this change allows one to create prefilled resource
pools. This is useful when traffics suddenly shift while the
pool is still empty. This causes a thundering herd of Open requests
that can cause outage.

There is a proposal to rewrite this pool to natively accommodate
this feature. This change is a stand-in until that effort is
completed.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
2019-05-24 05:14:47 -07:00
Alec Thomas 50e1eb912a Instrument more of vttab with tracing spans.
Signed-off-by: Andres Taylor <antaylor@squareup.com>
Signed-off-by: Alec Thomas <aat@squareup.com>
2019-03-28 15:20:03 +01:00
Danny Wensley e32cc4df41
Fix go panic caused by unaligned atomic fields on certain architectures.
Signed-off-by: Danny Wensley <danny@wensley.eu>
2019-03-16 21:54:59 +00:00
deepthi 86474bbd59 staticcheck: packages/files missed during first pass
Signed-off-by: deepthi <deepthi@planetscale.com>
2019-03-07 11:51:31 -08:00
Daniel Tahara 279d18cbde [Resource Pool] Shorten critical section for register/unregister
Doing object allocation and fmt.Sprintf under a lock is unecessary and
expensive.  Refactor Register/Unregister to reduce blocking.

Benchmark shows A change. Probably inconsequential, but can't hurt.

Signed-off-by: Daniel Tahara <tahara@dropbox.com>
2018-08-16 21:24:07 -07:00
Anthony Yeh aaf2b2d78b
Run goimports on all Go files. 2018-02-27 12:57:21 -08:00
Anthony Yeh 6914580ad5
Rewrite imports to new custom URL.
This commit consists only of the changes from running the following:

```
find go -name '*.go' | xargs -n 10 -- sed -i -r -e \
  's,"github.com/youtube/vitess/go/,"vitess.io/vitess/go/,'
```
2018-02-27 12:00:33 -08:00