Permalink
Browse files

Add some binlog detail to the stats command

  • Loading branch information...
1 parent cfc2ddc commit 90d3ab8898570eea8559b6d620d52e1f192b2ebb @gbarr gbarr committed Nov 28, 2008
Showing with 34 additions and 1 deletion.
  1. +15 −0 binlog.c
  2. +3 −0 binlog.h
  3. +9 −0 doc/protocol.txt
  4. +7 −1 prot.c
View
@@ -362,3 +362,18 @@ binlog_init()
binlog_fd = binlog_open();
}
+const char *
+binlog_oldest_index()
+{
+ if (!first_binlog) return "0";
+
+ return strrchr(first_binlog->path, '.') + 1;
+}
+
+const char *
+binlog_current_index()
+{
+ if (!last_binlog) return "0";
+
+ return strrchr(last_binlog->path, '.') + 1;
+}
View
@@ -30,10 +30,13 @@ struct binlog {
};
extern char *binlog_dir;
+extern size_t binlog_size_limit;
void binlog_write_job(job j);
void binlog_read(job binlog_jobs);
void binlog_close();
+const char *binlog_oldest_index();
+const char *binlog_current_index();
#endif
View
@@ -580,6 +580,15 @@ of strings to scalars. It contains these keys:
- "uptime" is the number of seconds since this server started running.
+ - "binlog-oldest-index" is the index of the oldest binlog file needed to
+ store the current jobs
+
+ - "binlog-current-index" is the index of the current binlog file being
+ written to. If binlog is not active this value will be 0
+
+ - "binlog-max-size" is the maximum size in bytes a binlog file is allowed
+ to get before a new binlog file is opened
+
The list-tubes command returns a list of all existing tubes. Its form is:
list-tubes\r\n
View
8 prot.c
@@ -190,6 +190,9 @@ size_t job_data_size_limit = JOB_DATA_SIZE_LIMIT_DEFAULT;
"rusage-utime: %d.%06d\n" \
"rusage-stime: %d.%06d\n" \
"uptime: %u\n" \
+ "binlog-oldest-index: %s\n" \
+ "binlog-current-index: %s\n" \
+ "binlog-max-size: %u\n" \
"\r\n"
#define STATS_TUBE_FMT "---\n" \
@@ -805,7 +808,10 @@ fmt_stats(char *buf, size_t size, void *x)
VERSION,
(int) ru.ru_utime.tv_sec, (int) ru.ru_utime.tv_usec,
(int) ru.ru_stime.tv_sec, (int) ru.ru_stime.tv_usec,
- uptime());
+ uptime(),
+ binlog_oldest_index(),
+ binlog_current_index(),
+ binlog_size_limit);
}

0 comments on commit 90d3ab8

Please sign in to comment.