HCOLL-192 I've reviewed the code around this, it looks like this size constraint was a hang up from when we only allowed replicated entries to be no larger than max unsigned short, the underlying code was changed recently when we introduced the stateless client to allow much larger payloads. As such I've have increased this constrain to Integer.MAX_VALUE

This commit is contained in:
Rob Austin
2014-11-07 11:14:33 +00:00
parent 4c86dae04f
commit 28d20d03b6
2 changed files with 4 additions and 6 deletions
@@ -87,7 +87,6 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, KI>,
// for file, jdbc and UDP replication
public static final int RESERVED_MOD_ITER = 8;
public static final int ADDITIONAL_ENTRY_BYTES = 10;
static final int MAX_UNSIGNED_SHORT = Character.MAX_VALUE;
private static final long serialVersionUID = 0L;
private static final Logger LOG = LoggerFactory.getLogger(ReplicatedChronicleMap.class);
private static final long LAST_UPDATED_HEADER_SIZE = 128L * 8L;
@@ -632,12 +631,13 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, KI>,
keySizeMarshaller.sizeEncodingSize(keySize) + keySize + ADDITIONAL_ENTRY_BYTES +
valueSizeMarshaller.sizeEncodingSize(valueSize)) + valueSize;
// replication enforces that the entry size will never be larger than an unsigned short
if (result > MAX_UNSIGNED_SHORT)
if (result > Integer.MAX_VALUE)
throw new IllegalStateException("ENTRY WRITE_BUFFER_SIZE TOO LARGE : Replicated " +
"ChronicleMap's" +
" are restricted to an " +
"entry size of " + MAX_UNSIGNED_SHORT + ", " +
"entry size of " + Integer.MAX_VALUE + ", " +
"your entry size=" + result);
return result;
}
@@ -1052,7 +1052,6 @@ final class TcpReplicator extends AbstractChannelReplicator implements Closeable
final int inPosition = in.position();
long outPosition = out.position();
long outLimit = out.limit();
@@ -1792,7 +1791,6 @@ class StatelessServerConnector<K, V> {
/**
* write the keysize and the key to the the {@code target} buffer
*
* @param local
* @param key the key of the map
*/
@@ -1855,7 +1853,7 @@ class StatelessServerConnector<K, V> {
private long header(Bytes writer, final long transactionId) {
final long sizeLocation = writer.position();
writer.skip(TRANSACTION_ID_OFFSET); // SIZE_OF_SIZE + is
writer.skip(TRANSACTION_ID_OFFSET);
// exception
writer.writeLong(transactionId);