Fixed page invalidation bug on file close.
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_storage_cleanup@259 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
index 6434b4d..b6c8709 100644
--- a/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-storage-common/src/main/java/edu/uci/ics/hyracks/storage/common/buffercache/BufferCache.java
@@ -357,6 +357,10 @@
pageReplacementStrategy.notifyCachePageReset(this);
}
+ public void invalidate() {
+ reset(-1);
+ }
+
@Override
public ByteBuffer getBuffer() {
return buffer;
@@ -503,12 +507,12 @@
if (fInfo == null) {
String fileName = fileMapManager.lookupFileName(fileId);
try {
- File f = new File(fileName);
- if(!f.exists()) {
- File dir = new File(f.getParent());
- dir.mkdirs();
+ File f = new File(fileName);
+ if (!f.exists()) {
+ File dir = new File(f.getParent());
+ dir.mkdirs();
}
- fInfo = new FileHandle(fileId, new RandomAccessFile(f, "rw"));
+ fInfo = new FileHandle(fileId, new RandomAccessFile(f, "rw"));
} catch (IOException e) {
throw new HyracksDataException(e);
}
@@ -557,11 +561,10 @@
cPage.dirty.set(false);
cPage.pinCount.decrementAndGet();
}
- System.err.println("PinCount: " + cPage.pinCount.get());
if (cPage.pinCount.get() != 0) {
throw new IllegalStateException("Page is pinned and file is being closed");
}
- cPage.valid = false;
+ cPage.invalidate();
return true;
}
return false;