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

212 Commits

Author SHA1 Message Date
gianDiazM
4452117946 clientKillMaxAge typo, replace MANAGE by MAXAGE (#2782)
Co-authored-by: “gianDiazM” <“gian.diaz.marquez@gmail.com”>
2024-07-01 09:08:22 -04:00
Shaya Potter
85d5bf4125 add CLIENT KILL MAXAGE (v5) (#2760)
* add CLIENT KILL MANAGE maxAge (v5)

* replace "MANAGE" with "MAXAGE"

* fix test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-06-18 10:01:41 -04:00
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
a5a4cb45ea wip 2023-11-09 11:12:41 -05:00
Leibale
ebca66d6f6 WIP 2023-11-01 14:09:58 -04:00
Leibale
817818aa91 WIP 2023-10-23 15:05:16 -04:00
Leibale
52772858b4 fix FUNCTION STATS 2023-10-02 14:04:02 -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
819ca71538 Merge branch 'master' of github.com:redis/node-redis into v5 2023-09-19 18:57:28 -04:00
Charley DAVID
e00041e0eb Fix: XAUTOCLAIM after a TRIM with pending messages returns nil (#2565)
* fix(client): XCLAIM & XAUTOCLAIM after a TRIM might return nils

* fix(client): Fix race condition in specs

* revert test utils changes

* make tests faster

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-19 17:37:16 -04:00
avinashkrishna613
4ec97be4f0 fix #1956 - add support for LATENCY HISTORY (#2555)
* added support for LATENCY_HISTORY command

* clean code

* Update LATENCY_HISTORY.ts

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-19 16:21:54 -04:00
Asher
6848f3d207 Add support for PUBSUB SHARDNUMSUB (#2541)
* Add support for command 'PUBSUB SHARDNUMSUB'

* Use import from PUBSUB_SHARDNUMSUB

* Add test case for non-empty reply

* clean tests

* run tests in redis >= 7, fix integration test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-19 15:59:02 -04:00
Moshe L
01ca54e907 fix #1970 - add support for RESTORE (#2535)
* - Added RESTORE functionality

* add FIRST_KEY_INDEX, fix tests, clean example, add example to examples table

* use returnBuffers in test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-18 19:45:33 -04:00
Evis Cheng
8ecfd3ebda Add support for CLUSTER MYSHARDID (#2528)
* Add support for CLUSTER.MYSHARDID command

* Update CLUSTER_MYSHARDID.ts

* Update CLUSTER_MYSHARDID.spec.ts

* add test and clean code

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-18 19:31:03 -04:00
Leibale
1f97893785 fix ACL GETUSER test 2023-09-18 18:25:13 -04:00
Codrin-Mihai Chira
4e610c2f8a Add support for CLIENT NO-TOUCH (#2497) 2023-09-18 17:49:37 -04:00
Leibale
4be30ccd0f comment cluster request & response policies (keep v4 behaver) 2023-09-18 17:16:41 -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
c12dc79950 RedisJSON 2023-09-05 18:19:31 -04:00
Leibale
fd016ee1b2 some json and search commands 2023-08-01 14:29:34 -04:00
Leibale
ff07bbf3d3 WIP 2023-07-27 11:23:34 -04:00
Leibale
8369448d05 ref #2565 - fix X[AUTO]CLAIM 2023-07-20 16:04:51 -04:00
Leibale
51a1000603 fix XAUTOCLAIM test for <7.0 2023-07-19 15:11:29 -04:00
Leibale
c02de006db remove .only 2023-07-19 14:22:04 -04:00
Leibale
c9dae346a2 ref #2565 - handle null message in XAUTOCLAIM 2023-07-19 13:59:44 -04:00
Leibale
a3e813d3ac convert "resp types" to interfaces to allow circular references 2023-07-13 13:42:59 -04:00
Leibale
a4aa903987 fix SMEMBERS 2023-07-10 10:32:23 -04:00
Leibale
492c451b2d fix MEMORY STATS 2023-07-06 15:44:24 -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
1b363624d8 fix XPENDING_RANGE test 2023-07-06 12:00:15 -04:00
Leibale
0614f909a0 fix XINFO GROUPS test 2023-07-06 11:52:44 -04:00
Leibale
cffefd0337 fix SCAN 2023-07-06 11:12:37 -04:00
Leibale
6ca420f15e fix #2561 2023-07-06 11:07:52 -04:00
Leibale
9e1ec97a55 fix nan 2023-07-06 11:04:38 -04:00
Leibale
7bb8a32f20 wip 2023-07-06 10:42:08 -04:00
Leibale
ab153a8eda wip 2023-07-06 10:38:30 -04:00
Leibale
d298da82dd wip 2023-07-05 16:08:23 -04:00
Leibale
2dd1f2ca38 bloom module 2023-07-05 15:22:33 -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
4a9d934b84 wip 2023-06-22 18:26:22 -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