[infinispan-dev] vint for key/value size

Manik Surtani manik at jboss.org
Tue Mar 23 09:08:18 EDT 2010


On 12 Mar 2010, at 11:59, Mircea Markus wrote:

> Hi Galder,
> 
> Currently the size of a key (value) is an 5 bytes vint.
> The max size of an int (4byte) in java is 2^31 -1. So the max size of an byte array is  (2^31 -1).
> An 5 bytes vint can be > 2^31, e.g. vint (10000000, 10000000, 10000000, 10000000, 01000000) == 2^34 > greater than Integer.MAX_VALUE. This means that if a client will sends a message with this size(2^34 or greater) we won't be able to put it on a single byte array. 
> Not sure that will happen, as 2^31 is already 2048MB which is a lot already :), but for correctness sake I guess we can specify that the key size is an 5 bytes vint, but not bigger than 2^31-1.

+1, well spotted.

--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org








More information about the infinispan-dev mailing list