[infinispan-dev] vint for key/value size

Mircea Markus mircea.markus at jboss.com
Fri Mar 12 06:59:34 EST 2010


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.

Similar for the longs we use.

Wdyt?

Cheers,
Mircea






More information about the infinispan-dev mailing list