[ASTERIXDB-3185][STO] Extend IStorageManager to provide IIOManager
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Indexes should use the IIOManager provided by the IStorageManager
Change-Id: Ie0da5eb22456c238a6255a1287f8576b6c534562
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17534
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Wail Alkowaileet <wael.y.k@gmail.com>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
index f9646b0..f60ed63 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/NCAppRuntimeContext.java
@@ -147,7 +147,7 @@
private ILSMIOOperationScheduler lsmIOScheduler;
private PersistentLocalResourceRepository localResourceRepository;
private IIOManager ioManager;
- private IIOManager cloudIoManager;
+ private IIOManager persistenceIOManager;
private boolean isShuttingdown;
private ActiveManager activeManager;
private IReplicationChannel replicationChannel;
@@ -161,7 +161,7 @@
private IIndexCheckpointManagerProvider indexCheckpointManagerProvider;
private IReplicaManager replicaManager;
private IReceptionist receptionist;
- private ICacheManager cacheManager;
+ private final ICacheManager cacheManager;
private IConfigValidator configValidator;
private IDiskWriteRateLimiterProvider diskWriteRateLimiterProvider;
@@ -191,7 +191,9 @@
boolean initialRun) throws IOException {
ioManager = getServiceContext().getIoManager();
if (isCloudDeployment()) {
- cloudIoManager = new CloudIOManager((IOManager) ioManager);
+ persistenceIOManager = new CloudIOManager((IOManager) ioManager);
+ } else {
+ persistenceIOManager = ioManager;
}
int ioQueueLen = getServiceContext().getAppConfig().getInt(NCConfig.Option.IO_QUEUE_SIZE);
threadExecutor =
@@ -202,9 +204,10 @@
storageProperties.getBufferCachePageSize(), storageProperties.getBufferCacheNumPages());
lsmIOScheduler = createIoScheduler(storageProperties);
metadataMergePolicyFactory = new ConcurrentMergePolicyFactory();
+ // TODO do we want to write checkpoints for cloud?
indexCheckpointManagerProvider = new IndexCheckpointManagerProvider(ioManager);
ILocalResourceRepositoryFactory persistentLocalResourceRepositoryFactory =
- new PersistentLocalResourceRepositoryFactory(ioManager, indexCheckpointManagerProvider,
+ new PersistentLocalResourceRepositoryFactory(persistenceIOManager, indexCheckpointManagerProvider,
persistedResourceRegistry);
localResourceRepository =
(PersistentLocalResourceRepository) persistentLocalResourceRepositoryFactory.createRepository();
@@ -261,11 +264,11 @@
//initialize replication channel
replicationChannel = new ReplicationChannel(this);
- bufferCache = new BufferCache(getLocalOrCloudIoManager(), prs, pcp, new FileMapManager(),
+ bufferCache = new BufferCache(persistenceIOManager, prs, pcp, new FileMapManager(),
storageProperties.getBufferCacheMaxOpenFiles(), ioQueueLen, getServiceContext().getThreadFactory(),
replicationManager);
} else {
- bufferCache = new BufferCache(getLocalOrCloudIoManager(), prs, pcp, new FileMapManager(),
+ bufferCache = new BufferCache(persistenceIOManager, prs, pcp, new FileMapManager(),
storageProperties.getBufferCacheMaxOpenFiles(), ioQueueLen, getServiceContext().getThreadFactory());
}
@@ -370,12 +373,8 @@
}
@Override
- public IIOManager getCloudIoManager() {
- return cloudIoManager;
- }
-
- private IIOManager getLocalOrCloudIoManager() {
- return isCloudDeployment() ? cloudIoManager : ioManager;
+ public IIOManager getPersistenceIoManager() {
+ return persistenceIOManager;
}
@Override
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CloudToLocalStorageCachingTask.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CloudToLocalStorageCachingTask.java
index 55906b6..d214088 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CloudToLocalStorageCachingTask.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/task/CloudToLocalStorageCachingTask.java
@@ -48,7 +48,7 @@
String nodeId = applicationContext.getServiceContext().getNodeId();
LOGGER.info("Syncing cloud to local storage for node {}. for partitions: {}", nodeId, partitions);
- CloudIOManager cloudIOManager = (CloudIOManager) applicationContext.getCloudIoManager();
+ CloudIOManager cloudIOManager = (CloudIOManager) applicationContext.getPersistenceIoManager();
// TODO(htowaileb): eager caching is disabled for now as it depends on static partitioning work
cloudIOManager.syncFiles(partitions);
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
index 434d61c..23487a9 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/INcApplicationContext.java
@@ -49,7 +49,7 @@
IIOManager getIoManager();
- IIOManager getCloudIoManager();
+ IIOManager getPersistenceIoManager();
Executor getThreadExecutor();
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RuntimeComponentsProvider.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RuntimeComponentsProvider.java
index 0ffbe87..04f594e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RuntimeComponentsProvider.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/RuntimeComponentsProvider.java
@@ -22,6 +22,7 @@
import org.apache.asterix.common.api.INcApplicationContext;
import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.io.IJsonSerializable;
import org.apache.hyracks.api.io.IPersistedResourceRegistry;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
@@ -48,6 +49,11 @@
}
@Override
+ public IIOManager getIoManager(INCServiceContext ctx) {
+ return ((INcApplicationContext) ctx.getApplicationContext()).getPersistenceIoManager();
+ }
+
+ @Override
public IBufferCache getBufferCache(INCServiceContext ctx) {
return ((INcApplicationContext) ctx.getApplicationContext()).getBufferCache();
}
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/BTreeHelperStorageManager.java b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/BTreeHelperStorageManager.java
index 3d33ca1..bf870b1 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/BTreeHelperStorageManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/BTreeHelperStorageManager.java
@@ -20,6 +20,7 @@
package org.apache.hyracks.examples.btree.helper;
import org.apache.hyracks.api.application.INCServiceContext;
+import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.storage.common.IIndex;
import org.apache.hyracks.storage.common.ILocalResourceRepository;
import org.apache.hyracks.storage.common.IResourceLifecycleManager;
@@ -36,6 +37,11 @@
}
@Override
+ public IIOManager getIoManager(INCServiceContext ctx) {
+ return RuntimeContext.get(ctx).getIoManager();
+ }
+
+ @Override
public IBufferCache getBufferCache(INCServiceContext ctx) {
return RuntimeContext.get(ctx).getBufferCache();
}
diff --git a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
index 3aa3d23..4632f2d 100644
--- a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/RuntimeContext.java
@@ -23,6 +23,7 @@
import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.storage.am.common.dataflow.IndexLifecycleManager;
import org.apache.hyracks.storage.common.IIndex;
import org.apache.hyracks.storage.common.ILocalResourceRepository;
@@ -43,19 +44,21 @@
import org.apache.hyracks.storage.common.file.TransientLocalResourceRepositoryFactory;
public class RuntimeContext {
- private IBufferCache bufferCache;
- private IFileMapManager fileMapManager;
- private ILocalResourceRepository localResourceRepository;
- private IResourceLifecycleManager<IIndex> lcManager;
- private ResourceIdFactory resourceIdFactory;
- private ThreadFactory threadFactory = Thread::new;
+ private final IIOManager ioManager;
+ private final IBufferCache bufferCache;
+ private final IFileMapManager fileMapManager;
+ private final ILocalResourceRepository localResourceRepository;
+ private final IResourceLifecycleManager<IIndex> lcManager;
+ private final ResourceIdFactory resourceIdFactory;
public RuntimeContext(INCServiceContext appCtx) throws HyracksDataException {
fileMapManager = new FileMapManager();
ICacheMemoryAllocator allocator = new HeapBufferAllocator();
IPageReplacementStrategy prs = new ClockPageReplacementStrategy(allocator, 32768, 50);
- bufferCache = new BufferCache(appCtx.getIoManager(), prs, new DelayPageCleanerPolicy(1000), fileMapManager, 100,
- 10, threadFactory);
+ ThreadFactory threadFactory = Thread::new;
+ this.ioManager = appCtx.getIoManager();
+ bufferCache = new BufferCache(ioManager, prs, new DelayPageCleanerPolicy(1000), fileMapManager, 100, 10,
+ threadFactory);
ILocalResourceRepositoryFactory localResourceRepositoryFactory = new TransientLocalResourceRepositoryFactory();
localResourceRepository = localResourceRepositoryFactory.createRepository();
resourceIdFactory = (new ResourceIdFactoryProvider(localResourceRepository)).createResourceIdFactory();
@@ -66,6 +69,10 @@
bufferCache.close();
}
+ public IIOManager getIoManager() {
+ return ioManager;
+ }
+
public IBufferCache getBufferCache() {
return bufferCache;
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/dataflow/BTreeResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/dataflow/BTreeResource.java
index 4589bed1..4ee702d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/dataflow/BTreeResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/dataflow/BTreeResource.java
@@ -59,7 +59,7 @@
@Override
public IIndex createInstance(INCServiceContext ctx) throws HyracksDataException {
IBufferCache bufferCache = storageManager.getBufferCache(ctx);
- IIOManager ioManager = ctx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(ctx);
FileReference resourceRef = ioManager.resolve(path);
return BTreeUtils.createBTree(bufferCache, typeTraits, comparatorFactories, BTreeLeafFrameType.REGULAR_NSM,
resourceRef, pageManagerFactory.createPageManager(bufferCache), false, nullTypeTraits,
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
index e35fba1..123734f 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/TreeIndexStatsOperatorNodePushable.java
@@ -20,6 +20,7 @@
import java.io.DataOutput;
+import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.comm.IFrameWriter;
import org.apache.hyracks.api.comm.VSizeFrame;
import org.apache.hyracks.api.context.IHyracksTaskContext;
@@ -67,9 +68,10 @@
ITreeIndex treeIndex = (ITreeIndex) treeIndexHelper.getIndexInstance();
try {
writer.open();
- IBufferCache bufferCache = storageManager.getBufferCache(ctx.getJobletContext().getServiceContext());
+ INCServiceContext ncServiceCtx = ctx.getJobletContext().getServiceContext();
+ IBufferCache bufferCache = storageManager.getBufferCache(ncServiceCtx);
LocalResource resource = treeIndexHelper.getResource();
- IIOManager ioManager = ctx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(ncServiceCtx);
FileReference fileRef = ioManager.resolve(resource.getPath());
TreeIndexStatsGatherer statsGatherer = new TreeIndexStatsGatherer(bufferCache, treeIndex.getPageManager(),
fileRef, treeIndex.getRootPageId());
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/dataflow/LSMColumnBTreeLocalResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/dataflow/LSMColumnBTreeLocalResource.java
index 56090bb..8c47bba 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/dataflow/LSMColumnBTreeLocalResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/dataflow/LSMColumnBTreeLocalResource.java
@@ -82,7 +82,7 @@
@Override
public ILSMIndex createInstance(INCServiceContext serviceCtx) throws HyracksDataException {
- IIOManager ioManager = serviceCtx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(serviceCtx);
FileReference file = ioManager.resolve(path);
List<IVirtualBufferCache> vbcs = vbcProvider.getVirtualBufferCaches(serviceCtx, file);
ioOpCallbackFactory.initialize(serviceCtx, this);
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/LSMBTreeLocalResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/LSMBTreeLocalResource.java
index 21c818c..0a47fc0 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/LSMBTreeLocalResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree/src/main/java/org/apache/hyracks/storage/am/lsm/btree/dataflow/LSMBTreeLocalResource.java
@@ -102,7 +102,7 @@
@Override
public ILSMIndex createInstance(INCServiceContext serviceCtx) throws HyracksDataException {
- IIOManager ioManager = serviceCtx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(serviceCtx);
FileReference file = ioManager.resolve(path);
List<IVirtualBufferCache> vbcs = vbcProvider.getVirtualBufferCaches(serviceCtx, file);
ioOpCallbackFactory.initialize(serviceCtx, this);
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexLocalResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexLocalResource.java
index 8a107e3..8048a93 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexLocalResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-invertedindex/src/main/java/org/apache/hyracks/storage/am/lsm/invertedindex/dataflow/LSMInvertedIndexLocalResource.java
@@ -129,7 +129,7 @@
@Override
public ILSMIndex createInstance(INCServiceContext serviceCtx) throws HyracksDataException {
- IIOManager ioManager = serviceCtx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(serviceCtx);
FileReference file = ioManager.resolve(path);
List<IVirtualBufferCache> virtualBufferCaches = vbcProvider.getVirtualBufferCaches(serviceCtx, file);
IBufferCache bufferCache = storageManager.getBufferCache(serviceCtx);
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeLocalResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeLocalResource.java
index dd21f7c..3a89238 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeLocalResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeLocalResource.java
@@ -108,7 +108,7 @@
@Override
public IIndex createInstance(INCServiceContext ncServiceCtx) throws HyracksDataException {
- IIOManager ioManager = ncServiceCtx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(ncServiceCtx);
FileReference fileRef = ioManager.resolve(path);
List<IVirtualBufferCache> virtualBufferCaches = vbcProvider.getVirtualBufferCaches(ncServiceCtx, fileRef);
ioOpCallbackFactory.initialize(ncServiceCtx, this);
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeWithAntiMatterLocalResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeWithAntiMatterLocalResource.java
index 33b9da6..e359661 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeWithAntiMatterLocalResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-rtree/src/main/java/org/apache/hyracks/storage/am/lsm/rtree/dataflow/LSMRTreeWithAntiMatterLocalResource.java
@@ -100,7 +100,7 @@
@Override
public ILSMIndex createInstance(INCServiceContext serviceCtx) throws HyracksDataException {
- IIOManager ioManager = serviceCtx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(serviceCtx);
FileReference file = ioManager.resolve(path);
List<IVirtualBufferCache> virtualBufferCaches = vbcProvider.getVirtualBufferCaches(serviceCtx, file);
ioOpCallbackFactory.initialize(serviceCtx, this);
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java
index 9195982..517c162 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/dataflow/RTreeResource.java
@@ -63,7 +63,7 @@
@Override
public IIndex createInstance(INCServiceContext ctx) throws HyracksDataException {
- IIOManager ioManager = ctx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(ctx);
FileReference resourceRef = ioManager.resolve(path);
return RTreeUtils.createRTree(storageManager.getBufferCache(ctx), typeTraits, valueProviderFactories,
comparatorFactories, rtreePolicyType, resourceRef, false, pageManagerFactory, nullTypeTraits,
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java
index d985f31..9d0880e 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/IStorageManager.java
@@ -21,6 +21,7 @@
import java.io.Serializable;
import org.apache.hyracks.api.application.INCServiceContext;
+import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.io.IJsonSerializable;
import org.apache.hyracks.storage.common.buffercache.IBufferCache;
import org.apache.hyracks.storage.common.file.IResourceIdFactory;
@@ -30,29 +31,31 @@
*/
public interface IStorageManager extends Serializable, IJsonSerializable {
/**
- * @param ctx
- * the nc service context
- * @return the disk buffer cache {@link org.apache.hyracks.storage.common.buffercache.IBufferCache}
+ * @param ctx the nc service context
+ * @return {@link IIOManager} for persisted files
+ */
+ IIOManager getIoManager(INCServiceContext ctx);
+
+ /**
+ * @param ctx the nc service context
+ * @return the disk buffer cache {@link IBufferCache}
*/
IBufferCache getBufferCache(INCServiceContext ctx);
/**
- * @param ctx
- * the nc service context
- * @return the local resource repository {@link org.apache.hyracks.storage.am.common.build.ILocalResourceRepository}
+ * @param ctx the nc service context
+ * @return the local resource repository {@link ILocalResourceRepository}
*/
ILocalResourceRepository getLocalResourceRepository(INCServiceContext ctx);
/**
- * @param ctx
- * the nc service context
- * @return the resource id factory {@link org.apache.hyracks.storage.common.file.IResourceIdFactory}
+ * @param ctx the nc service context
+ * @return the resource id factory {@link IResourceIdFactory}
*/
IResourceIdFactory getResourceIdFactory(INCServiceContext ctx);
/**
- * @param ctx
- * the nc service context
+ * @param ctx the nc service context
* @return the resource lifecycle manager
*/
IResourceLifecycleManager<IIndex> getLifecycleManager(INCServiceContext ctx);
diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManager.java b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManager.java
index 350de74..e54ce2c 100644
--- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManager.java
+++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManager.java
@@ -19,6 +19,8 @@
package org.apache.hyracks.test.support;
import org.apache.hyracks.api.application.INCServiceContext;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.storage.common.IIndex;
import org.apache.hyracks.storage.common.ILocalResourceRepository;
import org.apache.hyracks.storage.common.IResourceLifecycleManager;
@@ -30,6 +32,15 @@
private static final long serialVersionUID = 1L;
@Override
+ public IIOManager getIoManager(INCServiceContext ctx) {
+ try {
+ return TestStorageManagerComponentHolder.getIOManager();
+ } catch (HyracksDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
public IBufferCache getBufferCache(INCServiceContext ctx) {
return TestStorageManagerComponentHolder.getBufferCache(ctx);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/org/apache/hyracks/storage/am/lsm/btree/impl/TestLsmBtreeLocalResource.java b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/org/apache/hyracks/storage/am/lsm/btree/impl/TestLsmBtreeLocalResource.java
index c7d3dff..039b244 100644
--- a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/org/apache/hyracks/storage/am/lsm/btree/impl/TestLsmBtreeLocalResource.java
+++ b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-btree-test/src/test/java/org/apache/hyracks/storage/am/lsm/btree/impl/TestLsmBtreeLocalResource.java
@@ -75,7 +75,7 @@
@Override
public ILSMIndex createInstance(INCServiceContext serviceCtx) throws HyracksDataException {
- IIOManager ioManager = serviceCtx.getIoManager();
+ IIOManager ioManager = storageManager.getIoManager(serviceCtx);
FileReference file = ioManager.resolve(path);
List<IVirtualBufferCache> vbcs = vbcProvider.getVirtualBufferCaches(serviceCtx, file);
for (int i = 0; i < vbcs.size(); i++) {