Conversation
src/command.c
Outdated
| } | ||
| redis_data_free(&r->data); | ||
|
|
||
| if (!slowlog_enabled() || !slowlog_type_need_log(cmd)) { |
There was a problem hiding this comment.
better readability: slowlog_enabled() && slowlog_type_need_log(cmd)
a18b358 to
dbe15cc
Compare
|
It seems that refcount in slowlog entry is useless. |
|
When a thread is going to store a new slowlog_entry in its slowlog_queue, it may delete an old one if the queue is already full, but it has no idea whether there are some other threads using this old slowlog_entry. |
| return CORVUS_OK; | ||
| } | ||
|
|
||
| size_t pos_to_str_with_limit(struct pos_array *pos, uint8_t *str, size_t limit) |
There was a problem hiding this comment.
pos_to_str can be simplified with this function :
size_t len = pos_to_str_with_limit(pos, str, pos->str_len);
str[len] = '\0';
return CORVUS_OK;dbe15cc to
81a0ce2
Compare
|
LGTM |
| int hdr_len = snprintf((char*)buf, len, "$%zd\r\n", str_len); | ||
| pos_to_str_with_limit(&arg->pos, buf + hdr_len, str_len); | ||
| int postfix_len = snprintf(bytes_buf, sizeof bytes_buf, bytes_fmt, arg->pos.str_len); | ||
| memcpy(buf + max_len - 2 - postfix_len, bytes_buf, postfix_len); |
There was a problem hiding this comment.
max_len or len here? it took me minutes to figure out.
There was a problem hiding this comment.
They are the same, see line 85 size_t len = min(real_len, max_len);
There was a problem hiding this comment.
I figured out, it's just implicit on first sight.
Support slowlog command.