Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

decr doesn't shrink the value size #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To reproduce, start a telnet to memcached...

> set a 0 0 1
> 1
STORED
> incr a 10000
10001
> get a
VALUE a 0 5
10001
END
> decr a 10000
1
> get a
VALUE a 0 5
1    
END

The number of bytes after the big decr is 5, and perhaps it should be 1. 
For example...

> get a
VALUE a 0 1
1
END

Original issue reported on code.google.com by steve....@gmail.com on 1 Apr 2009 at 2:37

GoogleCodeExporter commented 9 years ago
Since this is a counter it will most likely grow (or shrink) in size a lot of 
times,
and as an internal optimization we don't want to reallocate the item storage 
each
time we need another decimal.

In the future I would love to see us storing an uint64_t there so we don't need 
all
the conversion to/from textual format (and just convert it to textual format if 
you
use the textual protocol...)

Original comment by trond.no...@gmail.com on 1 Apr 2009 at 8:04

GoogleCodeExporter commented 9 years ago
Ugh, I *did* have an int representation for the binary protocol version at one 
point.
 It just didn't have a way to know.  I suppose we could add some data there.

Original comment by dsalli...@gmail.com on 1 Apr 2009 at 4:50