int recordSize = mersenneTwisterFast.nextInt(3 * OClusterPage.MAX_RECORD_SIZE) + 1;
byte[] bigRecord = new byte[recordSize];
mersenneTwisterFast.nextBytes(bigRecord);
final OPhysicalPosition physicalPosition = paginatedCluster.createRecord(bigRecord, recordVersion, (byte) 2);
positionRecordMap.put(physicalPosition.clusterPosition, bigRecord);
}
int deletedRecords = 0;
Assert.assertEquals(records, paginatedCluster.getEntries());
Iterator<OClusterPosition> positionIterator = positionRecordMap.keySet().iterator();
while (positionIterator.hasNext()) {
OClusterPosition clusterPosition = positionIterator.next();
if (mersenneTwisterFast.nextBoolean()) {
Assert.assertTrue(paginatedCluster.deleteRecord(clusterPosition));
deletedRecords++;
Assert.assertEquals(paginatedCluster.getEntries(), records - deletedRecords);
positionIterator.remove();
}
}
Assert.assertEquals(paginatedCluster.getEntries(), records - deletedRecords);
for (int i = 0; i < records / 2; i++) {
int recordSize = mersenneTwisterFast.nextInt(3 * OClusterPage.MAX_RECORD_SIZE) + 1;
byte[] bigRecord = new byte[recordSize];
mersenneTwisterFast.nextBytes(bigRecord);
final OPhysicalPosition physicalPosition = paginatedCluster.createRecord(bigRecord, recordVersion, (byte) 2);
positionRecordMap.put(physicalPosition.clusterPosition, bigRecord);
}
Assert.assertEquals(paginatedCluster.getEntries(), (long) (1.5 * records - deletedRecords));