Skip to content

Commit 0a6c273

Browse files
committed
Limit MinIO folder depth to 2
Avoids creating tons of intermediate folders thus reduces inode pressure while still on disk splitting objects in 4.000 slots
1 parent 755aa56 commit 0a6c273

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ public BlobId parse(String id) {
7474
}
7575

7676
private static String injectFoldersInBlobId(String blobIdPart) {
77-
int folderDepthToCreate = 4;
77+
int folderDepthToCreate = 2;
7878
if (blobIdPart.length() > folderDepthToCreate) {
7979
return blobIdPart.charAt(0) + "/" +
8080
blobIdPart.charAt(1) + "/" +
81-
blobIdPart.charAt(2) + "/" +
82-
blobIdPart.charAt(3) + "/" +
83-
blobIdPart.substring(4);
81+
blobIdPart.substring(2);
8482
}
8583
return blobIdPart;
8684
}

server/blob/blob-storage-strategy/src/test/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobIdTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void ofShouldGenerateABlobIdOfTheRightGeneration() {
6262
SoftAssertions.assertSoftly(soft -> {
6363
soft.assertThat(actual.getFamily()).isEqualTo(GenerationAwareBlobId.Configuration.DEFAULT.getFamily());
6464
soft.assertThat(actual.getGeneration()).isEqualTo(628L);
65-
soft.assertThat(actual.getDelegate()).isEqualTo(delegate.of("4/c/c/b/692e-3efb-40e9-8876-4ecfd51ffd4d"));
65+
soft.assertThat(actual.getDelegate()).isEqualTo(delegate.of("4/c/cb692e-3efb-40e9-8876-4ecfd51ffd4d"));
6666
});
6767
}
6868
}

0 commit comments

Comments
 (0)