Closed bpo closed 3 years ago
Just for further context, prior to this patch if you have this module enabled on a Redis database that is using AOF, AOF rewrites will fail with:
Fatal: AOF method for module data type 't-digest0' tried to call RedisModule_EmitAOF() with wrong format specifiers '%s %ll'
Thanks for the patch @bpo! Is it possible to add a test case for this?
@usmanm The existing AOF code is unexercised by tests, so it's nontrivial. But yes- assertions against the resulting AOF file would probably be the best approach. Simply grepping for the error string in the logs would not be robust against changes in Redis.
Ah, I meant would you be able to add a test for this? All good if not, I can look into it later.
I should be able to add tests sometime soon, was just looking for feedback on the approach.
@usmanm I added a test for successful AOF rewrites, and another one for RDB just to be complete. The tests now bounce the redis-server and check to see if a tdigest key still exists.
This module was expecting to use EmitAOF's fmt string like sprintf, but redis modules have their own string format (see
moduleCreateArgvFromUserFormat
in the Redis source).Notably there is no built-in support for writing doubles, so this change dumps double values to a buffer before the EmitAOF calls.