Skip Menu |

This queue is for tickets about the Cache-Memcached-Fast CPAN distribution.

Report information
The Basics
Id: 46883
Status: resolved
Priority: 0/
Queue: Cache-Memcached-Fast

People
Owner: Nobody in particular
Requestors: jmmills@cpan.org (no email address)
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: t/commands.t fails under memcached gt 1.3.2
Stumbled upon this one testing some code that uses your module on a host running memcached 1.3.3. Seems that memcached has changed the behavior of incr() on non-numeric values (see http://github.com/memcached/memcached/commit/674166c002fe2e32f0385d12351091d738150a12). I'll see if I can spin a patch for you tomorrow. Here is the failure output: t/commands.t ...... 1/66 # Failed test 'Incr' # at t/commands.t line 32. Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line 33. # Failed test 'Fetch' # at t/commands.t line 33. # Failed test 'Incr' # at t/commands.t line 34. Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line 38. # Failed test 'Fetch' # at t/commands.t line 38. # Failed test 'Decr' # at t/commands.t line 39. Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line 40. # Failed test 'Fetch' # at t/commands.t line 40. # Failed test 'Decr' # at t/commands.t line 41. Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line 42. # Failed test 'Fetch' # at t/commands.t line 42. Use of uninitialized value in numeric eq (==) at t/commands.t line 43. # Failed test 'Decr below zero returns true value' # at t/commands.t line 44. Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line 45. # Failed test at t/commands.t line 136. # Failed test at t/commands.t line 137. # got: '0' # expected: '1' # Failed test at t/commands.t line 138. # got: undef # expected: '2' # Looks like you failed 12 tests of 66. t/commands.t ...... Dubious, test returned 12 (wstat 3072, 0xc00)
Ok this is a simple patch which "works around" the problem by replacing the non-numeric keys with a 0 numeric value before doing incr(). On Fri Jun 12 08:41:10 2009, JMMILLS wrote: Show quoted text
> Stumbled upon this one testing some code that uses your module on a > host > running memcached 1.3.3. > Seems that memcached has changed the behavior of incr() on non-numeric > values (see >
http://github.com/memcached/memcached/commit/674166c002fe2e32f0385d12351091d738150a12). Show quoted text
> I'll see if I can spin a patch for you tomorrow. > Here is the failure output: > > t/commands.t ...... 1/66 > # Failed test 'Incr' > # at t/commands.t line 32. > Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line > 33. > > # Failed test 'Fetch' > # at t/commands.t line 33. > > # Failed test 'Incr' > # at t/commands.t line 34. > Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line > 38. > > # Failed test 'Fetch' > # at t/commands.t line 38. > > # Failed test 'Decr' > # at t/commands.t line 39. > Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line > 40. > > # Failed test 'Fetch' > # at t/commands.t line 40. > > # Failed test 'Decr' > # at t/commands.t line 41. > Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line > 42. > > # Failed test 'Fetch' > # at t/commands.t line 42. > Use of uninitialized value in numeric eq (==) at t/commands.t line 43. > > # Failed test 'Decr below zero returns true value' > # at t/commands.t line 44. > Argument "v3" isn't numeric in numeric eq (==) at t/commands.t line > 45. > > # Failed test at t/commands.t line 136. > > # Failed test at t/commands.t line 137. > # got: '0' > # expected: '1' > > # Failed test at t/commands.t line 138. > # got: undef > # expected: '2' > # Looks like you failed 12 tests of 66. > t/commands.t ...... Dubious, test returned 12 (wstat 3072, 0xc00)
--- t/commands.t.orig 2009-06-12 06:07:14.000000000 -0700 +++ t/commands.t 2009-06-12 06:05:09.000000000 -0700 @@ -9,7 +9,7 @@ use Memd; if ($Memd::memd) { - plan tests => 66; + plan tests => 68; } else { plan skip_all => 'Not connected'; } @@ -28,7 +28,7 @@ is($Memd::memd->get($key), 'v2', 'Fetch'); ok($Memd::memd->replace($key, 'v3'), 'Replace'); is($Memd::memd->get($key), 'v3', 'Fetch'); - +ok($Memd::memd->replace($key, 0), 'replace with numeric'); ok($Memd::memd->incr($key), 'Incr'); ok($Memd::memd->get($key) == 1, 'Fetch'); ok($Memd::memd->incr($key, 5), 'Incr'); @@ -132,6 +132,7 @@ is(scalar keys %$res, 0); } +ok($Memd::memd->replace_multi(map { [$_,0] } @keys),'replace_multi to reset to numeric'); $res = $Memd::memd->incr_multi([$keys[0], 2], [$keys[1]], @keys[2..$#keys]); ok(values %$res == @keys); is((grep { $_ != 1 } values %$res), 1);
Thanks for the patch! I just released 0.15 with your fix to allow clean install from CPAN with memcached 1.3.3.