Skip to content

Commit

Permalink
Mogstats replication split and cleanup patch.
Browse files Browse the repository at this point in the history
Attached mogstats patch does a few things:

1) Splits replication queue stats from file replication stats.  We want to use this for monitoring, and replication queue stats are fast to query and file replication stats are slow, so I want to query
them separately.  New stats option is called "replication-queue"
2) Renames the "delete" stats option to "delete-queue" to be more in line with the above and more descriptive.
3) For completeness-sake, I renamed the vague-ish "queue" state option to "general-queues" which I think is more informative.

From Barry Abrahamson <[email protected]>

git-svn-id: http://code.sixapart.com/svn/mogilefs/trunk@1408 f67b2e87-0811-0410-a7e0-dd94e48410d6
  • Loading branch information
dormando committed Mar 24, 2010
1 parent 31cddaf commit e5d384b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions mogstats
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Getopt::Long;
# FIXME: decide how to share constants between utils and server.
use constant ENDOFTIME => 2147483647;
my %QUEUES = ( 1 => 'FSCK_QUEUE' );
my %valid_stats = map { $_ => 1 } qw/devices fids files replication delete queue all/;
my %valid_stats = map { $_ => 1 } qw/devices fids files replication replication-queue delete-queue general-queues all/;

my $DBH_CACHE = '';
my $DB_TYPE = '';
Expand Down Expand Up @@ -122,7 +122,9 @@ sub cmd_stats {
}
}
printf " -------------------- ----------- ---------- ----------\n";
# Now new stats.
}
# Now new stats.
if ($args{'replication-queue'} || $args{all}) {
print "\nStatistics for replication queue...\n";
printf " %-20s %12s\n", 'status', 'count';
printf " -------------------- ------------\n";
Expand All @@ -134,7 +136,7 @@ sub cmd_stats {

}

if ($args{'delete'} || $args{all}) {
if ($args{'delete-queue'} || $args{all}) {
print "\nStatistics for delete queue...\n";
printf " %-20s %12s\n", 'status', 'count';
printf " -------------------- ------------\n";
Expand All @@ -146,7 +148,7 @@ sub cmd_stats {

}

if ($args{queue} || $args{all}) {
if ($args{'general-queues'} || $args{all}) {
print "\nStatistics for general queues...\n";
printf " %-15s %-20s %12s\n", 'queue', 'status', 'count';
printf " --------------- -------------------- ------------\n";
Expand Down Expand Up @@ -217,10 +219,15 @@ sub stats_from_db {
# if they want replication counts, or didn't specify what they wanted
if ($args->{replication} || $args->{all}) {
$ret->{replication} = stats_for_replication(\%globals);
}

# Stats about the replication queue (deferred, overdue)
if ($args->{'replication-queue'} || $args->{all}) {
$ret->{to_replicate} = stats_for_to_replicate(\%globals);
}

if ($args->{'delete'} || $args->{all}) {
# Stats about the delete queue (deferred, overdue)
if ($args->{'delete-queue'} || $args->{all}) {
$ret->{to_delete} = stats_for_to_delete(\%globals);
}

Expand All @@ -242,7 +249,7 @@ sub stats_from_db {
verbose("... done");
}

if ($args->{queue} || $args->{all}) {
if ($args->{'general-queues'} || $args->{all}) {
$ret->{queue} = stats_for_to_queue(\%globals);
}

Expand Down

0 comments on commit e5d384b

Please sign in to comment.