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; }