Commit Graph

258 Commits

Author SHA1 Message Date
Vladimir Mihailenco 9b6ee9c3cc chore: gofmt all code 2021-09-08 16:52:29 +03:00
Vladimir Mihailenco ed42d3c37b
Add scan struct example (#1870) 2021-08-30 00:37:17 +08:00
monkey92t afafeda8a3
after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added

Signed-off-by: monkey92t <golang@88.com>

* remove runGoroutine

Signed-off-by: monkey92t <golang@88.com>

* pool.popIdle add p.closed check

Signed-off-by: monkey92t <golang@88.com>

* upgrade golangci-lint v1.42.0

Signed-off-by: monkey92t <golang@88.com>
2021-08-19 16:56:23 +08:00
monkey92t fd3025bfed
Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd.
2021-08-06 17:16:22 +08:00
monkey92t 38d1749d56
adjust the code (#1842)
* Upgrade redis-server version (#1833)

* Upgrade redis-server version

Signed-off-by: monkey <golang@88.com>

* XAutoClaim changed the return value

Signed-off-by: monkey <golang@88.com>

* add cmd: geosearch, geosearchstore (#1836)

* add cmd: geosearch, geosearchstore

Signed-off-by: monkey92t <golang@88.com>

* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing

Signed-off-by: monkey92t <golang@88.com>

* adjust the code, and fix #1553, #1676

Signed-off-by: monkey92t <golang@88.com>
2021-08-02 19:01:01 +08:00
monkey 83454856c7 Merge branch 'master' into v9
Signed-off-by: monkey <golang@88.com>
2021-07-24 22:10:04 +08:00
do it 346bfafddd
ConnPool check fd for bad conns (#1824)
* conncheck for badconn (#1821)

* format imports

* fix ut: pool with badconn

* fix unstable ut: should facilitate failover

* Revert "fix unstable ut: should facilitate failover"

This reverts commit c7eeca2a5c.

* fix test error

Signed-off-by: monkey92t <golang@88.com>

Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: monkey92t <golang@88.com>
2021-07-20 17:23:48 +08:00
ktaekwon000 ce40cd942a
Allow FIFO pool in redis client (#1820)
* Initial commit for FIFO pool

* Change PoolType string to PoolFIFO bool

* Remove redundant type

* add PoolFIFO option to all clients

Signed-off-by: monkey92t <golang@88.com>

Co-authored-by: Kim Tae Kwon <taekwon.kim@shopee.com>
Co-authored-by: monkey92t <golang@88.com>
2021-07-16 11:58:01 +08:00
monkey92t 916da5b2ce
sync v8.11.0 2021-07-02 20:56:25 +08:00
Vladimir Mihailenco 27e2efb0af
Remove OpenTelemetry metrics for now (#1805) 2021-06-30 18:40:23 +08:00
monkey92t 63df0e5e75
sync master (#1800)
* Remove OpenTelemetry from the code (but leave redisotel as is) (#1782)

* Add XAutoClaim command (#1780)

* fix typo (#1788)

* xgroup/xadd/xtrim supports new options (#1787)

* support cmd option

XGROUP CREATECONSUMER
XTRIM MINID LIMIT
XADD NOMKSTREAM MINID LIMIT

Signed-off-by: monkey <golang@88.com>

* add XAddArgs.Approx doc

Signed-off-by: monkey92t <golang@88.com>

* Add Bun to readme

* Upgrade the <sorted set> series of commands (#1792)

* Upgrade the <sorted set> series of commands

Signed-off-by: monkey92t <golang@88.com>

* Cancel the Deprecated mark of ZAddNX and ZAddXX

Signed-off-by: monkey92t <golang@88.com>

* Explain the use restrictions of KeepTTL. (#1799)

Signed-off-by: monkey92t <golang@88.com>

* Adjust KeepTTL annotation.

Signed-off-by: monkey92t <golang@88.com>

* the hello command throws possible errors, It may affect the "read timeout" test result.

Signed-off-by: monkey92t <golang@88.com>

Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: ericmillin <31105612+ericmillin@users.noreply.github.com>
Co-authored-by: heyanfu <1145291570@qq.com>
2021-06-28 17:40:38 +08:00
heyanfu 14d82a2d93
fix typo (#1788) 2021-06-09 00:58:16 +08:00
Vladimir Mihailenco 6e4eb2e3ac
Remove OpenTelemetry from the code (but leave redisotel as is) (#1782) 2021-06-03 19:01:51 +08:00
monkey 350477a91d Merge branch 'lint-1.40' into v9 2021-05-13 17:54:44 +08:00
monkey 26373ef2f1 follow to golang-lint 1.40
Signed-off-by: monkey <golang@88.com>
2021-05-13 10:33:38 +08:00
monkey92t 8ad01240a4
Add support for resp3 protocol (#1739)
* support resp3 protocol

Signed-off-by: monkey <golang@88.com>

* Upgrade mod version limit go1.14

https://github.com/go-redis/redis/issues/1715#issuecomment-820685614

Signed-off-by: monkey <golang@88.com>

* Remove the redundant check of ReadReply

Signed-off-by: monkey <golang@88.com>

* fix the problem

Signed-off-by: monkey <golang@88.com>

* workflows add v9

Signed-off-by: monkey <golang@88.com>

* update StringStringMapCmd to MapStringStringCmd

Signed-off-by: monkey <golang@88.com>
2021-04-27 10:04:46 +03:00
monkey a2410beb43 upgrade golangci-lint to v1.39.0
Signed-off-by: monkey <golang@88.com>
2021-04-08 14:44:31 +08:00
Vladimir Mihailenco 02a9c81ef1 Fix golangci-lint check 2021-03-23 11:02:29 +02:00
Vladimir Mihailenco 1b77706c0c Optimize Otel instrumentation 2021-03-20 10:01:48 +02:00
alijozi 1f32092a3b Update OpenTelemetry to 0.17.0 and fix "undefined: otel.Meter" 2021-02-16 11:38:55 +01:00
renzheng.wang 8b19c31049
Make FailoverClient(sentinel mode) more robust (#1655)
* add failover option AllowDisconnectedSlaves

* checkout unrelated changes

* Make NewFailoverClient (sentinel mode) robust.

* fix lint issue

* Fix bug

* Fix lint issue

* add comment

* checkout unrelated changes

* Refine code

* checkout unrelated changes
2021-02-10 17:20:08 +02:00
monkey92t 27df2313cd
hscan adds support for i386 platform (#1652)
* hscan adds support for i386 platform

Signed-off-by: monkey <monkey92t@gmail.com>

* update go.sum

Signed-off-by: monkey <monkey92t@gmail.com>

* detect overflow of scan

Signed-off-by: monkey <golang@88.com>

* restore the return value type of decoderFunc to error

Signed-off-by: monkey <golang@88.com>

* fix clean

Signed-off-by: monkey <golang@88.com>

* fix clean

Signed-off-by: monkey <golang@88.com>

Co-authored-by: Monkey <monkey@MonkeydeiMac.local>
2021-02-09 14:44:24 +02:00
Vladimir Mihailenco b358584bd3 Fix build 2021-02-04 09:34:10 +02:00
Vladimir Mihailenco bd234b91fe Add StructValue so we don't need temp slices to pass keys and values 2021-02-03 12:45:02 +02:00
Kailash Nadh f9dfc7a949 Refactor scan signature to work with Slice and StringMap cmds 2021-02-02 16:28:10 +05:30
Kailash Nadh a4144ea98e Add SliceCmd.Scan() (hscan pkg) and tests 2021-02-02 13:04:52 +05:30
Vladimir Mihailenco 380ab17274 Fix cleanup 2021-01-29 12:12:47 +02:00
Vladimir Mihailenco 8926f2992a Cleanup 2021-01-29 12:04:39 +02:00
Kailash Nadh 6f96bebac7 Add redis.Scan() to scan results from redis maps into structs.
The package uses reflection to decode default types (int, string
etc.) from Redis map results (key-value pair sequences) into
struct fields where the fields are matched to Redis keys by tags.

Similar to how `encoding/json` allows custom decoders using
`UnmarshalJSON()`, the package supports decoding of arbitrary
types into struct fields by defining a `Decode(string) error`
function on types.

The field/type spec of every struct that's passed to Scan() is
cached in the package so that subsequent scans avoid iteration
and reflection of the struct's fields.
2021-01-28 18:04:38 +05:30
Vladimir Mihailenco 76fd0eac61 Fix Tx pipeline hook 2021-01-09 09:57:46 +02:00
Vladimir Mihailenco 55a8f1a601
Merge pull request #1567 from go-redis/feature/otel-0.14
Update to otel v0.14
2020-11-21 10:12:54 +02:00
Vladimir Mihailenco 3921cd497c Update to otel v0.14 2020-11-21 09:56:52 +02:00
Mitsuo Heijo f5a1707d3c Update golangci-lint to v1.32 2020-11-17 23:08:15 +09:00
Vladimir Mihailenco 13782c03d0 Tweak otel span and attr names 2020-11-15 14:30:27 +02:00
Vladimir Mihailenco f92951b835 Guard against overflow in retry 2020-10-28 11:12:46 +02:00
Vladimir Mihailenco a6876ad84a Move Scan test 2020-10-13 09:33:12 +03:00
Roman Suvorov f169894120
Fix/issue 1384 (#1529)
Add support for scanning time.TIme
2020-10-13 09:13:43 +03:00
Vladimir Mihailenco e1b0a0bd7e Cleanup readLine 2020-10-10 12:26:21 +03:00
Eelco Cramer 39571ccc56
Improves performance 2020-10-09 15:06:47 +02:00
Eelco Cramer 97bbed8a92
Fixes issue where a buffer larger than 4096
bytes cannot be read
2020-10-09 11:35:14 +02:00
Vladimir Mihailenco 566840fe27 otel: add RemoteAddr 2020-09-28 17:35:49 +03:00
Vladimir Mihailenco 3e42145a26 Remove arg hex encoding 2020-09-24 10:09:09 +03:00
Vladimir Mihailenco 86326c4924 Refactor NewXInfoGroupsCmd 2020-09-23 11:50:31 +03:00
Dimitrij Denissenko 3fc96195a4 Reduce dependency chain 2020-09-17 14:32:08 +01:00
Vladimir Mihailenco ef220d0944 Tweak append arg 2020-09-05 13:17:26 +03:00
Vladimir Mihailenco c357d18624 Faster renew the subscription 2020-09-05 10:56:09 +03:00
Vladimir Mihailenco 6db422f051 Port pool fixes 2020-08-15 15:45:15 +03:00
Vladimir Mihailenco 3fbf7df014 Fix test 2020-07-28 16:26:03 +03:00
Vladimir Mihailenco 0f5d67c102 Fix zero backoff 2020-07-28 16:14:54 +03:00
Vladimir Mihailenco 6e3d4a53c6 Tweak backoff 2020-07-28 15:42:38 +03:00
刘青 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