db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r671567 - in /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data: FileContainer.java RAFContainer.java
Date Wed, 25 Jun 2008 14:34:00 GMT
Author: kahatlen
Date: Wed Jun 25 07:33:59 2008
New Revision: 671567

URL: http://svn.apache.org/viewvc?rev=671567&view=rev
Log:
DERBY-3726: Don't call RAFContainer.padFile() from instances of RAFContainer4

Merged from trunk (revision 670534).

Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java?rev=671567&r1=671566&r2=671567&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/FileContainer.java
Wed Jun 25 07:33:59 2008
@@ -914,23 +914,18 @@
 	/**
 		Get an embryonic page from the dataInput stream.
 
-		If fileData is not null, then the embyronic page will be read 
+		The embryonic page will be read
 		in from the input stream (fileData), which is assumed to be 
 		positioned at the beginning of the first allocation page.
 
-		if fileData is null, then just manufacture an array which
-		is the size of an embryonic page.
-
 		@exception IOException error in read the embryonic page from file
 	*/
 	protected byte[] getEmbryonicPage(DataInput fileData) throws IOException
 	{
 		byte[] epage = new byte[AllocPage.MAX_BORROWED_SPACE];
 
-		if (fileData != null)
-		{
-			fileData.readFully(epage);
-		}
+		fileData.readFully(epage);
+
 		return epage;
 	}
 

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java?rev=671567&r1=671566&r2=671567&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java
Wed Jun 25 07:33:59 2008
@@ -675,7 +675,18 @@
 		if (create)
 		{
 			// the file doesn't exist yet, get an embryonic page buffer
-			epage = getEmbryonicPage((DataInput)null); 
+
+            // Allocating AllocPage.MAX_BORROWED_SPACE bytes for the
+            // embryonic page should be enough, but we want to leave
+            // the end of the file at a page boundary. This is to work
+            // around bugs in the EPOC jvm where a seek beyond the end
+            // of a file does not throw an exception but just moves
+            // the offset to the end of the file. This only occurs
+            // when the second page is written after the header has
+            // been written, ending up with the page at the incorrect
+            // offset.
+
+            epage = new byte[pageSize];
 		}
 		else
 		{
@@ -686,16 +697,6 @@
 
 		writeHeader(file, create, epage);
 
-		// leave the end of the file at a page boundry. This
-		// is to work around bugs in the EPOC jvm where a seek
-		// beyond the end of a file does not throw an exception
-		// but just moves the offset to the end of the file. This only
-		// occurs when the second page is written after the header has
-		// been written, ending up with the page at the incorrect offset.
-		if (create) {
-			padFile(file, pageSize);
-		}
-
 		if (syncFile)
 		{
 			dataFactory.writeInProgress();
@@ -710,8 +711,6 @@
 				dataFactory.writeFinished();
 			}
 		}
-
-		epage = null;
 	}
 
 	/**



Mime
View raw message