Fixed the following bug discovered by Vandana and Vinayak: Some BTree tests create a folder to place the index files into. However, this folder is not removed after the tests, so different users (that don't have write privs on the folder) trying to build Hyracks get failed tests.
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_indexes@373 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java
index 5037908..a9b9502 100644
--- a/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java
+++ b/hyracks-examples/hyracks-integration-tests/src/test/java/edu/uci/ics/hyracks/tests/btree/BTreeOperatorsTest.java
@@ -74,7 +74,7 @@
private final static SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
"ddMMyy-hhmmssSS");
private final static String sep = System.getProperty("file.separator");
-
+
// field, type and key declarations for primary index
private int primaryFieldCount = 6;
private ITypeTrait[] primaryTypeTraits = new ITypeTrait[primaryFieldCount];
@@ -91,7 +91,7 @@
+ simpleDateFormat.format(new Date());
private static String primaryFileName = System
.getProperty("java.io.tmpdir")
- + sep + "nc1" + sep + primaryBtreeName;
+ + sep + primaryBtreeName;
private IFileSplitProvider primaryBtreeSplitProvider = new ConstantFileSplitProvider(
new FileSplit[] { new FileSplit(NC1_ID, new FileReference(new File(
@@ -122,7 +122,7 @@
+ simpleDateFormat.format(new Date());
private static String secondaryFileName = System
.getProperty("java.io.tmpdir")
- + sep + "nc1" + sep + secondaryBtreeName;
+ + sep + secondaryBtreeName;
private IFileSplitProvider secondaryBtreeSplitProvider = new ConstantFileSplitProvider(
new FileSplit[] { new FileSplit(NC1_ID, new FileReference(new File(
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 871c288..8009a407 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
@@ -84,8 +84,12 @@
}
- btreeFileId = fileMapProvider.lookupFileId(f);
- bufferCache.openFile(btreeFileId);
+ int fileId = fileMapProvider.lookupFileId(f);
+ bufferCache.openFile(fileId);
+
+ // only set btreeFileId member when open() succeeds,
+ // otherwise rollback will try to close the file that failed to open
+ btreeFileId = fileId;
interiorFrame = opDesc.getInteriorFactory().getFrame();
leafFrame = opDesc.getLeafFactory().getFrame();