1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

73 Commits

Author SHA1 Message Date
Shaya Potter
271baf3a65 HSCAN NOVALUES support (v5) (#2758)
* HSCAN VALUES support (v5)

* add hscanNoValuesIterator

* nitpick

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-06-03 10:16:07 -04:00
Shaya Potter
8f3a276509 Sentinel Support (#2664)
* redis client socket changes needed for sentinel

* Sentinel Implementation [EXPERIMENTAL]

* add pooling

* improve typing with SENTINEL_ client members

* cleanup - remove unused comments / commented code

* small sendCommand change + revert change to tsconfig

* add more sentinel commands needed for testing.

* lots of fixups and a reasonable first pass test suite

* add a timer option to update topology in background

+ don't need both sentinel client and pubsubclient
+ nits

* format all the things

* more progress

* small cleanup

* try to group promises together to minimize the internal await points

* redo events, to keep a single topology event to listen on

* nits + readme

* add RedisSentinelFactory to provide lower level access to sentinel

* nit

* update

* add RedisSentinelClient/Type for leased clients
	returned by aquire()
	used by function passed to use()

* add self for private access + improve emitting

* nit

* nits

* improve testing

- improve steady state waiting between tests
- get masternode from client, not from sentinels themselves (not consistent and then client isn't changing as we expect
- provide extensive logging/tracing on test errors
	- provide a very low impact tracing mechanism withinthe code that only really impacts code when tracing is in use.

* ismall nit for typing

* bunch of changes

- harden testing
	- don't use sentinel[0] for debug error dump as could be downed by a test
	- increase time for sentinel down test to 30s (caused a long taking failover)
- add client-error even / don't pass throuh client errors as errors option for pubsub proxy
- when passing through cient errors as error events, dont pass the event, but the Error object, as only Error objects are supposed to be on 'error'
	-

* improve pub sub proxy.

save the refference to all channel/pattern listeners up front on creation, dont hve to fetch the object each time, as it doesn't change.

removes race condition between setting up the listener and the pub sub node going down and being recreated.

* wrap the passed through RedisClient error to make clear where its coming from.

* refactor sentinel object / factory tests apart

* harden tests a little bit more

* add pipeline test

* add scripts/function tests + fixups / cleanups to get them to work

* change to use redis-stack-server for redis nodes to enable module testing

* fix test, forgot to return in use function with module

* rename test

* improve tests to test with redis/sentinel nodes with and withput passwords

this tests that we are handling the nodeClientOptions and sentinelClientOptions correctly

* cleanup for RedisSentinel type generic typing in tests

* remove debugLog, just rely on traace mechanism

* added multi tests for script/function/modules

* don't emit errors on lease object, only on main object

* improve testing

* extract out common code to reduce duplication

* nit

* nits

* nit

* remove SENTINEL_... commands from main client, load them via module interface

* missed adding RedisSentinelModule to correct places in RedisSentinelFactory

* nits

* fix test logging on error

1) it takes a lot of time now, so needs larger timeout
2) docker logs can be large, so need to increase maxBuffer size so doesn't error (and break test clean up)

* invalidate watches when client reconnects

+ provide API for other wrapper clients to also create invalid watch states programatically.

Reasoning: if a user does a WATCH and then the client reconnects, the watch is no longer active, but if a user does a MULTI/EXEC after that, they wont know, and since the WATCH is no longer active, the request has no protection.

The API is needed for when a wrapper client (say sentinel, cluster) might close the underlying client and reopen a new one transparently to the user.  Just like in the reconnection case, this should result in an error, but its up to the wrapping client to provide the appropriate error

* remove WATCH and UNWATCH command files, fix WATCH and UNWATCH return type, some more cleanups

* missing file in last commit :P

* support for custom message in `WatchError`

* setDirtyWatch

* update watch docs

* fixes needed

* wip

* get functions/modules to work again

self -> _self change

* reuse leased client on pipelined commands.

though I realize this implementation, really only works after the first write command.

unsure this is worth it.

* test tweaks

* nit

* change how "sentinel" object client works, allow it to be reserved

no more semaphore type counting

* review

* fixes to get more tests to pass

* handle dirtyWatch and watchEpoch in reset and resetIfDirty

* "fix", but not correct, needs more work

* fix pubsub proxy

* remove timeout from steadyState function in test, caused problems

* improve restarting nodes

* fix pubsub proxy and test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-02-05 09:48:33 -05:00
Leibale
817818aa91 WIP 2023-10-23 15:05:16 -04:00
Leibale
225efc0b43 cluster 2023-10-02 12:03:04 -04:00
Leibale
099f16e45f "forward port" changes from 4.6.9 2023-09-19 19:23:24 -04:00
Leibale
266d635a60 add node: to node "core modules" imports 2023-09-18 15:03:07 -04:00
Leibale
17cf320651 CLUSERT [INFO|NODES|REPLICAS] 2023-09-12 16:02:12 -04:00
Leibale
7eaf3cdf3d wip 2023-07-06 12:20:46 -04:00
Leibale
5bd6141b22 wip 2023-07-06 12:10:03 -04:00
Leibale
ab153a8eda wip 2023-07-06 10:38:30 -04:00
Leibale
c109fbf751 wip 2023-06-29 14:39:49 -04:00
Leibale
ea2d9d2a77 stream commands + some more 2023-06-28 11:40:55 -04:00
Leibale
e95634b375 ref #2489 2023-06-22 19:41:35 -04:00
Leibale
2b318d4100 WIP 2023-06-22 18:18:23 -04:00
Leibale
b46f08228c wip 2023-06-21 19:09:45 -04:00
Leibale
4894c26458 wip 2023-06-20 20:04:05 -04:00
Leibale
f22879dffa wip 2023-06-19 18:54:32 -04:00
Leibale
f150e86f95 wip 2023-06-19 18:04:31 -04:00
Leibale
37be30a8fe some more commands 2023-05-14 14:42:48 +03:00
Leibale
442a554fce WIP 2023-05-10 16:07:29 +03:00
Leibale
13f1fa9e58 WIP 2023-05-10 14:55:03 +03:00
Leibale
b4196faa41 wip 2023-05-10 12:08:02 +03:00
Leibale
d59254e497 some commands 2023-05-09 14:04:26 +03:00
Leibale
a6c0d1dbb3 legacy mode and isolation pool 2023-05-09 12:47:19 +03:00
Leibale
c6f9f6ee18 Merge branch 'v5' of github.com:leibale/node-redis into v5 2023-05-08 11:06:03 +03:00
Leibale
6a0b4db4f7 fix GEO* commands 2023-05-08 11:04:22 +03:00
dovi
4de409e0ad fix SUNIONSTORE 2023-05-03 18:51:12 -04:00
dovi
627c9122ef fix SUNION 2023-05-03 18:40:36 -04:00
dovi
65c691fd75 fix SMOVE 2023-05-03 18:23:45 -04:00
dovi
d2e244a77d Merge branch 'v5' of https://github.com/leibale/node-redis into v5 2023-05-03 17:34:07 -04:00
Leibale
083ad023da Merge branch 'v5' of github.com:leibale/node-redis into v5 2023-05-03 17:30:19 -04:00
Leibale
331e390bef WIP 2023-05-03 17:29:36 -04:00
dovi
77baef5f8c fix HMGET 2023-05-03 17:12:40 -04:00
dovi
7d963a5d1b fix OBJECT_REFCOUNT spec 2023-05-03 14:21:37 -04:00
dovi
3ab6241656 fix OBJECT_IDLETIME spec 2023-05-03 14:18:15 -04:00
dovi
1a7d5ff8e4 fix OBJECT_FREQ spec 2023-05-03 14:15:42 -04:00
dovi
19cd6dc04a fix OBJECT_ENCODING spec 2023-05-03 14:12:31 -04:00
dovi
e85fa11e81 fix MOVE spec 2023-05-03 14:07:30 -04:00
dovi
d810ce644b fix KEYS spec 2023-05-02 20:22:11 -04:00
dovi
2ea068ac77 fix EXPIRETIME spec 2023-05-02 20:17:15 -04:00
dovi
fe1ae49a40 fix EXPIREAT spec 2023-05-02 20:13:27 -04:00
dovi
73994f243b fix EXPIRE spec 2023-05-02 20:06:31 -04:00
dovi
3dfea00318 fix COPY spec 2023-05-02 20:02:03 -04:00
dovi
ca90d51fb8 fix DEL spec 2023-05-02 19:52:28 -04:00
dovi
80ecd9e06a fix DUMP spec 2023-05-02 19:50:01 -04:00
dovi
6809365e98 fix EXISTS spec 2023-05-02 19:34:49 -04:00
dovi
98c1a1d235 fix ZREMRANGEBYSCORE 2023-05-02 18:35:33 -04:00
dovi
a280648e62 fix ZREMRANGEBYRANK 2023-05-02 18:19:54 -04:00
dovi
08040f9431 fix ZREMRANGEBYLEX 2023-05-02 18:11:08 -04:00
dovi
a5344946b6 fix ZRANGEBYLEX 2023-05-02 18:01:45 -04:00