commit | b7703794c3146853d9f23f1429f0332701df174a | [log] [tgz] |
---|---|---|
author | alexander.behm <alexander.behm@123451ca-8445-de46-9d55-352943316053> | Fri Oct 26 07:00:55 2012 +0000 |
committer | alexander.behm <alexander.behm@123451ca-8445-de46-9d55-352943316053> | Fri Oct 26 07:00:55 2012 +0000 |
tree | 44ab914fde28d7a6366e353944be1f5c53546a71 | |
parent | 390ef9c5b297a9c598ef4dfc79839b0145a22a0e [diff] |
Made the deleteDirs() method more robust. That method is used to make sure LSM indexes start off a clean directory, and in some cases files were not deleted properly. git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@2357 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java index 0cc27f4..71c335a 100644 --- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java +++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java
@@ -84,23 +84,19 @@ public void deleteDirs() { for (IODeviceHandle dev : ioManager.getIODevices()) { File f = new File(dev.getPath(), baseDir); - if (f.isDirectory()) { - deleteDir(f); - } + delete(f); } } - private void deleteDir(File dir) { - for (File f : dir.listFiles()) { - if (f.isDirectory()) { - deleteDir(f); - } else { - f.delete(); + private void delete(File f) { + if (f.isDirectory()) { + for (File c : f.listFiles()) { + delete(c); } } - dir.delete(); + f.delete(); } - + public FileReference createFlushFile(String relFlushFileName) { // Assigns new files to I/O devices in round-robin fashion. IODeviceHandle dev = ioManager.getIODevices().get(ioDeviceIndex);