use of org.apache.hyracks.api.io.IODeviceHandle in project asterixdb by apache.
the class LSMRTreeTestHarness method tearDown.
public void tearDown() throws HyracksDataException {
diskBufferCache.close();
IODeviceHandle dev = ioManager.getIODevices().get(ioDeviceId);
File dir = new File(dev.getMount(), onDiskDir);
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return !name.startsWith(".");
}
};
String[] files = dir.list(filter);
if (files != null) {
for (String fileName : files) {
File file = new File(dir.getPath() + File.separator + fileName);
file.delete();
}
}
}
use of org.apache.hyracks.api.io.IODeviceHandle in project asterixdb by apache.
the class IOManagerPathTest method testDuplicates.
@Test(expected = HyracksDataException.class)
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 }), new DefaultDeviceResolver());
}
use of org.apache.hyracks.api.io.IODeviceHandle in project asterixdb by apache.
the class LSMIndexFileManagerTest method createIOManager.
private IOManager createIOManager(int numDevices) throws HyracksDataException {
List<IODeviceHandle> devices = new ArrayList<>();
for (int i = 0; i < numDevices; i++) {
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(), new DefaultDeviceResolver());
}
use of org.apache.hyracks.api.io.IODeviceHandle in project asterixdb by apache.
the class LSMInvertedIndexTestHarness method tearDown.
public void tearDown() throws HyracksDataException {
diskBufferCache.close();
IODeviceHandle dev = ioManager.getIODevices().get(ioDeviceId);
File dir = new File(dev.getMount(), onDiskDir);
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return !name.startsWith(".");
}
};
String[] files = dir.list(filter);
if (files != null) {
for (String fileName : files) {
File file = new File(dir.getPath() + File.separator + fileName);
file.delete();
}
}
dir.delete();
for (int i = 0; i < numMutableComponents; i++) {
virtualBufferCaches.get(i).close();
}
}
use of org.apache.hyracks.api.io.IODeviceHandle in project asterixdb by apache.
the class VirtualFreePageManagerTest method test01.
@Test
public void test01() throws HyracksDataException {
VirtualBufferCache bufferCache = new VirtualBufferCache(new HeapBufferAllocator(), 4096, 128);
bufferCache.open();
FileReference fileRef = new FileReference(new IODeviceHandle(new File("target"), "workspace"), "tempfile.tmp");
bufferCache.createFile(fileRef);
int fileId = bufferCache.getFileMapProvider().lookupFileId(fileRef);
bufferCache.openFile(fileId);
VirtualFreePageManager virtualFreePageManager = new VirtualFreePageManager(bufferCache);
virtualFreePageManager.open(fileId);
virtualFreePageManager.init(null, null);
testInMemoryFreePageManager(virtualFreePageManager);
// We expect exactly the same behavior after a reset().
virtualFreePageManager.init(null, null);
testInMemoryFreePageManager(virtualFreePageManager);
}
Aggregations