Permalink
Browse files

don't over-specify the format of stats id field

Other stylistic changes.
  • Loading branch information...
1 parent f0dbd26 commit 76adfd9e4cab98a1db75ebeac677ca5f14913851 @kr committed Mar 18, 2013
Showing with 25 additions and 22 deletions.
  1. +8 −8 doc/protocol.md
  2. +9 −9 doc/protocol.txt
  3. +8 −5 prot.c
View
@@ -484,7 +484,7 @@ The stats data for the system is a YAML file representing a single dictionary of
* `cmd-list-tubes` is the cumulative number of list-tubes commands.
* `cmd-list-tube-used` is the cumulative number of list-tube-used commands.
* `cmd-list-tubes-watched` is the cumulative number of list-tubes-watched commands.
-* `cmd-pause-tube` is the cumulative number of pause-tube commands
+* `cmd-pause-tube` is the cumulative number of pause-tube commands.
* `job-timeouts` is the cumulative count of times a job has timed out.
* `total-jobs` is the cumulative count of jobs created.
* `max-job-size` is the maximum number of bytes in a job.
@@ -499,13 +499,13 @@ The stats data for the system is a YAML file representing a single dictionary of
* `rusage-utime` is the cumulative user CPU time of this process in seconds and microseconds.
* `rusage-stime` is the cumulative system CPU time of this process in seconds and microseconds.
* `uptime` is the number of seconds since this server process 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
-* `binlog-records-written` is the cumulative number of records written to the binlog
-* `binlog-records-migrated` is the cumulative number of records written as part of compaction
-* `id` a unique id for this server process. The id is generated on each startup and is always a random series of 8 bytes base16 encoded
-* `hostname` the hostname of the machine as determined by uname
+* `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.
+* `binlog-records-written` is the cumulative number of records written to the binlog.
+* `binlog-records-migrated` is the cumulative number of records written as part of compaction.
+* `id` is a random id string for this server process, generated when each beanstalkd process starts.
+* `hostname` is the hostname of the machine as determined by uname.
#### `list-tubes` command
View
@@ -587,7 +587,7 @@ beanstalkd process starts; they are not stored on disk with the -b flag.
- "cmd-list-tubes-watched" is the cumulative number of list-tubes-watched
commands.
- - "cmd-pause-tube" is the cumulative number of pause-tube commands
+ - "cmd-pause-tube" is the cumulative number of pause-tube commands.
- "job-timeouts" is the cumulative count of times a job has timed out.
@@ -623,24 +623,24 @@ beanstalkd process starts; they are not stored on disk with the -b flag.
- "uptime" is the number of seconds since this server process started running.
- "binlog-oldest-index" is the index of the oldest binlog file needed to
- store the current jobs
+ 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
+ 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
+ to get before a new binlog file is opened.
- "binlog-records-written" is the cumulative number of records written
- to the binlog
+ to the binlog.
- "binlog-records-migrated" is the cumulative number of records written
- as part of compaction
+ as part of compaction.
- - "id" a unique id for this server process. The id is generated on each startup and
- is always a random series of 8 bytes base16 encoded
+ - "id" is a random id string for this server process, generated when each
+ beanstalkd process starts.
- - "hostname" the hostname of the machine as determined by uname
+ - "hostname" the hostname of the machine as determined by uname.
The list-tubes command returns a list of all existing tubes. Its form is:
View
13 prot.c
@@ -1982,23 +1982,26 @@ prot_init()
int dev_random = open("/dev/urandom", O_RDONLY);
if (dev_random < 0) {
- twarn("Error could not open '/dev/urandom' to generate server id.");
- exit(50);
+ twarn("open /dev/urandom");
+ exit(50);
}
int i, r;
byte rand_data[NumIdBytes];
r = read(dev_random, &rand_data, NumIdBytes);
if (r != NumIdBytes) {
- twarn("Error could not read '/dev/urandom' to generate server id.");
- exit(50);
+ twarn("read /dev/urandom");
+ exit(50);
}
for (i = 0; i < NumIdBytes; i++) {
sprintf(id + (i * 2), "%02x", rand_data[i]);
}
close(dev_random);
- uname(&node_info);
+ if (uname(&node_info) == -1) {
+ warn("uname");
+ exit(50);
+ }
ms_init(&tubes, NULL, NULL);

0 comments on commit 76adfd9

Please sign in to comment.