* 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>
* 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>
* 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>
* 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>
* 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>
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>
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>
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>
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>
* 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>
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>
* 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>
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>
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>
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/,'
```