This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new e9184dde1a Limit MinIO folder depth to 2 (#2715)
e9184dde1a is described below
commit e9184dde1a4cabee684274878e206a064e0a5276
Author: Trần Hồng Quân <[email protected]>
AuthorDate: Mon May 12 13:07:18 2025 +0700
Limit MinIO folder depth to 2 (#2715)
Avoids creating tons of intermediate folders thus reduces inode pressure
while still on disk splitting objects in 4.000 slots
Co-authored-by: Benoit TELLIER <[email protected]>
---
.../aws/S3WithMinIOGenerationAwareBlobIdTest.java | 2 +-
.../deduplication/MinIOGenerationAwareBlobId.java | 6 ++----
.../MinIOGenerationAwareBlobIdTest.java | 23 +++++++++++++++++++---
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git
a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3WithMinIOGenerationAwareBlobIdTest.java
b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3WithMinIOGenerationAwareBlobIdTest.java
index 6c61eec5f0..a13a9e772c 100644
---
a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3WithMinIOGenerationAwareBlobIdTest.java
+++
b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3WithMinIOGenerationAwareBlobIdTest.java
@@ -126,7 +126,7 @@ public class S3WithMinIOGenerationAwareBlobIdTest
implements BlobStoreContract {
String blobIdString = blobId.asString();
// Then: BlobId string and parsed BlobId should match expectations
-
assertThat(blobIdString).isEqualTo("1/628/M/f/e/m/XjFVhqwZi9eYtmKc5JA9CJlHbVdBqfMuLlIbamY=");
+
assertThat(blobIdString).isEqualTo("1/628/M/f/emXjFVhqwZi9eYtmKc5JA9CJlHbVdBqfMuLlIbamY=");
assertThat(blobId).isEqualTo(blobIdFactory().parse(blobIdString));
}
diff --git
a/server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java
b/server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java
index ac0fd4b8cb..c612e17e53 100644
---
a/server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java
+++
b/server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java
@@ -74,13 +74,11 @@ public class MinIOGenerationAwareBlobId implements BlobId,
GenerationAware {
}
private static String injectFoldersInBlobId(String blobIdPart) {
- int folderDepthToCreate = 4;
+ int folderDepthToCreate = 2;
if (blobIdPart.length() > folderDepthToCreate) {
return blobIdPart.charAt(0) + "/" +
blobIdPart.charAt(1) + "/" +
- blobIdPart.charAt(2) + "/" +
- blobIdPart.charAt(3) + "/" +
- blobIdPart.substring(4);
+ blobIdPart.substring(2);
}
return blobIdPart;
}
diff --git
a/server/blob/blob-storage-strategy/src/test/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobIdTest.java
b/server/blob/blob-storage-strategy/src/test/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobIdTest.java
index 8dd11b9182..370c6d29b4 100644
---
a/server/blob/blob-storage-strategy/src/test/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobIdTest.java
+++
b/server/blob/blob-storage-strategy/src/test/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobIdTest.java
@@ -62,7 +62,7 @@ class MinIOGenerationAwareBlobIdTest {
SoftAssertions.assertSoftly(soft -> {
soft.assertThat(actual.getFamily()).isEqualTo(GenerationAwareBlobId.Configuration.DEFAULT.getFamily());
soft.assertThat(actual.getGeneration()).isEqualTo(628L);
-
soft.assertThat(actual.getDelegate()).isEqualTo(delegate.of("4/c/c/b/692e-3efb-40e9-8876-4ecfd51ffd4d"));
+
soft.assertThat(actual.getDelegate()).isEqualTo(delegate.of("4/c/cb692e-3efb-40e9-8876-4ecfd51ffd4d"));
});
}
}
@@ -94,6 +94,22 @@ class MinIOGenerationAwareBlobIdTest {
});
}
+ @Test
+ void
previousFourFolderDepthBlobIdsShouldBeParsedAsMinIOGenerationAwareBlobId() {
+ String fourDepthBlobIdString =
delegate.of("1/628/3/6/8/2/5033-d835-4490-9f5a-eef120b1e85c").asString();
+
+ BlobId actual = testee.parse(fourDepthBlobIdString);
+ assertThat(actual)
+ .isInstanceOfSatisfying(MinIOGenerationAwareBlobId.class,
actualBlobId -> {
+ SoftAssertions.assertSoftly(soft -> {
+ soft.assertThat(actualBlobId.getFamily()).isEqualTo(1);
+
soft.assertThat(actualBlobId.getGeneration()).isEqualTo(628L);
+
soft.assertThat(actualBlobId.getDelegate().asString()).isEqualTo("3/6/8/2/5033-d835-4490-9f5a-eef120b1e85c");
+
soft.assertThat(actualBlobId.asString()).isEqualTo("1/628/3/6/8/2/5033-d835-4490-9f5a-eef120b1e85c");
+ });
+ });
+ }
+
@Test
void noFamilyShouldBeParsable() {
String originalBlobId = "abcdef";
@@ -206,7 +222,7 @@ class MinIOGenerationAwareBlobIdTest {
void asStringShouldIntegrateFamilyAndGeneration() {
BlobId blobId = testee.of("36825033-d835-4490-9f5a-eef120b1e85c");
-
assertThat(blobId.asString()).isEqualTo("1/628/3/6/8/2/5033-d835-4490-9f5a-eef120b1e85c");
+
assertThat(blobId.asString()).isEqualTo("1/628/3/6/825033-d835-4490-9f5a-eef120b1e85c");
}
@Test
@@ -220,7 +236,8 @@ class MinIOGenerationAwareBlobIdTest {
@ValueSource(strings = {
"1/2/a/b/c/d/efgh",
"abc",
- "1/2/abc"
+ "1/2/abc",
+ "1/628/3/6/8/2/5033-d835-4490-9f5a-eef120b1e85c"
})
void asStringShouldRevertFromString(String blobIdString) {
BlobId blobId = testee.parse(blobIdString);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]