This is an automated email from the ASF dual-hosted git repository.
thomasm pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 6cd2da6cd3 OAK-11544 Flaky test
PipelinedTreeStoreIT.createFFSCustomExcludePathsRegexNoRetryOnConnectionErrorRegexFiltering
(#2132)
6cd2da6cd3 is described below
commit 6cd2da6cd3432a76a0c9134a0e2eae008fa5ac3d
Author: Thomas Mueller <[email protected]>
AuthorDate: Tue Mar 4 12:09:35 2025 +0100
OAK-11544 Flaky test
PipelinedTreeStoreIT.createFFSCustomExcludePathsRegexNoRetryOnConnectionErrorRegexFiltering
(#2132)
---
.../document/flatfile/pipelined/PipelinedIT.java | 50 +++++++++++----------
.../flatfile/pipelined/PipelinedTreeStoreIT.java | 51 ++++++++++++----------
2 files changed, 54 insertions(+), 47 deletions(-)
diff --git
a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedIT.java
b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedIT.java
index 7e2b680907..0218343879 100644
---
a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedIT.java
+++
b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedIT.java
@@ -433,14 +433,15 @@ public class PipelinedIT {
try (MongoTestBackend rwStore = createNodeStore(false)) {
DocumentNodeStore rwNodeStore = rwStore.documentNodeStore;
contentBuilder.accept(rwNodeStore);
- MongoTestBackend roStore = createNodeStore(true);
+ try (MongoTestBackend roStore = createNodeStore(true)) {
- PipelinedStrategy pipelinedStrategy = createStrategy(roStore,
pathPredicate, pathFilters);
- File file = pipelinedStrategy.createSortedStoreFile();
+ PipelinedStrategy pipelinedStrategy = createStrategy(roStore,
pathPredicate, pathFilters);
+ File file = pipelinedStrategy.createSortedStoreFile();
- assertTrue(file.exists());
- assertEquals(expected, Files.readAllLines(file.toPath()));
- assertMetrics(statsProvider);
+ assertTrue(file.exists());
+ assertEquals(expected, Files.readAllLines(file.toPath()));
+ assertMetrics(statsProvider);
+ }
}
}
@@ -543,15 +544,17 @@ public class PipelinedIT {
Predicate<String> pathPredicate = s -> contentDamPathFilter.filter(s)
!= PathFilter.Result.EXCLUDE;
List<PathFilter> pathFilters = null;
- MongoTestBackend rwStore = createNodeStore(false);
- @NotNull NodeBuilder rootBuilder =
rwStore.documentNodeStore.getRoot().builder();
- // This property does not fit in the reserved memory, but must still
be processed without errors
- String longString = RandomStringUtils.random((int) (10 *
FileUtils.ONE_MB), true, true);
- @NotNull NodeBuilder contentDamBuilder =
rootBuilder.child("content").child("dam");
- contentDamBuilder.child("2021").child("01").setProperty("p1",
"v202101");
- contentDamBuilder.child("2022").child("01").setProperty("p1",
longString);
- contentDamBuilder.child("2023").child("01").setProperty("p1",
"v202301");
- rwStore.documentNodeStore.merge(rootBuilder, EmptyHook.INSTANCE,
CommitInfo.EMPTY);
+ String longString = RandomStringUtils.insecure().next((int) (10 *
FileUtils.ONE_MB), true, true);
+
+ try (MongoTestBackend rwStore = createNodeStore(false)) {
+ @NotNull NodeBuilder rootBuilder =
rwStore.documentNodeStore.getRoot().builder();
+ // This property does not fit in the reserved memory, but must
still be processed without errors
+ @NotNull NodeBuilder contentDamBuilder =
rootBuilder.child("content").child("dam");
+ contentDamBuilder.child("2021").child("01").setProperty("p1",
"v202101");
+ contentDamBuilder.child("2022").child("01").setProperty("p1",
longString);
+ contentDamBuilder.child("2023").child("01").setProperty("p1",
"v202301");
+ rwStore.documentNodeStore.merge(rootBuilder, EmptyHook.INSTANCE,
CommitInfo.EMPTY);
+ }
List<String> expected = List.of(
"/|{}",
@@ -565,13 +568,14 @@ public class PipelinedIT {
"/content/dam/2023/01|{\"p1\":\"v202301\"}"
);
- MongoTestBackend roStore = createNodeStore(true);
- PipelinedStrategy pipelinedStrategy = createStrategy(roStore,
pathPredicate, pathFilters);
+ try (MongoTestBackend roStore = createNodeStore(true)) {
+ PipelinedStrategy pipelinedStrategy = createStrategy(roStore,
pathPredicate, pathFilters);
- File file = pipelinedStrategy.createSortedStoreFile();
- assertTrue(file.exists());
- assertArrayEquals(expected.toArray(new String[0]),
Files.readAllLines(file.toPath()).toArray(new String[0]));
- assertMetrics(statsProvider);
+ File file = pipelinedStrategy.createSortedStoreFile();
+ assertTrue(file.exists());
+ assertArrayEquals(expected.toArray(new String[0]),
Files.readAllLines(file.toPath()).toArray(new String[0]));
+ assertMetrics(statsProvider);
+ }
}
@@ -679,8 +683,8 @@ public class PipelinedIT {
}
}
- private MongoTestBackend createNodeStore(boolean b) {
- return PipelineITUtil.createNodeStore(b, connectionFactory,
builderProvider);
+ private MongoTestBackend createNodeStore(boolean readOnly) {
+ return PipelineITUtil.createNodeStore(readOnly, connectionFactory,
builderProvider);
}
private PipelinedStrategy createStrategy(MongoTestBackend roStore) {
diff --git
a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedTreeStoreIT.java
b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedTreeStoreIT.java
index d70101c011..4f28c4d950 100644
---
a/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedTreeStoreIT.java
+++
b/oak-run-commons/src/test/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedTreeStoreIT.java
@@ -454,14 +454,14 @@ public class PipelinedTreeStoreIT {
try (MongoTestBackend rwStore = createNodeStore(false)) {
DocumentNodeStore rwNodeStore = rwStore.documentNodeStore;
contentBuilder.accept(rwNodeStore);
- MongoTestBackend roStore = createNodeStore(true);
+ try (MongoTestBackend roStore = createNodeStore(true)) {
+ PipelinedTreeStoreStrategy pipelinedStrategy =
createStrategy(roStore, pathPredicate, pathFilters);
+ File file = pipelinedStrategy.createSortedStoreFile();
- PipelinedTreeStoreStrategy pipelinedStrategy =
createStrategy(roStore, pathPredicate, pathFilters);
- File file = pipelinedStrategy.createSortedStoreFile();
-
- assertTrue(file.exists());
- assertEquals(expected, readAllEntries(file));
- assertMetrics(statsProvider);
+ assertTrue(file.exists());
+ assertEquals(expected, readAllEntries(file));
+ assertMetrics(statsProvider);
+ }
}
}
@@ -564,15 +564,17 @@ public class PipelinedTreeStoreIT {
Predicate<String> pathPredicate = s -> contentDamPathFilter.filter(s)
!= PathFilter.Result.EXCLUDE;
List<PathFilter> pathFilters = null;
- MongoTestBackend rwStore = createNodeStore(false);
- @NotNull NodeBuilder rootBuilder =
rwStore.documentNodeStore.getRoot().builder();
- // This property does not fit in the reserved memory, but must still
be processed without errors
- String longString = RandomStringUtils.random((int) (10 *
FileUtils.ONE_MB), true, true);
- @NotNull NodeBuilder contentDamBuilder =
rootBuilder.child("content").child("dam");
- contentDamBuilder.child("2021").child("01").setProperty("p1",
"v202101");
- contentDamBuilder.child("2022").child("01").setProperty("p1",
longString);
- contentDamBuilder.child("2023").child("01").setProperty("p1",
"v202301");
- rwStore.documentNodeStore.merge(rootBuilder, EmptyHook.INSTANCE,
CommitInfo.EMPTY);
+ String longString = RandomStringUtils.insecure().next((int) (10 *
FileUtils.ONE_MB), true, true);
+
+ try (MongoTestBackend rwStore = createNodeStore(false)) {
+ @NotNull NodeBuilder rootBuilder =
rwStore.documentNodeStore.getRoot().builder();
+ // This property does not fit in the reserved memory, but must
still be processed without errors
+ @NotNull NodeBuilder contentDamBuilder =
rootBuilder.child("content").child("dam");
+ contentDamBuilder.child("2021").child("01").setProperty("p1",
"v202101");
+ contentDamBuilder.child("2022").child("01").setProperty("p1",
longString);
+ contentDamBuilder.child("2023").child("01").setProperty("p1",
"v202301");
+ rwStore.documentNodeStore.merge(rootBuilder, EmptyHook.INSTANCE,
CommitInfo.EMPTY);
+ }
List<String> expected = List.of(
"/|{}",
@@ -586,13 +588,14 @@ public class PipelinedTreeStoreIT {
"/content/dam/2023/01|{\"p1\":\"v202301\"}"
);
- MongoTestBackend roStore = createNodeStore(true);
- PipelinedTreeStoreStrategy pipelinedStrategy = createStrategy(roStore,
pathPredicate, pathFilters);
+ try (MongoTestBackend roStore = createNodeStore(true)) {
+ PipelinedTreeStoreStrategy pipelinedStrategy =
createStrategy(roStore, pathPredicate, pathFilters);
- File file = pipelinedStrategy.createSortedStoreFile();
- assertTrue(file.exists());
- assertArrayEquals(expected.toArray(new String[0]),
readAllEntriesArray(file));
- assertMetrics(statsProvider);
+ File file = pipelinedStrategy.createSortedStoreFile();
+ assertTrue(file.exists());
+ assertArrayEquals(expected.toArray(new String[0]),
readAllEntriesArray(file));
+ assertMetrics(statsProvider);
+ }
}
static String[] readAllEntriesArray(File dir) throws IOException {
@@ -718,8 +721,8 @@ public class PipelinedTreeStoreIT {
}
}
- private MongoTestBackend createNodeStore(boolean b) {
- return PipelineITUtil.createNodeStore(b, connectionFactory,
builderProvider);
+ private MongoTestBackend createNodeStore(boolean readOnly) {
+ return PipelineITUtil.createNodeStore(readOnly, connectionFactory,
builderProvider);
}
private PipelinedTreeStoreStrategy createStrategy(MongoTestBackend
roStore) {