diff --git a/oak-doc/src/site/markdown/query/hybrid-index.md b/oak-doc/src/site/markdown/query/hybrid-index.md index 8daf7ad39bf..0955782a5f1 100644 --- a/oak-doc/src/site/markdown/query/hybrid-index.md +++ b/oak-doc/src/site/markdown/query/hybrid-index.md @@ -57,7 +57,7 @@ For such use-cases, it's required that indexes are synchronous and results provi ### Drawbacks of current property indexes Oak has support for synchronous property indexes, which are used to meet above use-cases. However the current implementation has certain drawbacks: -* Slow reads over remote storage - The property indexes are stores as normal NodeState and hence reading them over remote storage like Mongo performs poorly (with Prefetch, OAK-9780, this is improved). +* Slow reads over remote storage - The property indexes are stores as normal NodeState and hence reading them over remote storage like Mongo performs poorly (with Prefetch, this is now improved). * Storage overhead - The final storage overhead is larger, specially for remote storage where each NodeState is mapped to 1 document. (On the other hand, temporary disk usage for Lucene indexes might be higher than for node stores, due to write amplification with Lucene.) --- ### Proposal diff --git a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/PrefetchTest.java b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/PrefetchTest.java index f3694f06333..403a732186d 100644 --- a/oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/PrefetchTest.java +++ b/oak-lucene/src/test/java/org/apache/jackrabbit/oak/composite/PrefetchTest.java @@ -36,18 +36,13 @@ import javax.jcr.query.RowIterator; import org.apache.jackrabbit.api.JackrabbitSession; -import org.apache.jackrabbit.oak.commons.junit.TemporarySystemProperty; -import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore; import org.apache.jackrabbit.oak.plugins.document.prefetch.CacheWarming; import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider; import org.apache.jackrabbit.oak.spi.mount.Mounts; import org.apache.jackrabbit.oak.spi.state.NodeStore; import org.junit.After; import org.junit.Before; -import org.junit.Rule; import org.junit.Test; -import org.junit.contrib.java.lang.system.ProvideSystemProperty; -import org.junit.contrib.java.lang.system.RestoreSystemProperties; import org.junit.runners.Parameterized.Parameters; import org.slf4j.LoggerFactory; @@ -80,21 +75,10 @@ public static Collection data() { private final String cacheWarmingLogger = CacheWarming.class.getName(); - @Rule - public final ProvideSystemProperty updateSystemProperties - = new ProvideSystemProperty(DocumentNodeStore.SYS_PROP_PREFETCH, "true"); - - @Rule - public final RestoreSystemProperties restoreSystemProperties - = new RestoreSystemProperties(); - public PrefetchTest(NodeStoreKind root, NodeStoreKind mounts) { super(root, mounts); } - @Rule - public TemporarySystemProperty temporarySystemProperty = new TemporarySystemProperty(); - @Before public void loggingAppenderStart() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); diff --git a/oak-store-document/AGENTS.md b/oak-store-document/AGENTS.md index 3dc9d7faec7..6faa83b08e9 100644 --- a/oak-store-document/AGENTS.md +++ b/oak-store-document/AGENTS.md @@ -318,9 +318,7 @@ every 10 `create` calls. ## Prefetch `PrefetchDispatcher` pre-fetches visible external changes in a background thread before delivery -to local observers, hiding MongoDB/RDB read latency during observer dispatch. Controlled by -feature toggle `FT_PREFETCH_OAK-9780` (disabled by default); wired via -`DocumentNodeStoreBuilder.setPrefetchFeature()`. +to local observers, hiding MongoDB/RDB read latency during observer dispatch. ## Persistent Cache @@ -354,7 +352,6 @@ Registered in `DocumentNodeStoreService`, wired into `DocumentNodeStoreBuilder`. | Toggle name | Builder method | Purpose | |---|---|---| -| `FT_PREFETCH_OAK-9780` | `setPrefetchFeature` | Enable async pre-fetching of external changes | | `FT_THROTTLING_OAK-9909` | `setDocStoreThrottlingFeature` | Enable write throttling on MongoDB | | `FT_DISABLE_THROTTLING_OAK-12119` | `setDocStoreDisableThrottlingFeature` | Runtime kill-switch to disable throttling | | `FT_NOCOCLEANUP_OAK-10660` | `setNoChildOrderCleanupFeature` | Disable child-order property cleanup | diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java index 1078b92c6f9..2585b49d0cc 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java @@ -216,9 +216,6 @@ public final class DocumentNodeStore static final long DEFAULT_MAX_SERVER_TIME_DIFFERENCE = 2000L; private final long maxTimeDiffMillis = SystemPropertySupplier.create("oak.documentMK.maxServerTimeDiffMillis", DEFAULT_MAX_SERVER_TIME_DIFFERENCE).loggingTo(LOG).get(); - public static final String SYS_PROP_PREFETCH = "oak.documentstore.prefetch"; - private final boolean prefetchEnabled = SystemPropertySupplier.create(SYS_PROP_PREFETCH, false).loggingTo(LOG).get(); - /** * The document store without potentially lease checking wrapper. */ @@ -559,8 +556,6 @@ public String serialize(Blob blob) { private final Predicate nodeCachePredicate; - private final Feature prefetchFeature; - private final Feature cancelInvalidationFeature; private final Feature noChildOrderCleanupFeature; @@ -640,7 +635,6 @@ public DocumentNodeStore(DocumentNodeStoreBuilder builder) { leaseUpdateThread.start(); } - this.prefetchFeature = builder.getPrefetchFeature(); this.cancelInvalidationFeature = builder.getCancelInvalidationFeature(); this.noChildOrderCleanupFeature = builder.getNoChildOrderCleanupFeature(); this.avoidMergeLock = isAvoidMergeLockEnabled(builder); @@ -4046,18 +4040,11 @@ boolean isReadOnlyMode() { @Override public void prefetch(java.util.Collection paths, NodeState rootState) { if (paths != null - && rootState instanceof DocumentNodeState - && isPrefetchEnabled()) { - cacheWarming.prefetch(paths, (DocumentNodeState) rootState); + && rootState instanceof DocumentNodeState documentNodeState) { + cacheWarming.prefetch(paths, documentNodeState); } } - private boolean isPrefetchEnabled() { - // feature can be enabled with system property or feature toggle - return prefetchEnabled - || (prefetchFeature != null && prefetchFeature.isEnabled()); - } - /** * Configures the performance logger with the specified info log interval. * diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java index 1a744b12556..e7bbb7d548e 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java @@ -39,7 +39,6 @@ import org.apache.jackrabbit.oak.cache.api.Cache; import org.apache.jackrabbit.oak.cache.api.CacheBuilder; import org.apache.jackrabbit.oak.cache.api.CacheStatsAdapter; -import org.apache.jackrabbit.oak.cache.api.EvictionCause; import org.apache.jackrabbit.oak.cache.api.Weigher; import org.apache.jackrabbit.oak.cache.AbstractCacheStats; import org.apache.jackrabbit.oak.cache.CacheValue; @@ -128,7 +127,6 @@ public class DocumentNodeStoreBuilder> { private String loggingPrefix; private LeaseCheckMode leaseCheck = ClusterNodeInfo.DEFAULT_LEASE_CHECK_MODE; // OAK-2739 is enabled by default also for non-osgi private boolean isReadOnlyMode = false; - private Feature prefetchFeature; private Feature docStoreThrottlingFeature; private Feature noChildOrderCleanupFeature; private Feature cancelInvalidationFeature; @@ -466,16 +464,6 @@ public boolean getReadOnlyMode() { return isReadOnlyMode; } - public T setPrefetchFeature(@Nullable Feature prefetch) { - this.prefetchFeature = prefetch; - return thisBuilder(); - } - - @Nullable - public Feature getPrefetchFeature() { - return prefetchFeature; - } - public T setDocStoreThrottlingFeature(@Nullable Feature docStoreThrottling) { this.docStoreThrottlingFeature = docStoreThrottling; return thisBuilder(); diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java index 58b78df936c..47db59cc594 100644 --- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java +++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java @@ -197,11 +197,6 @@ public class DocumentNodeStoreService { */ static final long DEFAULT_BLOB_SNAPSHOT_INTERVAL = 12 * 60 * 60; - /** - * Feature toggle name to enable prefetch operation in DocumentStore - */ - private static final String FT_NAME_PREFETCH = "FT_PREFETCH_OAK-9780"; - /** * Feature toggle name to enable document store throttling for Mongo Document Store */ @@ -276,7 +271,6 @@ static DocumentStoreType fromString(String type) { private DocumentNodeStore nodeStore; private ObserverTracker observerTracker; private JournalPropertyHandlerFactory journalPropertyHandlerFactory = new JournalPropertyHandlerFactory(); - private Feature prefetchFeature; private Feature docStoreThrottlingFeature; private Feature noChildOrderCleanupFeature; private Feature cancelInvalidationFeature; @@ -316,7 +310,6 @@ protected void activate(ComponentContext context, Configuration config) throws E executor.start(whiteboard); customBlobStore = this.config.customBlobStore(); documentStoreType = DocumentStoreType.fromString(this.config.documentStoreType()); - prefetchFeature = Feature.newFeature(FT_NAME_PREFETCH, whiteboard); docStoreThrottlingFeature = Feature.newFeature(FT_NAME_DOC_STORE_THROTTLING, whiteboard); noChildOrderCleanupFeature = Feature.newFeature(FT_NAME_DOC_STORE_NOCOCLEANUP, whiteboard); cancelInvalidationFeature = Feature.newFeature(FT_NAME_CANCEL_INVALIDATION, whiteboard); @@ -554,7 +547,6 @@ private void configureBuilder(DocumentNodeStoreBuilder builder) { setBundlingDisabled(config.bundlingDisabled()). setJournalPropertyHandlerFactory(journalPropertyHandlerFactory). setLeaseCheckMode(ClusterNodeInfo.DEFAULT_LEASE_CHECK_DISABLED ? LeaseCheckMode.DISABLED : LeaseCheckMode.valueOf(config.leaseCheckMode())). - setPrefetchFeature(prefetchFeature). setDocStoreThrottlingFeature(docStoreThrottlingFeature). setNoChildOrderCleanupFeature(noChildOrderCleanupFeature). setCancelInvalidationFeature(cancelInvalidationFeature). @@ -720,7 +712,7 @@ protected void deactivate() { journalPropertyHandlerFactory.stop(); } - closeFeatures(prefetchFeature, docStoreThrottlingFeature, cancelInvalidationFeature, docStoreFullGCFeature, + closeFeatures(docStoreThrottlingFeature, cancelInvalidationFeature, docStoreFullGCFeature, docStoreEmbeddedVerificationFeature, prevNoPropCacheFeature, docStoreAvoidMergeLockFeature); unregisterNodeStore(); diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentPrefetchAndUpdateIT.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentPrefetchAndUpdateIT.java index 0d6ba7b60d4..0c13e919f6f 100755 --- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentPrefetchAndUpdateIT.java +++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentPrefetchAndUpdateIT.java @@ -30,7 +30,6 @@ import org.apache.jackrabbit.oak.plugins.document.util.Utils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -53,7 +52,6 @@ public class ConcurrentPrefetchAndUpdateIT extends AbstractMongoConnectionTest { @Before @Override public void setUpConnection() throws Exception { - System.setProperty(DocumentNodeStore.SYS_PROP_PREFETCH, String.valueOf(true)); mongoConnection = connectionFactory.getConnection(); assertNotNull(mongoConnection); MongoDatabase db = mongoConnection.getDatabase(); @@ -64,11 +62,6 @@ public void setUpConnection() throws Exception { mk = builder.setDocumentStore(store).open(); } - @After - public void clearSystemProperty() { - System.clearProperty(DocumentNodeStore.SYS_PROP_PREFETCH); - } - @Test public void cacheConsistency() throws Exception { Revision r = newRevision(); diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/prefetch/CacheWarmingTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/prefetch/CacheWarmingTest.java index 16293c67a4c..49a4be10048 100644 --- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/prefetch/CacheWarmingTest.java +++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/prefetch/CacheWarmingTest.java @@ -16,7 +16,6 @@ */ package org.apache.jackrabbit.oak.plugins.document.prefetch; -import static org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.SYS_PROP_PREFETCH; import static org.apache.jackrabbit.oak.plugins.document.util.Utils.getIdFromPath; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -34,7 +33,6 @@ import com.mongodb.MongoTimeoutException; import org.apache.jackrabbit.oak.api.CommitFailedException; -import org.apache.jackrabbit.oak.commons.junit.TemporarySystemProperty; import org.apache.jackrabbit.oak.commons.time.Stopwatch; import org.apache.jackrabbit.oak.plugins.document.Collection; import org.apache.jackrabbit.oak.plugins.document.CountingDocumentStore; @@ -55,7 +53,6 @@ import org.apache.jackrabbit.oak.stats.Clock; import org.jetbrains.annotations.Nullable; import org.junit.AfterClass; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.slf4j.Logger; @@ -63,9 +60,6 @@ public class CacheWarmingTest { - @Rule - public TemporarySystemProperty systemProperties = new TemporarySystemProperty(); - @Rule public DocumentMKBuilderProvider builderProvider = new DocumentMKBuilderProvider(); @@ -78,11 +72,6 @@ public class CacheWarmingTest { private CountingMongoDatabase db; - @Before - public void enablePrefetch() { - System.setProperty(SYS_PROP_PREFETCH, "true"); - } - @AfterClass public static void cleanUp() { MongoUtils.dropCollections(MongoUtils.DB);