You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by mi...@apache.org on 2013/10/24 22:22:53 UTC

svn commit: r1535523 - in /db/derby/code/branches/10.10: ./ java/engine/org/apache/derby/impl/store/raw/data/ java/testing/org/apache/derbyTesting/functionTests/tests/store/

Author: mikem
Date: Thu Oct 24 20:22:52 2013
New Revision: 1535523

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

backport change #1535413 from trunk to 10.10 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.10/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.10/   (props changed)
    db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Reverse-merged /db/derby/code/trunk:r1534523
  Merged /db/derby/code/trunk:r1535413

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java?rev=1535523&r1=1535522&r2=1535523&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java (original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java Thu Oct 24 20:22:52 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.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java?rev=1535523&r1=1535522&r2=1535523&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java (original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/store/_Suite.java Thu Oct 24 20:22:52 2013
@@ -84,6 +84,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(Derby5234Test.suite());
         suite.addTest(KeepDisposableStatsPropertyTest.suite());
         suite.addTest(StoreScriptsTest.suite());
+        suite.addTest(Derby4923Test.suite());
 
         /* Tests that only run in sane builds */
         if (SanityManager.DEBUG) {