diff options
| author | Shreyas Siravara <sshreyas@fb.com> | 2017-09-03 10:31:47 -0700 | 
|---|---|---|
| committer | Shreyas Siravara <sshreyas@fb.com> | 2017-09-03 18:30:38 +0000 | 
| commit | 60c6b1729b93c05614bdbb9e2e4594a94138fe6b (patch) | |
| tree | 744619b1a325539415fe89e70a23ea07f8557edf | |
| parent | 87f6e9f034fb6560161f419b5b3e22631f802ace (diff) | |
debug/io-stats: Restrict io-thread queue depth stats to NFS
Summary:
- Fixes the unecessary log spew in other daemons
- This is a port of D3646627 to 3.8
Reviewers: rwareing, kvigor
Reviewed By: kvigor
Change-Id: Id54ab41cdfdd2006d3af2d8774c38025c566c523
Reviewed-on: https://review.gluster.org/18199
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
| -rw-r--r-- | tests/basic/stats-dump.t | 2 | ||||
| -rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 41 | 
2 files changed, 22 insertions, 21 deletions
diff --git a/tests/basic/stats-dump.t b/tests/basic/stats-dump.t index ceed7571a62..af1ad34702b 100644 --- a/tests/basic/stats-dump.t +++ b/tests/basic/stats-dump.t @@ -39,7 +39,7 @@ FUSE_RET="$?"  # Test that io-stats is getting queue sizes from io-threads  TEST grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfs_nfsd_$V0.dump -TEST grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfsd__d_backends_patchy?.dump +TEST ! grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfsd__d_backends_patchy?.dump  TEST [ 0 -ne "$BRICK_RET" ]  TEST [ 0 -ne "$NFSD_RET" ] diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 101803f470d..2835b0a3f6e 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1152,28 +1152,29 @@ io_stats_dump_global_to_json_logfp (xlator_t *this,                  "\"%s.%s.fop.unweighted_latency_ave_usec\":\"%0.4lf\",",                  key_prefix, str_prefix, fop_ave_usec); -        dict_t *xattr = NULL; -        ret = syncop_getxattr (this, &unused_loc, &xattr, -                               IO_THREADS_QUEUE_SIZE_KEY, NULL, NULL); -        if (xattr) { -                // Iterate over the dictionary returned to us by io-threads and -                // dump the results to the stats file. -                data_pair_t *curr = NULL; -                dict_for_each (xattr, curr) { -                        ios_log (this, logfp, -                                  "\"%s.%s.%s.queue_size\": \"%d\",", -                                  key_prefix, str_prefix, curr->key, -                                  data_to_int32 (curr->value)); -                } +        if (conf->iamnfsd) { +                dict_t *xattr = NULL; +                ret = syncop_getxattr (this, &unused_loc, &xattr, +                                       IO_THREADS_QUEUE_SIZE_KEY, NULL, NULL); +                if (xattr) { +                        // Iterate over the dictionary returned to us by io-threads and +                        // dump the results to the stats file. +                        data_pair_t *curr = NULL; +                        dict_for_each (xattr, curr) { +                                ios_log (this, logfp, +                                          "\"%s.%s.%s.queue_size\": \"%d\",", +                                          key_prefix, str_prefix, curr->key, +                                          data_to_int32 (curr->value)); +                        } -                // Free the dictionary -                dict_unref (xattr); -        } else { -                gf_log (this->name, GF_LOG_WARNING, -                        "Unable to get queue size counts from " -                        "the io-threads translator!"); +                        // Free the dictionary +                        dict_unref (xattr); +                } else { +                        gf_log (this->name, GF_LOG_WARNING, +                                "Unable to get queue size counts from " +                                "the io-threads translator!"); +                }          } -          if (interval == -1) {                  ios_log (this, logfp, "\"%s.%s.uptime\": \"%"PRId64"\",",                           key_prefix, str_prefix,  | 
