mirror of
https://github.com/fluencelabs/redis
synced 2025-05-29 02:01:19 +00:00
Make SLOWLOG argument truncation play well with LZF encoding.
This commit is contained in:
parent
e2871e21fd
commit
1c894f5989
@ -63,15 +63,17 @@ slowlogEntry *slowlogCreateEntry(robj **argv, int argc, long long duration) {
|
|||||||
} else {
|
} else {
|
||||||
/* Trim too long strings as well... */
|
/* Trim too long strings as well... */
|
||||||
if (argv[j]->type == REDIS_STRING &&
|
if (argv[j]->type == REDIS_STRING &&
|
||||||
sdsEncodedObject(argv[j]) &&
|
(sdsEncodedObject(argv[j]) || lzfEncodedObject(argv[j])) &&
|
||||||
sdslen(argv[j]->ptr) > SLOWLOG_ENTRY_MAX_STRING)
|
stringObjectLen(argv[j]) > SLOWLOG_ENTRY_MAX_STRING)
|
||||||
{
|
{
|
||||||
sds s = sdsnewlen(argv[j]->ptr, SLOWLOG_ENTRY_MAX_STRING);
|
robj *o = getDecodedObject(argv[j]);
|
||||||
|
sds s = sdsnewlen(o->ptr, SLOWLOG_ENTRY_MAX_STRING);
|
||||||
|
|
||||||
s = sdscatprintf(s,"... (%lu more bytes)",
|
s = sdscatprintf(s,"... (%lu more bytes)",
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
sdslen(argv[j]->ptr) - SLOWLOG_ENTRY_MAX_STRING);
|
stringObjectLen(argv[j]) - SLOWLOG_ENTRY_MAX_STRING);
|
||||||
se->argv[j] = createObject(REDIS_STRING,s);
|
se->argv[j] = createObject(REDIS_STRING,s);
|
||||||
|
decrRefCount(o);
|
||||||
} else {
|
} else {
|
||||||
se->argv[j] = argv[j];
|
se->argv[j] = argv[j];
|
||||||
incrRefCount(argv[j]);
|
incrRefCount(argv[j]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user