[patch] Perl Cache::Memcached, stats() and tests

Brad Fitzpatrick brad at danga.com
Tue Jul 3 18:18:23 UTC 2007


Checked in, thanks!


On Tue, 3 Jul 2007, Ronald J Kimball wrote:

> I don't think updating the tests was completely unrelated in this case,
> because I was adding tests for my fix to stats().
>
> Anyway, I've separated this into two separate patches.  The first patch
> fixes stats() in Memcached.pm.  The second patch updates the test files.
> use.t is renamed to 01_use.t.  all.t is renamed to 02_keys.t, and now
> includes tests for delete().  03_stats.t is a new test file, containing
> the stats() tests that were in all.t and also some new tests for
> stats().  (Apply cache_memcached_stats.patch first, then
> cache_memcached_tests.patch.)
>
> Does that work?
>
>
> Ronald
>
>
> Brad Fitzpatrick wrote:
> > Ronald,
> >
> > Thanks!
> >
> > But one logical change per patch, please.  Things like "I also took this
> > opportunity to change unrelated thing $X" tend to get your patch ignored
> > (not just on this list, but most projects) because it's too hard to deal
> > with/read/etc.
> >
> > See:
> >     http://danga.com/commit.bml
> >
> > If you agree to those general rules and send me the htdigest line
> > described at bottom, you can commit these patches one at a time by
> > yourself.  Or, feel free to resend and one of us on the list can do it.
> >
> > - Brad
> >
> >
> > On Tue, 19 Jun 2007, Ronald J Kimball wrote:
> >
> >> After upgrading to Cache::Memcached 1.22, I still get warnings from
> >> calling stats() after a server has been restarted:
> >>
> >> Use of uninitialized value in addition (+) at
> >> /usr/share/perl5/Cache/Memcached.pm line 876.
> >> Use of uninitialized value in addition (+) at
> >> /usr/share/perl5/Cache/Memcached.pm line 885.
> >>
> >> This is because, although stats() skips the host if the socket is dead,
> >> it still tallies that host's stats for the total stats.
> >>
> >> Additionally, stats() tallies each host's misc stats for the total
> >> stats, even when misc stats were not requested (e.g.
> >> $memd->stats('malloc')).  This caused warnings and put spurious 0 values
> >> in the stats totals.
> >>
> >>
> >> The attached patch fixes these issues, by moving the calculation of
> >> total stats into the processing loop.
> >>
> >>
> >> I also took this opportunity to update the tests for Cache::Memcached:
> >> I renamed use.t to 01_use.t.
> >> I renamed all.t to 02_keys.t and added tests for delete().
> >> I created 03_stats.t to test the results of stats().
> >> The numbers ensure that the test files are run in the appropriate order.
> >>
> >>
> >> Ronald
> >>
> >>
>
>


More information about the memcached mailing list