Expected RDB snapshot behavior with respect to Redis Module

40 views
Skip to first unread message

Brandur Leach

unread,
Mar 5, 2021, 9:18:24 AM3/5/21
to Redis DB
Hi list,

I recently had an issue opened on a Redis Module I maintain [1], where the user describes how the use of normal write operations are tracked by the system and trigger an RDB snapshot:

    127.0.0.1:6379> set key value
    OK

And moments later:

    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 changes being tracked seem to come from the `dirty` flag on `redisServer`, which Redis increments on some operations:


By contrast, the use of the command provided by my module (which basically does: `RedisModule_OpenKey`, `RedisModule_CreateString`, `RedisModule_FreeString`, `RedisModule_StringSet`, `RedisModule_CloseKey`, `RedisModule_SetExpire`), does not seem to increment `dirty`, and therefore doesn't initiate an RDB save.

I re-read the Redis Modules API documentation, but I couldn't find any mention of this behavior one way or the other. My question: do Redis Module key changes not increment `dirty` by design, or is this a bug? If it's neither of those, am I missing a flag or something that I'm supposed to be calling?

Thanks,
Brandur


Itamar Haber

unread,
Mar 5, 2021, 9:31:44 AM3/5/21
to Redis DB
Hello Brandur,

(Off-topic: great hearing from you)

This isn't by design as far as I know. From a very cursory look, it appears that `RedisModule_StringSet` doesn't increment server.dirty as it should (nor does it seem to generate a keyspace notification) at it calls `genericSetKey` rather than `setGenericCommand`).

Please report the issue at https://github.com/redis/redis so it can be managed.

Cheers,
Itamar

Brandur

unread,
Mar 8, 2021, 3:19:48 AM3/8/21
to redi...@googlegroups.com
Just for posterity, bug filed here:


On Fri, Mar 5, 2021 at 10:30 AM Brandur <bra...@brandur.org> wrote:
Thanks for the quick response Itamar.


> This isn't by design as far as I know. From a very cursory look, it appears that `RedisModule_StringSet` doesn't increment server.dirty as it should (nor does it seem to generate a keyspace notification) at it calls `genericSetKey` rather than `setGenericCommand`).

Thanks for confirming. Will open that issue.


> (Off-topic: great hearing from you)

Thanks :) And same to you of course!

Brandur

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

--
You received this message because you are subscribed to a topic in the Google Groups "Redis DB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/redis-db/upB9zXOIvog/unsubscribe.
To unsubscribe from this group and all its topics, send an email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redis-db/d39391d8-dbd2-411f-8cfb-a50502c402fdn%40googlegroups.com.

Brandur

unread,
Mar 8, 2021, 3:19:48 AM3/8/21
to redi...@googlegroups.com
Thanks for the quick response Itamar.

> This isn't by design as far as I know. From a very cursory look, it appears that `RedisModule_StringSet` doesn't increment server.dirty as it should (nor does it seem to generate a keyspace notification) at it calls `genericSetKey` rather than `setGenericCommand`).

Thanks for confirming. Will open that issue.

> (Off-topic: great hearing from you)

Thanks :) And same to you of course!

Brandur
On Fri, Mar 5, 2021 at 6:32 AM Itamar Haber <ita...@redislabs.com> wrote:

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

Itamar Haber

unread,
Mar 8, 2021, 3:21:48 AM3/8/21
to Redis DB
For posterity:


> This isn't by design as far as I know.

I forgot it is by design :)

Cheers,
Itamar
Reply all
Reply to author
Forward
0 new messages