You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2024/08/22 12:06:37 UTC
(jackrabbit-oak) branch OAK-11052 created (now 9fbef8a608)
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a change to branch OAK-11052
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
at 9fbef8a608 OAK-11052: AbstractDocumentStore: log when NODES not empty before/after test (also minor refactoring)
This branch includes the following new commits:
new 9fbef8a608 OAK-11052: AbstractDocumentStore: log when NODES not empty before/after test (also minor refactoring)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(jackrabbit-oak) 01/01: OAK-11052: AbstractDocumentStore: log when NODES not empty before/after test (also minor refactoring)
Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
reschke pushed a commit to branch OAK-11052
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 9fbef8a60845b319020c515deba1af0b6fbc6435
Author: Julian Reschke <re...@apache.org>
AuthorDate: Thu Aug 22 13:06:18 2024 +0100
OAK-11052: AbstractDocumentStore: log when NODES not empty before/after test (also minor refactoring)
---
.../document/AbstractDocumentStoreTest.java | 29 ++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
index 18be742238..2a4e9c2b40 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AbstractDocumentStoreTest.java
@@ -19,11 +19,13 @@ package org.apache.jackrabbit.oak.plugins.document;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import javax.sql.DataSource;
import org.apache.jackrabbit.oak.commons.properties.SystemPropertySupplier;
import org.junit.After;
+import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.slf4j.Logger;
@@ -56,6 +58,11 @@ public abstract class AbstractDocumentStoreTest {
return new DocumentMK.Builder();
}
+ @Before
+ public void startUp() throws Exception {
+ logNodesPresent(true);
+ }
+
@After
public void cleanUp() throws Exception {
removeTestNodes(org.apache.jackrabbit.oak.plugins.document.Collection.NODES, removeMe);
@@ -112,7 +119,7 @@ public abstract class AbstractDocumentStoreTest {
}
/**
- * Generate a random string of given size, with or without non-ASCII characters.
+ * Generate a constant string of given size, with or without non-ASCII characters.
*/
public static String generateConstantString(int length) {
char[] s = new char[length];
@@ -124,6 +131,7 @@ public abstract class AbstractDocumentStoreTest {
private <T extends Document> void removeTestNodes(org.apache.jackrabbit.oak.plugins.document.Collection<T> col,
List<String> ids) {
+
if (!ids.isEmpty()) {
long start = System.nanoTime();
try {
@@ -139,10 +147,27 @@ public abstract class AbstractDocumentStoreTest {
}
}
if (ids.size() > 1) {
- long elapsed = (System.nanoTime() - start) / (1000 * 1000);
+ long elapsed = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
float rate = (((float) ids.size()) / (elapsed == 0 ? 1 : elapsed));
LOG.info(ids.size() + " documents removed in " + elapsed + "ms (" + rate + "/ms)");
}
}
+
+ logNodesPresent(false);
+ }
+
+ /**
+ * Check for presence of entries in NODE table
+ * @param before
+ */
+ private void logNodesPresent(boolean before) {
+ List<NodeDocument> nodes = ds.query(org.apache.jackrabbit.oak.plugins.document.Collection.NODES, "\u0000", "\uFFFF", 10);
+ if (!nodes.isEmpty()) {
+ LOG.info("At least {} document(s) present in '{}' NODES collection {} test {}: {}", nodes.size(), dsf,
+ before ? "before" : "after",
+ this.getClass().getName().replace("org.apache.jackrabbit.oak.plugins.document.", "o.a.j.o.o.d.")
+ .replace("org.apache.jackrabbit.oak.", "o.a.j.o."),
+ nodes);
+ }
}
}