Comment 0 for bug 1067242

Revision history for this message
yunhua.lee (yunhua-lee) wrote : increment operation cause connection error!

memcached support => enabled Version => 2.1.0
libmemcached version => 1.0.10

I set a negative or non-numeric value to a key, and then increment it.
The increment operation failed, error code and msg as following:
=========================================================
  ["errorMsg"]=>
  string(12) "CLIENT ERROR"
  ["errorNo"]=>
  int(9)
=========================================================

and more ***seriously***, the following set or get operation also failed, error code and msg as following:
=========================set operation====================
  ["errorMsg"]=>
  string(51) "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY"
  ["errorNo"]=>
  int(47)
=========================get operation====================
  ["errorMsg"]=>
  string(9) "NOT FOUND"
  ["errorNo"]=>
  int(16)

phpunit test code as following( some code is simple encapsulated, not original api ):
========================================================
       //test negative number
        $value = -1;
        $result = $mc->set($keyPrefix, $key, $value);
        $this->assertTrue(Result::check($result));
        $result = $mc->get($keyPrefix, $key);
        $this->assertEquals($value, Result::getData($result));
        $result = $mc->increment($keyPrefix, $key, 1);
        //var_dump($result);
        //$this->assertTrue(Result::check($result));
        //$this->assertEquals($value + 1, Result::getData($result));

        //test non-numeric
        $value = 'str';
        $result = $mc->set($keyPrefix, $key, $value);
        var_dump($result);
        //$this->assertTrue(Result::check($result));
        $result = $mc->get($keyPrefix, $key);
        var_dump($result);
        $result = $mc->set($keyPrefix, $key, $value);
        var_dump($result);
        $result = $mc->get($keyPrefix, $key);
        var_dump($result);

I don't test decrement operation, but I guess it will have the same problem......