]> git.saurik.com Git - redis.git/commitdiff
Added an unique ID field to every slow log entry.
authorantirez <antirez@gmail.com>
Thu, 30 Jun 2011 15:36:15 +0000 (17:36 +0200)
committerantirez <antirez@gmail.com>
Thu, 30 Jun 2011 15:36:15 +0000 (17:36 +0200)
src/redis.h
src/slowlog.c
src/slowlog.h

index 523cb311751655502e6accb7c2706818ec374d7c..2346b4eb08c834bcc77e00d119e039cbec8c944f 100644 (file)
@@ -528,6 +528,7 @@ struct redisServer {
     size_t stat_peak_memory;        /* max used memory record */
     long long stat_fork_time;       /* time needed to perform latets fork() */
     list *slowlog;
+    long long slowlog_entry_id;
     long long slowlog_log_slower_than;
     unsigned long slowlog_max_len;
     /* Configuration */
index 17edf6159f68d5a7886d1d36330106dece4acfb6..cfd66dc634d45dbc12bc9e1980fac40164374f25 100644 (file)
@@ -26,6 +26,7 @@ slowlogEntry *slowlogCreateEntry(robj **argv, int argc, long long duration) {
     }
     se->time = time(NULL);
     se->duration = duration;
+    se->id = server.slowlog_entry_id++;
     return se;
 }
 
@@ -47,6 +48,7 @@ void slowlogFreeEntry(void *septr) {
  * at server startup. */
 void slowlogInit(void) {
     server.slowlog = listCreate();
+    server.slowlog_entry_id = 0;
     listSetFreeMethod(server.slowlog,slowlogFreeEntry);
 }
 
@@ -96,7 +98,8 @@ void slowlogCommand(redisClient *c) {
             int j;
 
             se = ln->value;
-            addReplyMultiBulkLen(c,3);
+            addReplyMultiBulkLen(c,4);
+            addReplyLongLong(c,se->id);
             addReplyLongLong(c,se->time);
             addReplyLongLong(c,se->duration);
             addReplyMultiBulkLen(c,se->argc);
index 45a500555df828324c47d3c782f3f17b24cc7452..bad770db49f663a8774b9599bcef67006d60bd4c 100644 (file)
@@ -2,6 +2,7 @@
 typedef struct slowlogEntry {
     robj **argv;
     int argc;
+    long long id;       /* Unique entry identifier. */
     long long duration; /* Time spent by the query, in nanoseconds. */
     time_t time;        /* Unix time at which the query was executed. */
 } slowlogEntry;