Commit Graph

258 Commits

Author SHA1 Message Date
刘青 8a3f304b25
Log with context to associate all log by traceID (#1413)
* Log with context to associate all log by traceID
2020-07-18 09:04:36 +03:00
Vladimir Mihailenco f2645d373d
Merge pull request #1405 from fishy/atomic-value-last-dial-error
Use atomic.Value instead of lock for ConnPool.lastDialError
2020-07-16 10:41:42 +03:00
Vladimir Mihailenco 38c87c1f84 Fix golangci 2020-07-16 10:01:27 +03:00
Vladimir Mihailenco 14c843ef89 gofumports 2020-07-16 09:52:07 +03:00
Tiger He 62469e4f42
Introduce metrics capture with OpenTelemetry (#1398)
* internal: Add instrumentation

Co-authored-by: reggiemcdonald <regmcdonald95@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2020-07-15 12:07:07 +03:00
Yuxuan 'fishy' Wang 4f70db6849 Use atomic.Value instead of lock for ConnPool.lastDialError
This makes the reading and writing of lastDialError from the pool
faster, as atomic.Value is much more lightweight than the mutex.

Note that using error in atomic.Value directly could cause panics,
because errors could have inconsistent types. Thus wrap them with a
simple struct.
2020-07-14 11:25:59 -07:00
Vladimir Mihailenco 8f29d08432 Don't record proto.Nil 2020-07-09 11:00:23 +03:00
Vladimir Mihailenco 1831363467 Add RecordError 2020-07-09 10:39:46 +03:00
Vladimir Mihailenco 64995f9a51 Tweak auto-reloads 2020-06-29 17:51:47 +03:00
Vladimir Mihailenco 0ffefcde98 Use random node to load cluster slots 2020-06-29 17:26:11 +03:00
Vladimir Mihailenco 789ee0484f Remove io.StringWriter 2020-06-12 10:09:32 +03:00
Vladimir Mihailenco 8eed1e67ff Add OpenTelemetryHook 2020-06-09 17:17:41 +03:00
Vladimir Mihailenco 694e518a8c Use Rendezvous in Ring. Thanks @rafaeleyng for initial idea and implementation 2020-06-08 13:22:37 +03:00
Vladimir Mihailenco 4440575966 Merge branch 'v8' 2020-05-21 10:16:44 +03:00
Vladimir Mihailenco a7c11d9699
Merge pull request #1285 from kudrykv/issue-1279
Use an interface for logging
2020-05-21 10:08:11 +03:00
Vladimir Mihailenco 0c500078e5
Merge pull request #1273 from theo-delaune-argus/time-nanoseconds
Store time in RFC3339Nano to keep nanoseconds
2020-05-21 09:39:48 +03:00
Vladimir Mihailenco 07656a01bf Add redis.Error interface and export ErrClosed
Fixes https://github.com/go-redis/redis/issues/1295
Closes https://github.com/go-redis/redis/pull/1296
2020-05-21 09:24:54 +03:00
Vladimir Mihailenco 3031343dae Make cmd.String() faster 2020-05-19 08:52:38 +03:00
Vladimir Mihailenco 2b060bb99d Remove error reporting 2020-05-19 08:52:38 +03:00
Vladimir Mihailenco 66cd13e793 Update otel 2020-05-19 08:52:38 +03:00
Vladimir Mihailenco 3dcb844106 Bump major version 2020-05-19 08:52:38 +03:00
Vladimir Mihailenco f5593121e0 Add ctx as first arg 2020-05-19 08:52:38 +03:00
wanglei6 39881392de code fmt 2020-04-30 17:46:50 +08:00
wanglei6 4d5f8a5df3 fix data race 2020-04-30 14:34:48 +08:00
Vitaliy Kudryk 39272697aa
issue-1279 update logging 2020-03-30 17:02:17 +03:00
theo-delaune-argus fea610f7b4 Store time in RFC3339Nano to keep nanoseconds 2020-03-13 17:48:33 +01:00
Vladimir Mihailenco a2de1fe668 internal/pool: include details when conn is in a bad state 2019-09-13 16:52:05 +03:00
Ou Changkun cb2d1c89e6 internal/pool: exit conn pool fast (#1155)
* internal/pool: exit conn pool reaper fast
2019-09-09 11:50:28 +03:00
Vladimir Mihailenco e694ed0084 Cleanup 2019-08-18 17:11:07 +03:00
Vladimir Mihailenco eaeb8f2a08 internal: return an error on setting deadline 2019-08-16 17:50:57 +03:00
Vladimir Mihailenco e269de20cf internal/proto: use strict ReadLine 2019-08-14 11:14:50 +03:00
Vladimir Mihailenco 61e0d1d527 internal/proto: util util.Atoi 2019-08-14 10:24:13 +03:00
Vladimir Mihailenco 4d3ed95bd9 Add conn health check 2019-08-09 15:11:52 +03:00
Vladimir Mihailenco 7779accbea Use semantic import versioning 2019-08-08 14:29:44 +03:00
Vladimir Mihailenco 87225c1cf9 malign struct fields 2019-08-08 14:22:01 +03:00
Vladimir Mihailenco e0fed4d581 Remove atomic.Value.Store(nil) 2019-08-08 14:04:19 +03:00
Vladimir Mihailenco 2927e15b6b Retry BadConnError 2019-08-08 11:44:55 +03:00
Vladimir Mihailenco 27f3b27893 Fix names 2019-08-07 16:12:01 +03:00
Vladimir Mihailenco 4e9cea8876 Add proper SingleConnPool implementation 2019-08-03 17:31:28 +03:00
Patrick White efa4a78883 Close single conn connection pool 2019-08-01 14:59:53 -07:00
Vladimir Mihailenco c837612911 Cancel sleep when context is cancelled 2019-07-30 12:13:00 +03:00
Vladimir Mihailenco 6d8db67ef5 Cleanup 2019-07-28 10:53:40 +03:00
waterandair 6cd6cd828f protect pollSize and idleConnsLen with mutex (#1105)
Fix poolSize and idleConnsLen when conn can't be created
2019-07-28 09:56:57 +03:00
Vladimir Mihailenco f3ce3362a0 Add golangci-lint 2019-07-25 14:36:50 +03:00
Vladimir Mihailenco 0e7fb3b12d Marshal time as RFC3339. Add StringCmd.Time helper. 2019-07-25 13:03:09 +03:00
Vladimir Mihailenco 2cbb5194fb Fix WithContext and add tests 2019-07-04 11:57:54 +03:00
Vladimir Mihailenco 717362d3e9 Inc StaleConns in ReapStaleConns 2019-06-24 15:27:03 +03:00
Vladimir Mihailenco 7a300ac6eb
Merge pull request #1060 from go-redis/fix/cleanup-code
Cleanup
2019-06-17 13:04:50 +03:00
Vladimir Mihailenco 3bdf64784a Cleanup 2019-06-17 12:32:40 +03:00
Vladimir Mihailenco 246d502457 Don't panic if multi bulk parser is nil 2019-06-16 14:06:13 +03:00
Vladimir Mihailenco aa5f492665 internal/pool: cleanup 2019-06-15 10:34:38 +03:00
Vladimir Mihailenco 880e05d975 Cleanup 2019-06-14 16:00:03 +03:00
Vladimir Mihailenco c0e70ad31d internal/pool: use min nonzero deadline 2019-06-14 14:50:58 +03:00
Vladimir Mihailenco f8704e4b6b Cleanup 2019-06-09 12:29:23 +03:00
Vladimir Mihailenco 35932b7961 Check context.Done while waiting for a connection 2019-06-08 15:36:00 +03:00
Vladimir Mihailenco 5460bc10f2 Use Context.Deadline to set net.Conn deadline 2019-06-08 15:02:51 +03:00
Vladimir Mihailenco 53c8a4a6b7 Pass context to Dialer 2019-06-04 14:26:26 +03:00
Vladimir Mihailenco 6c72dc807e internal/pool: replace atomic.Value with int64 2019-06-01 11:32:05 +03:00
Vladimir Mihailenco b706478fdc Fix MinIdleConns and MaxConnAge 2019-03-25 13:02:31 +02:00
Vladimir Mihailenco ac9e1abf54 Retry master node on readonly errors. Fixes #977 2019-02-27 12:53:44 +02:00
WANG QIANG d040650021 Remove SingleFlight package 2019-01-08 17:15:24 +08:00
Vladimir Mihailenco fa76dd0e87 Add releaseConnStrict 2018-10-14 11:27:34 +03:00
Andrii Kushch f5d67d80d3 remove unused function 2018-10-11 12:55:35 +02:00
Vladimir Mihailenco 8d3747808e internal: retry timeout 2018-08-23 16:13:42 +03:00
Vladimir Mihailenco 0197108027 Use bufio.Writer 2018-08-17 14:14:02 +03:00
Vladimir Mihailenco 00de347403 Optimize reading big values 2018-08-16 14:01:03 +03:00
Vladimir Mihailenco 5146fb0c57 Cleanup buffers manipulation 2018-08-15 11:53:15 +03:00
Vladimir Mihailenco 7c26d1ceb6 Pass cn.Rd where possible 2018-08-15 09:38:58 +03:00
Vladimir Mihailenco cfe305296f Bench bigget values 2018-08-15 09:10:53 +03:00
Vladimir Mihailenco 8ebf0b7750 Remove unused code 2018-08-13 09:52:36 +03:00
Vladimir Mihailenco 651e9fef1d Add MaxConnAge 2018-08-12 10:25:16 +03:00
Vladimir Mihailenco 25bf3e79e5 Add MinIdleConns 2018-08-12 08:34:06 +03:00
Vladimir Mihailenco fee18a3d42 Use sub-benchmarks 2018-08-10 14:08:07 +03:00
Vladimir Mihailenco e753829945 internal/proto: avoid moving data when buffer is big enough 2018-08-07 14:49:35 +03:00
Vladimir Mihailenco 96d1b85009 Cleanups 2018-08-06 13:59:15 +03:00
Vladimir Mihailenco 464daeb271 Rename BufioReader to ElasticBufReader 2018-08-06 13:37:20 +03:00
Vladimir Mihailenco c651b50db5 internal/proto: cleanup bufio reader 2018-08-05 15:07:10 +03:00
Vladimir Mihailenco b576fe91a1 Use single read and write buffer where possible 2018-08-04 13:09:22 +03:00
Vladimir Mihailenco 2559f32464 cluster: optimize newClusterState 2018-07-22 14:17:42 +03:00
Vladimir Mihailenco 7c9aa65a40 Cleanup 2018-07-22 09:27:36 +03:00
Vladimir Mihailenco 7f5b63da85 Close read-only connections 2018-06-18 13:09:20 +03:00
Vladimir Mihailenco faf5666fbd Cleanup pool 2018-05-29 17:29:47 +03:00
Vladimir Mihailenco 3aa80da654 internal/proto: cleanup code 2018-03-08 14:00:21 +02:00
Vladimir Mihailenco 56dea1f39a Fix proto.RedisError in slices 2018-02-22 14:24:27 +02:00
Vladimir Mihailenco fa7f64f7f2 Rework retrying 2018-02-16 13:40:23 +02:00
Veselkov Konstantin fbec95a796 fix rename 2018-01-25 11:15:44 +04:00
Veselkov Konstantin ea4d6c3490 golint warnings are removed 2018-01-24 22:38:47 +04:00
Vladimir Mihailenco abb85b0fb8 Remove StringToBytes 2018-01-15 16:15:20 +02:00
Vladimir Mihailenco 041b11eb4f
Merge pull request #693 from FJSDS/change_bytes_string
fix unsafe.go
2018-01-15 16:12:18 +02:00
FJSDS a8340c6b74 fix unsafe.go 2018-01-11 16:42:52 +08:00
Vladimir Mihailenco 3de5605ab2 Pick random node when command does not have keys 2017-12-28 16:47:08 +02:00
Vladimir Mihailenco 48b70050d4 Fix slice next elem func 2017-11-01 15:33:53 +02:00
Dimitrij Denissenko dac1820e47 Fix pool panics 2017-10-11 16:03:55 +01:00
Vladimir Mihailenco 7cb146a31b Increase read timeout for blocking commands and don't retry such commands 2017-09-29 16:12:43 +03:00
Vladimir Mihailenco bc5f9a6878 Replace PoolStats.Requests with PoolStats.Misses 2017-09-22 12:28:08 +03:00
Vladimir Mihailenco 5294b5dae1 Add PoolStats.StaleConns and enable logging by default 2017-09-11 09:10:17 +03:00
Vladimir Mihailenco dbd2c99ba9 Rework pipeline retrying 2017-09-01 14:56:00 +03:00
Vladimir Mihailenco 63e3bc58c7 Retry cluster down errors 2017-08-15 10:12:43 +03:00
Vladimir Mihailenco 89515eebd1 Merge pull request #612 from okmeter/master
Stop ConnPool.tryDial for closed pool
2017-08-04 14:44:34 +03:00
Nikolay Sivko 7ae26b74bc stop ConnPool.tryDial goroutine if pool was closed 2017-08-04 01:11:35 +03:00
Vladimir Mihailenco 3ddda73a05 Close connections to unused nodes 2017-07-11 11:19:40 +03:00
Vladimir Mihailenco 9dbcc5ae80 Vendor syncutil.Once 2017-07-01 12:51:46 +03:00
Vladimir Mihailenco 0d94a7bc88 Fix race in PubSub 2017-06-29 17:09:52 +03:00
Vladimir Mihailenco fbc8000fd1 Resent client pool when sentinel switches master 2017-06-29 16:53:49 +03:00
Vladimir Mihailenco 9cf5f251be Gracefully handle situation when Redis Server is down 2017-06-29 14:45:31 +03:00
Vladimir Mihailenco 0a965c5d70 pool: add fast path 2017-06-29 12:54:49 +03:00
Vladimir Mihailenco f29951c899 Speedup ScanSlice 2017-06-02 16:19:43 +03:00
Jonathan Chan 406e882c43 Added backoff retry 2017-05-26 14:33:34 +03:00
Vladimir Mihailenco 6499563e07 PubSub conns don't share connection pool limit 2017-04-17 16:59:56 +03:00
Poloskin Valentin Georgievich 80673992e6 gofmt 2017-04-02 17:10:47 +03:00
Vladimir Mihailenco ef95182d29 Code cleanup 2017-03-31 15:11:11 +03:00
Vladimir Mihailenco bb270e3277 Merge branch 'v5' 2017-03-04 11:02:50 +02:00
yuekui 216ec11a0e Fix wrong usage of timer Reset(), which could cause service frozen during master switch. 2017-03-04 10:53:10 +02:00
Vladimir Mihailenco 50f5210780 internal/pool: remove unused var 2017-02-23 15:19:43 +02:00
Vladimir Mihailenco 8040d63c4f Remove gopkg.in 2017-02-19 09:49:21 +02:00
Vladimir Mihailenco 6b6f5ca133 Separate read and write buffers for PubSub. 2017-02-19 09:42:45 +02:00
Vladimir Mihailenco 335956cc9a Cleanup code a bit. 2017-02-18 12:10:47 +02:00
Back Yu 681a1fe646 Add ScanSlice. 2017-02-18 11:49:01 +02:00
Vladimir Mihailenco ce4fd8b677 Fix ReceiveMessage to work without any subscriptions. 2017-02-08 14:15:32 +02:00
Vladimir Mihailenco 308ebee457 Fix defer order. 2017-01-28 10:53:10 +02:00
Vladimir Mihailenco 69554c0ec5 Reduce number of allocations. 2017-01-13 13:39:59 +02:00
Vladimir Mihailenco c17f58f7a0 Remove dial limiter. 2016-12-16 15:43:37 +02:00
Vladimir Mihailenco 865d501d07 Add TxPipeline. 2016-12-16 11:25:58 +02:00
Vladimir Mihailenco b4efc45f1c Set read/write timeouts more consistently. 2016-12-03 17:30:13 +02:00
Vladimir Mihailenco d4a3b1f282 Add instrumentation example. 2016-11-26 10:33:06 +02:00
Vladimir Mihailenco a20665f042 Use string val in StringCmd. 2016-11-20 09:50:49 +02:00
Vladimir Mihailenco 62cd3b38ef Limit allocation. 2016-11-09 10:13:03 +02:00
Vladimir Mihailenco 3996289fe2 internal/proto: use read prefix to indicate that method reads from the stream. 2016-10-14 14:46:35 +03:00
Vladimir Mihailenco a65b760eec Lowercase command name. 2016-10-14 10:37:30 +03:00
Vladimir Mihailenco 2c5b239ecb Remove internal errors package that clashes with std lib. 2016-10-09 11:44:31 +00:00
Vladimir Mihailenco f5245efa73 Prepare v5 release. 2016-10-09 10:56:53 +00:00
Vladimir Mihailenco fcf53a2a78 Better cluster loading handling. 2016-10-09 08:18:57 +00:00
lijunfei 1b06f9351a define loading error 2016-10-09 11:44:58 +08:00
lijunfei 3cc9b99fb8 if readonly, read from master when slave is loading 2016-10-09 11:30:01 +08:00
Vladimir Mihailenco 7cbee9d337 Enable reaper on ClusterClient and add tests. 2016-10-02 12:44:01 +00:00
Vladimir Mihailenco e57ac63b6e Simplify resubscribing in PubSub. 2016-09-29 12:33:47 +00:00
Vladimir Mihailenco 04cdc41cc4 Try to fix Go 1.4. 2016-09-14 11:00:34 +00:00
Vladimir Mihailenco 455abb1906 internal/pool: more idiomatic work with channels. 2016-09-12 06:15:59 +00:00
Vladimir Mihailenco 4b0862b5fd internal/pool: improve tests. 2016-09-10 14:09:39 +00:00
Vladimir Mihailenco aab4e040c6 internal/pool: fix reaper to properly close connections. 2016-09-10 13:54:49 +00:00
Dimitrij Denissenko 7d856c5595 Make proto/parser an internal package 2016-07-02 13:52:10 +01:00
Vladimir Mihailenco e9233d8d17 Cleanup loggers. 2016-06-05 08:05:50 +00:00
Vladimir Mihailenco 31abb18d9a Move logger to internal package. 2016-04-09 14:52:01 +03:00
Vladimir Mihailenco 38d30a4bab Use redis.v4 that is in alpha/beta state. 2016-04-09 13:27:16 +03:00
Vladimir Mihailenco d79074eadb Remove PMessage. 2016-04-09 11:51:13 +03:00
Vladimir Mihailenco 04b6c9d3ad Improve comment. 2016-04-06 13:13:03 +03:00
Vladimir Mihailenco 6e1aef39ea Faster and simpler pool. 2016-03-19 11:49:13 +02:00
Vladimir Mihailenco 93a7fe0de3 Move some tests to pool package. 2016-03-17 13:48:04 +02:00
Vladimir Mihailenco f47fb47df0 Extract race tests to separate file. Add more race tests. 2016-03-16 19:45:35 +02:00
Vladimir Mihailenco 707472c09b Fix connection initialization. 2016-03-15 14:21:53 +02:00