db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r1535576 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/store/raw/data/ java/testing/org/apache/derbyTesting/functionTests/tests/store/
Date Thu, 24 Oct 2013 22:21:01 GMT
Author: mikem
Date: Thu Oct 24 22:21:01 2013
New Revision: 1535576

URL: http://svn.apache.org/r1535576
Log:
DERBY-4923 update of a long row can fail with ERROR nospc: nospc.U exception.

backport change #1535413 from trunk to 10.8 branch.

This checkin fixes the problem repro'd by the included new test, which shows
an update of an existing row in db failing with a nosp.U exception.
The problem was an off by 1 error in checking for enough space to update a row
on an overflow page to just an overflow pointer. The intent of the code is to
always reserve enough space in every overflow row to allow for this update.
In this case there was exactly enough space, but the code mistaken thought it
needed 1 more byte.


Added:
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby4923Test.java
      - copied unchanged from r1535413, db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/Derby4923Test.java
Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
    db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1535413

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java?rev=1535576&r1=1535575&r2=1535576&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
Thu Oct 24 22:21:01 2013
@@ -4147,8 +4147,20 @@ public class StoredPage extends CachedPa
                 {
                     // The current row has filled the page.
 
-                    if (spaceAvailable <= OVERFLOW_POINTER_SIZE) 
+                    if (spaceAvailable < OVERFLOW_POINTER_SIZE) 
                     {
+                        // DERBY-4923 
+                        // The fix for DERBY-4923 was to change the above
+                        // check from <= to <.  The test case for DERBY-4923
+                        // got the system into a state where it needed to
+                        // exactly write an overflow field pointer and it
+                        // had exactly OVERFLOW_POINTER_SIZE spaceAvailable,
+                        // but was off by one in its check.
+                        // The system insures all rows on an overflow page
+                        // have at least OVERFLOW_POINTER_SIZE, so updating
+                        // them should check for exactly OVERFLOW_POINTER_SIZE
+                        // not <=.
+
                         if ((i == startColumn) || 
                             (lastColumnPositionAllowOverflow < 0))  
                         {
@@ -4174,6 +4186,12 @@ public class StoredPage extends CachedPa
                                             lastColumnPositionAllowOverflow +
                                         "; spaceAvailable = " + 
                                             spaceAvailable +
+                                        "; lastSpaceAvailable = " + 
+                                            lastSpaceAvailable +
+                                        "; insertFlag = " + 
+                                            insertFlag +
+                                        "; Page.INSERT_FOR_SPLIT = " + 
+                                            Page.INSERT_FOR_SPLIT +
                                         "; isOverflowPage() = " + 
                                             isOverflowPage() +
                                         "; OVERFLOW_POINTER_SIZE = " + 

Modified: db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=1535576&r1=1535575&r2=1535576&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
(original)
+++ db/derby/code/branches/10.8/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
Thu Oct 24 22:21:01 2013
@@ -80,6 +80,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(BTreeMaxScanTest.suite());
         suite.addTest(MadhareTest.suite());
         suite.addTest(ServicePropertiesFileTest.suite());
+        suite.addTest(Derby4923Test.suite());
 
         /* Tests that only run in sane builds */
         if (SanityManager.DEBUG) {



Mime
View raw message