You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by na...@apache.org on 2008/11/10 16:54:38 UTC
svn commit: r712683 -
/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java
Author: natalia
Date: Mon Nov 10 07:54:38 2008
New Revision: 712683
URL: http://svn.apache.org/viewvc?rev=712683&view=rev
Log:
Do not read page from disk when getting new free page
Modified:
xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java
Modified: xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java?rev=712683&r1=712682&r2=712683&view=diff
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/core/filer/Paged.java Mon Nov 10 07:54:38 2008
@@ -338,6 +338,14 @@
* @throws IOException if an Exception occurs
*/
protected final Page getPage(long pageNum) throws IOException {
+ Page p = updateIdentityMap(pageNum);
+
+ // Load the page from disk if necessary
+ p.read();
+ return p;
+ }
+
+ private Page updateIdentityMap(long pageNum) {
final PageKey k = new PageKey(pageNum);
Page p = null;
synchronized (pagesLock) {
@@ -357,8 +365,6 @@
}
}
- // Load the page from disk if necessary
- p.read();
return p;
}
@@ -544,7 +550,12 @@
if (p == null) {
// No deleted pages, grow the file
- p = getPage(fileHeader.incTotalCount());
+ p = updateIdentityMap(fileHeader.incTotalCount());
+
+ // initialize page
+ p.data = new byte[fileHeader.pageSize];
+ p.keyPos = fileHeader.pageHeaderSize;
+ p.dataPos = p.keyPos + p.header.keyLen;
}
// Initialize The Page Header (Cleanly)