diff options
author | bugwz <cubegwz@gmail.com> | 2021-04-21 02:51:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 21:51:24 +0300 |
commit | 761d7d27711edfbf737def41ff28f5b325fb16c8 (patch) | |
tree | 528a4ba08451a6fb330c70463e48ae11b7ac9a94 /src | |
parent | 080d4579db40d965f8392af5b1da7a99d1a817d5 (diff) | |
download | redis-761d7d27711edfbf737def41ff28f5b325fb16c8.tar.gz |
Print the number of abnormal line in AOF (#8823)
When redis-check-aof finds an error, it prints the line number for faster troubleshooting.
Diffstat (limited to 'src')
-rw-r--r-- | src/redis-check-aof.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/redis-check-aof.c b/src/redis-check-aof.c index eedb09db5..1507e0a06 100644 --- a/src/redis-check-aof.c +++ b/src/redis-check-aof.c @@ -39,12 +39,14 @@ static char error[1044]; static off_t epos; +static long long line = 1; int consumeNewline(char *buf) { if (strncmp(buf,"\r\n",2) != 0) { ERROR("Expected \\r\\n, got: %02x%02x",buf[0],buf[1]); return 0; } + line += 1; return 1; } @@ -201,8 +203,8 @@ int redis_check_aof_main(int argc, char **argv) { off_t pos = process(fp); off_t diff = size-pos; - printf("AOF analyzed: size=%lld, ok_up_to=%lld, diff=%lld\n", - (long long) size, (long long) pos, (long long) diff); + printf("AOF analyzed: size=%lld, ok_up_to=%lld, ok_up_to_line=%lld, diff=%lld\n", + (long long) size, (long long) pos, line, (long long) diff); if (diff > 0) { if (fix) { char buf[2]; |