I have added this test.
@Test
public void testFileSizes() throws IOException {
final String basePath = getTestPath();
try (final Chronicle chronicle = ChronicleQueueBuilder.indexed(basePath)
.dataBlockSize(256 << 10)
.indexBlockSize(64 << 10)
.build()) {
ExcerptAppender appender = chronicle.createAppender();
int objects = 100;
for (int i = 0; i < objects; i++) {
appender.startExcerpt();
appender.writeObject(BigDecimal.valueOf(i % 1000));
appender.finish();
}
appender.close();
Assert.assertEquals(256.0, new File(basePath + ".data").length() / 1024.0, 0.0);
Assert.assertEquals(64.0, new File(basePath + ".index").length() / 1024.0, 0.0);
} finally {
assertClean(basePath);
}
}
Note this will not shrink an existing file. The only way to do that is to copy the contents to a smaller queue and replace the original.
Peter.