brandur/redis-cell

CL.THROTTLE command does not trigger snapshot creation for RDB persistence.

armenak-baburyan opened this issue · 3 comments

How to reproduce:

  1. Start Redis server
redis-server --loadmodule libredis_cell.dylib --save 10 1
48665:C 21 Feb 2021 12:13:51.776 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
48665:C 21 Feb 2021 12:13:51.776 # Redis version=6.0.10, bits=64, commit=00000000, modified=0, pid=48665, just started
48665:C 21 Feb 2021 12:13:51.776 # Configuration loaded
48665:M 21 Feb 2021 12:13:51.777 * Increased maximum number of open files to 10032 (it was originally set to 256).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.0.10 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 48665
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

48665:M 21 Feb 2021 12:13:51.778 # Server initialized
48665:M 21 Feb 2021 12:13:51.779 * Module 'redis-cell' loaded from libredis_cell.dylib
48665:M 21 Feb 2021 12:13:51.780 * Loading RDB produced by version 6.0.10
48665:M 21 Feb 2021 12:13:51.780 * RDB age 46 seconds
48665:M 21 Feb 2021 12:13:51.780 * RDB memory usage when created 0.96 Mb
48665:M 21 Feb 2021 12:13:51.780 * DB loaded from disk: 0.000 seconds
48665:M 21 Feb 2021 12:13:51.780 * Ready to accept connections
  1. Execute command
127.0.0.1:6379> keys *
(empty array)
127.0.0.1:6379> CL.THROTTLE user123 15 1 600 1
1) (integer) 0
2) (integer) 16
3) (integer) 15
4) (integer) -1
5) (integer) 600
127.0.0.1:6379> keys *
1) "user123"

The RDB snapshot is expected to be created but it is not.

  1. Now let's try to execute simple SET command:
127.0.0.1:6379> set key value
OK
127.0.0.1:6379> keys *
1) "key"
2) "user123"
  1. DB saved as expected.
48665:M 21 Feb 2021 12:15:26.450 * 1 changes in 10 seconds. Saving...
48665:M 21 Feb 2021 12:15:26.450 * Background saving started by pid 48667
48667:C 21 Feb 2021 12:15:26.452 * DB saved on disk

The same occurs also in Redis for Docker version 5/6. I'm not sure is that Redis or this module issue.

Hi there,

I re-read the documentation, but couldn't find any mention of how Redis Module key operations work with respect to change tracking for RDB snapshots, so I'm not sure either whether this is a bug in my module or in Redis. I've posted to the Redis mailing list asking for clarification.

I confirmed with Redis that this seems to be a bug in Redis itself.

See mailing list message:

https://groups.google.com/g/redis-db/c/upB9zXOIvog

And bug filed on Redis:

redis/redis#8608

Follow up: the Redis people say this isn't a bug. I'll follow up with that, but for now I've fixed the problem with an additional invocation to RedisModule_ReplicateVerbatim and confirmed the fix. Released as 0.3.0. Closing out.