commit | 7dfaff8eb1ed92628d0c281d1fe0638f8dc563ae | [log] [tgz] |
---|---|---|
author | alexander.behm <alexander.behm@123451ca-8445-de46-9d55-352943316053> | Thu Mar 24 20:41:03 2011 +0000 |
committer | alexander.behm <alexander.behm@123451ca-8445-de46-9d55-352943316053> | Thu Mar 24 20:41:03 2011 +0000 |
tree | 85681e4e53e2c7bfd4c568d82f0675b6bfc29631 | |
parent | 78c02ff4bef94a9cb69eca6cae4085105b1aef68 [diff] |
Fix related to partial rollback after failed open() in BTree ops. git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_indexes@381 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java index eeea95f..cf4be8f 100644 --- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java +++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/dataflow/BTreeOpHelper.java
@@ -83,12 +83,20 @@ break; } - + int fileId = fileMapProvider.lookupFileId(f); - bufferCache.openFile(fileId); + try { + bufferCache.openFile(fileId); + } catch(HyracksDataException e) { + // revert state of buffer cache since file failed to open + if(!fileIsMapped) { + bufferCache.deleteFile(fileId); + } + throw e; + } - // only set btreeFileId member when open() succeeds, - // otherwise rollback will try to close the file that failed to open + // only set btreeFileId member when openFile() succeeds, + // otherwise deinit() will try to close the file that failed to open btreeFileId = fileId; interiorFrame = opDesc.getInteriorFactory().getFrame();