From 0388626e429051d69bebcd0245032ee2feb12053 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Fri, 10 Mar 2023 15:41:07 +0000 Subject: [PATCH] Use a lower file size target (10MB instead of 100MB) when using archive V2, as the average block size is over 90% smaller. --- .../org/qortal/repository/BlockArchiveWriter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/qortal/repository/BlockArchiveWriter.java b/src/main/java/org/qortal/repository/BlockArchiveWriter.java index 8f4d4498..e47aabbd 100644 --- a/src/main/java/org/qortal/repository/BlockArchiveWriter.java +++ b/src/main/java/org/qortal/repository/BlockArchiveWriter.java @@ -39,7 +39,8 @@ public class BlockArchiveWriter { private static final Logger LOGGER = LogManager.getLogger(BlockArchiveWriter.class); - public static final long DEFAULT_FILE_SIZE_TARGET = 100 * 1024 * 1024; // 100MiB + public static final long DEFAULT_FILE_SIZE_TARGET_V1 = 100 * 1024 * 1024; // 100MiB + public static final long DEFAULT_FILE_SIZE_TARGET_V2 = 10 * 1024 * 1024; // 10MiB private int startHeight; private final int endHeight; @@ -47,7 +48,7 @@ public class BlockArchiveWriter { private final Path archivePath; private final Repository repository; - private long fileSizeTarget = DEFAULT_FILE_SIZE_TARGET; + private long fileSizeTarget = DEFAULT_FILE_SIZE_TARGET_V1; private boolean shouldEnforceFileSizeTarget = true; // Default data source to BLOCK_REPOSITORY; can optionally be overridden @@ -75,6 +76,12 @@ public class BlockArchiveWriter { // When serialization version isn't specified, fetch it from the existing archive serializationVersion = this.findSerializationVersion(); } + + // Reduce default file size target if we're using V2, as the average block size is over 90% smaller + if (serializationVersion == 2) { + this.setFileSizeTarget(DEFAULT_FILE_SIZE_TARGET_V2); + } + this.serializationVersion = serializationVersion; }