Yingyi Bu has submitted this change and it was merged. Change subject: ASTERIXDB-1915: make dataset files uniformly distributed among io devices. ......................................................................
ASTERIXDB-1915: make dataset files uniformly distributed among io devices. Change-Id: I2dd9e17e96c1d4ef55e29d0a0f8feadf8ce321ed Reviewed-on: https://asterix-gerrit.ics.uci.edu/1770 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> BAD: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: abdullah alamoudi <[email protected]> --- M asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java M hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplication.java R hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceResolver.java M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java R hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceResolver.java M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java M hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java M hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManagerComponentHolder.java M hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java M hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-common-test/src/test/java/org/apache/hyracks/storage/am/lsm/common/LSMIndexFileManagerTest.java M hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-common-test/src/test/java/org/apache/hyracks/storage/common/IOManagerPathTest.java 13 files changed, 143 insertions(+), 39 deletions(-) Approvals: abdullah alamoudi: Looks good to me, approved Jenkins: Verified; No violations found; No violations found; Verified diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java index 26952ad..4aeb098 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplication.java @@ -53,6 +53,7 @@ import org.apache.hyracks.api.client.HyracksConnection; import org.apache.hyracks.api.client.IHyracksClientConnection; import org.apache.hyracks.api.config.IConfigManager; +import org.apache.hyracks.api.io.IFileDeviceResolver; import org.apache.hyracks.api.job.resource.NodeCapacity; import org.apache.hyracks.api.messages.IMessageBroker; import org.apache.hyracks.control.common.controllers.NCConfig; @@ -281,6 +282,14 @@ return runtimeContext; } + @Override + public IFileDeviceResolver getFileDeviceResolver() { + return (relPath, devices) -> { + int ioDeviceIndex = Math.abs(StoragePathUtil.getPartitionNumFromRelativePath(relPath) % devices.size()); + return devices.get(ioDeviceIndex); + }; + } + protected IHyracksClientConnection getHcc() throws Exception { NodeControllerService ncSrv = (NodeControllerService) ncServiceCtx.getControllerService(); ClusterControllerInfo ccInfo = ncSrv.getNodeParameters().getClusterControllerInfo(); diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java index 7c2e472..64877ea 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java @@ -123,11 +123,11 @@ librarian.cleanup(); } testExecutor.executeTest(PATH_ACTUAL, tcCtx, null, false, ExecutionTestUtil.FailedGroup); + try { + checkStorageFiles(); + } finally { testExecutor.cleanup(tcCtx.toString(), badTestCases); - } catch (Throwable th) { - th.printStackTrace(); - throw th; } } } finally { @@ -135,6 +135,69 @@ } } + // Checks whether data files are uniformly distributed among io devices. + private static void checkStorageFiles() throws Exception { + String tempDirPath = System.getProperty("java.io.tmpdir"); + File dir = new File(tempDirPath); + File[] subDirs = dir.listFiles(); + List<File> ncStores = new ArrayList<>(); + // Finds nc stores. + for (File file : subDirs) { + if (file.getName().startsWith("asterix_nc")) { + ncStores.add(file); + } + } + // Checks that dataset files are uniformly distributed across each nc store. + for (File ncStore : ncStores) { + checkNcStore(ncStore); + } + } + + // For each NC, check whether data files are uniformly distributed among io devices. + private static void checkNcStore(File ncStore) throws Exception { + File[] ioDevices = ncStore.listFiles(); + int expectedPartitionNum = -1; + for (File ioDevice : ioDevices) { + File[] dataDirs = ioDevice.listFiles(); + for (File dataDir : dataDirs) { + String dirName = dataDir.getName(); + if (!dirName.equals("storage")) { + // Skips non-storage directories. + continue; + } + int numPartitions = getNumResidentPartitions(dataDir.listFiles()); + if (expectedPartitionNum < 0) { + // Sets the expected number of partitions to the number of partitions on the first io device. + expectedPartitionNum = numPartitions; + } else { + // Checks whether the number of partitions of the current io device is expected. + if (expectedPartitionNum != numPartitions) { + throw new Exception("Non-uniform data distribution on io devices: " + dataDir.getAbsolutePath() + + " number of partitions: " + numPartitions + " expected number of partitions: " + + expectedPartitionNum); + } + } + } + } + } + + // Gets the number of partitions on each io device. + private static int getNumResidentPartitions(File[] partitions) { + int num = 0; + for (File partition : partitions) { + File[] dataverses = partition.listFiles(); + for (File dv : dataverses) { + String dvName = dv.getName(); + // If a partition only contains the Metadata dataverse, it's not counted. + if (!dvName.equals("Metadata")) { + num++; + break; + } + } + } + return num; + } + private static void checkThreadLeaks() throws IOException { String threadDump = ThreadDumpHelper.takeDumpJSON(ManagementFactory.getThreadMXBean()); // Currently we only do sanity check for threads used in the execution engine. diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplication.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplication.java index 5b35095..02416c4 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplication.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/application/INCApplication.java @@ -18,6 +18,7 @@ */ package org.apache.hyracks.api.application; +import org.apache.hyracks.api.io.IFileDeviceResolver; import org.apache.hyracks.api.job.resource.NodeCapacity; public interface INCApplication extends IApplication { @@ -25,4 +26,11 @@ void preStop() throws Exception; //NOSONAR NodeCapacity getCapacity(); + + /** + * @return the file device resolver which resolves the relative path of a storage + * file into an io device. + */ + IFileDeviceResolver getFileDeviceResolver(); + } diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceComputer.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceResolver.java similarity index 72% rename from hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceComputer.java rename to hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceResolver.java index e75efd4..2598caf 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceComputer.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/io/IFileDeviceResolver.java @@ -18,20 +18,23 @@ */ package org.apache.hyracks.api.io; +import java.util.List; + import org.apache.hyracks.api.exceptions.HyracksDataException; /** - * Computes the device destination for a file from its relative path + * Resolves the device destination for a file from its relative path */ @FunctionalInterface -public interface IFileDeviceComputer { +public interface IFileDeviceResolver { /** - * Compute the device from the relative path + * Resolves the device from the relative path. * * @param relativePath - * @return + * a relative file path. + * @return the resident IO device of the file. */ - IODeviceHandle compute(String relativePath) throws HyracksDataException; + IODeviceHandle resolve(String relativePath, List<IODeviceHandle> devices) throws HyracksDataException; } diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java index baf69d0..20f6378 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/BaseNCApplication.java @@ -27,10 +27,12 @@ import org.apache.hyracks.api.application.IServiceContext; import org.apache.hyracks.api.config.IConfigManager; import org.apache.hyracks.api.config.Section; +import org.apache.hyracks.api.io.IFileDeviceResolver; import org.apache.hyracks.api.job.resource.NodeCapacity; import org.apache.hyracks.control.common.controllers.CCConfig; import org.apache.hyracks.control.common.controllers.ControllerConfig; import org.apache.hyracks.control.common.controllers.NCConfig; +import org.apache.hyracks.control.nc.io.DefaultDeviceResolver; public class BaseNCApplication implements INCApplication { public static final BaseNCApplication INSTANCE = new BaseNCApplication(); @@ -79,6 +81,11 @@ return null; } + @Override + public IFileDeviceResolver getFileDeviceResolver() { + return new DefaultDeviceResolver(); + } + protected void configureLoggingLevel(Level level) { Logger.getLogger("org.apache.hyracks").setLevel(level); } diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java index be24dbe..2fe0e27 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NodeControllerService.java @@ -172,7 +172,8 @@ this.application = application; id = ncConfig.getNodeId(); - ioManager = new IOManager(IODeviceHandle.getDevices(ncConfig.getIODevices())); + ioManager = new IOManager(IODeviceHandle.getDevices(ncConfig.getIODevices()), + application.getFileDeviceResolver()); if (id == null) { throw new HyracksException("id not set"); } diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceComputer.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceResolver.java similarity index 72% rename from hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceComputer.java rename to hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceResolver.java index bacb608..61a1cd8 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceComputer.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/DefaultDeviceResolver.java @@ -19,31 +19,28 @@ package org.apache.hyracks.control.nc.io; import java.io.File; +import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.IFileDeviceComputer; +import org.apache.hyracks.api.io.IFileDeviceResolver; import org.apache.hyracks.api.io.IODeviceHandle; -public class DefaultDeviceComputer implements IFileDeviceComputer { - private final IOManager ioManager; +public class DefaultDeviceResolver implements IFileDeviceResolver { private AtomicInteger next = new AtomicInteger(0); - public DefaultDeviceComputer(IOManager ioManager) { - this.ioManager = ioManager; - } - @Override - public IODeviceHandle compute(String relPath) throws HyracksDataException { + public IODeviceHandle resolve(String relPath, List<IODeviceHandle> devices) throws HyracksDataException { + int numDevices = devices.size(); String path = relPath; // if number of devices is 1, we return the device - if (ioManager.getIODevices().size() == 1) { - return ioManager.getIODevices().get(0); + if (numDevices == 1) { + return devices.get(0); } // check if it exists already on a device int nextSeparator = path.lastIndexOf(File.separator); while (nextSeparator > 0) { - for (IODeviceHandle dev : ioManager.getIODevices()) { + for (IODeviceHandle dev : devices) { if (dev.contains(path)) { return dev; } @@ -52,13 +49,13 @@ nextSeparator = path.lastIndexOf(File.separator); } // one last attempt - for (IODeviceHandle dev : ioManager.getIODevices()) { + for (IODeviceHandle dev : devices) { if (dev.contains(path)) { return dev; } } // not on any device, round robin assignment - return ioManager.getIODevices().get(next.getAndIncrement() % ioManager.getIODevices().size()); + return devices.get(next.getAndIncrement() % numDevices); } } diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java index d97a7b5..722ff9e 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/io/IOManager.java @@ -33,7 +33,7 @@ import org.apache.hyracks.api.exceptions.ErrorCode; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IFileDeviceComputer; +import org.apache.hyracks.api.io.IFileDeviceResolver; import org.apache.hyracks.api.io.IFileHandle; import org.apache.hyracks.api.io.IIOFuture; import org.apache.hyracks.api.io.IIOManager; @@ -55,14 +55,15 @@ */ private Executor executor; private int workspaceIndex; - private IFileDeviceComputer deviceComputer; + private IFileDeviceResolver deviceComputer; - public IOManager(List<IODeviceHandle> devices, Executor executor) throws HyracksDataException { - this(devices); + public IOManager(List<IODeviceHandle> devices, Executor executor, IFileDeviceResolver deviceComputer) + throws HyracksDataException { + this(devices, deviceComputer); this.executor = executor; } - public IOManager(List<IODeviceHandle> devices) throws HyracksDataException { + public IOManager(List<IODeviceHandle> devices, IFileDeviceResolver deviceComputer) throws HyracksDataException { this.ioDevices = Collections.unmodifiableList(devices); checkDeviceValidity(devices); workspaces = new ArrayList<>(); @@ -76,7 +77,7 @@ throw new HyracksDataException("No devices with workspace found"); } workspaceIndex = 0; - deviceComputer = new DefaultDeviceComputer(this); + this.deviceComputer = deviceComputer; } private void checkDeviceValidity(List<IODeviceHandle> devices) throws HyracksDataException { @@ -356,7 +357,7 @@ @Override public FileReference resolve(String path) throws HyracksDataException { - return new FileReference(deviceComputer.compute(path), path); + return new FileReference(deviceComputer.resolve(path, getIODevices()), path); } @Override diff --git a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java index 6986e3d..b7aa342 100644 --- a/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java +++ b/hyracks-fullstack/hyracks/hyracks-examples/btree-example/btreehelper/src/main/java/org/apache/hyracks/examples/btree/helper/TestNCApplication.java @@ -22,6 +22,7 @@ import org.apache.hyracks.api.application.INCServiceContext; import org.apache.hyracks.api.application.IServiceContext; import org.apache.hyracks.api.config.IConfigManager; +import org.apache.hyracks.api.io.IFileDeviceResolver; import org.apache.hyracks.api.job.resource.NodeCapacity; public class TestNCApplication implements INCApplication { @@ -63,4 +64,9 @@ return rCtx; } + @Override + public IFileDeviceResolver getFileDeviceResolver() { + return null; + } + } diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManagerComponentHolder.java b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManagerComponentHolder.java index 04efad3..d9c4b85 100644 --- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManagerComponentHolder.java +++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestStorageManagerComponentHolder.java @@ -28,6 +28,7 @@ import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.exceptions.HyracksException; import org.apache.hyracks.api.io.IODeviceHandle; +import org.apache.hyracks.control.nc.io.DefaultDeviceResolver; import org.apache.hyracks.control.nc.io.IOManager; import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; import org.apache.hyracks.storage.am.common.dataflow.IndexLifecycleManager; @@ -109,7 +110,7 @@ List<IODeviceHandle> devices = new ArrayList<>(); devices.add(new IODeviceHandle(new File(System.getProperty("user.dir") + File.separator + "target"), "iodev_test_wa")); - ioManager = new IOManager(devices, Executors.newCachedThreadPool()); + ioManager = new IOManager(devices, Executors.newCachedThreadPool(), new DefaultDeviceResolver()); } return ioManager; } diff --git a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java index 88bdb1a..c3d86e8 100644 --- a/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java +++ b/hyracks-fullstack/hyracks/hyracks-test-support/src/main/java/org/apache/hyracks/test/support/TestUtils.java @@ -39,6 +39,7 @@ import org.apache.hyracks.api.exceptions.HyracksException; import org.apache.hyracks.api.io.IODeviceHandle; import org.apache.hyracks.api.job.JobId; +import org.apache.hyracks.control.nc.io.DefaultDeviceResolver; import org.apache.hyracks.control.nc.io.IOManager; public class TestUtils { @@ -58,7 +59,7 @@ private static IOManager createIoManager() throws HyracksException { List<IODeviceHandle> devices = new ArrayList<>(); devices.add(new IODeviceHandle(new File(System.getProperty("java.io.tmpdir")), ".")); - return new IOManager(devices, Executors.newCachedThreadPool()); + return new IOManager(devices, Executors.newCachedThreadPool(), new DefaultDeviceResolver()); } public static void compareWithResult(File expectedFile, File actualFile) throws Exception { diff --git a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-common-test/src/test/java/org/apache/hyracks/storage/am/lsm/common/LSMIndexFileManagerTest.java b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-common-test/src/test/java/org/apache/hyracks/storage/am/lsm/common/LSMIndexFileManagerTest.java index 9b2aafd..70e3ed6 100644 --- a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-common-test/src/test/java/org/apache/hyracks/storage/am/lsm/common/LSMIndexFileManagerTest.java +++ b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-am-lsm-common-test/src/test/java/org/apache/hyracks/storage/am/lsm/common/LSMIndexFileManagerTest.java @@ -36,6 +36,7 @@ import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.FileReference; import org.apache.hyracks.api.io.IODeviceHandle; +import org.apache.hyracks.control.nc.io.DefaultDeviceResolver; import org.apache.hyracks.control.nc.io.IOManager; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexFileManager; import org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences; @@ -247,7 +248,7 @@ String iodevPath = System.getProperty("java.io.tmpdir") + sep + "test_iodev" + i; devices.add(new IODeviceHandle(new File(iodevPath), "wa")); } - return new IOManager(devices, Executors.newCachedThreadPool()); + return new IOManager(devices, Executors.newCachedThreadPool(), new DefaultDeviceResolver()); } private FileReference simulateMerge(ILSMIndexFileManager fileManager, FileReference a, FileReference b) diff --git a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-common-test/src/test/java/org/apache/hyracks/storage/common/IOManagerPathTest.java b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-common-test/src/test/java/org/apache/hyracks/storage/common/IOManagerPathTest.java index 512a187..3d6e3ef 100644 --- a/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-common-test/src/test/java/org/apache/hyracks/storage/common/IOManagerPathTest.java +++ b/hyracks-fullstack/hyracks/hyracks-tests/hyracks-storage-common-test/src/test/java/org/apache/hyracks/storage/common/IOManagerPathTest.java @@ -18,23 +18,28 @@ */ package org.apache.hyracks.storage.common; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + import org.apache.commons.io.FileUtils; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.api.io.FileReference; import org.apache.hyracks.api.io.IODeviceHandle; +import org.apache.hyracks.control.nc.io.DefaultDeviceResolver; import org.apache.hyracks.control.nc.io.IOManager; -import org.junit.*; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; public class IOManagerPathTest { @Test public void testPrefixNames() throws HyracksDataException { IODeviceHandle shorter = new IODeviceHandle(new File("/tmp/tst/1"), "storage"); IODeviceHandle longer = new IODeviceHandle(new File("/tmp/tst/11"), "storage"); - IOManager ioManager = new IOManager(Arrays.asList(new IODeviceHandle[] { shorter, longer })); + IOManager ioManager = new IOManager(Arrays.asList(new IODeviceHandle[] { shorter, longer }), + new DefaultDeviceResolver()); FileReference f = ioManager.resolveAbsolutePath("/tmp/tst/11/storage/Foo_idx_foo/my_btree"); Assert.assertEquals("/tmp/tst/11/storage/Foo_idx_foo/my_btree", f.getAbsolutePath()); } @@ -43,7 +48,8 @@ public void testDuplicates() throws HyracksDataException { IODeviceHandle first = new IODeviceHandle(new File("/tmp/tst/1"), "storage"); IODeviceHandle second = new IODeviceHandle(new File("/tmp/tst/1"), "storage"); - IOManager ioManager = new IOManager(Arrays.asList(new IODeviceHandle[] { first, second })); + IOManager ioManager = new IOManager(Arrays.asList(new IODeviceHandle[] { first, second }), + new DefaultDeviceResolver()); } @After -- To view, visit https://asterix-gerrit.ics.uci.edu/1770 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2dd9e17e96c1d4ef55e29d0a0f8feadf8ce321ed Gerrit-PatchSet: 8 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Yingyi Bu <[email protected]> Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: Yingyi Bu <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
