db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r1535075 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/store/raw/data/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/
Date Wed, 23 Oct 2013 17:07:38 GMT
Author: mikem
Date: Wed Oct 23 17:07:37 2013
New Revision: 1535075

URL: http://svn.apache.org/r1535075
Log:
DERBY-6320 Log a page dump to derby.log if ERROR nospc: nospc.U is returned to the user
This patch adds the ability to dump a page in an insane build, and adds 2 calls to do so in
2 outstanding nospc error cases. In those two cases a new user
level error is thrown and nests the nospc.U error so that we still know the
original stack trace where the lowest error was thrown.  
The patch passes all tests and the specific errors were hand tested, one of 
them using the test case filed in DERBY-4923 and in the other case just by hand forcing the
codepath.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/MessageId.java
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java?rev=1535075&r1=1535074&r2=1535075&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java Wed
Oct 23 17:07:37 2013
@@ -32,6 +32,7 @@ import java.util.Arrays;
 import java.util.zip.CRC32;
 
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.MessageId;
 import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 import org.apache.derby.iapi.services.io.ArrayOutputStream;
@@ -46,6 +47,7 @@ import org.apache.derby.iapi.services.io
 import org.apache.derby.iapi.services.io.LimitObjectInput;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.StreamStorable;
+import org.apache.derby.iapi.services.i18n.MessageService;
 import org.apache.derby.shared.common.sanity.SanityManager;
 import org.apache.derby.iapi.store.access.Qualifier;
 import org.apache.derby.iapi.store.access.RowUtil;
@@ -8185,6 +8187,27 @@ public class StoredPage extends CachedPa
         }
     }
 
+    String getPageDumpString()
+    {
+        return(
+            MessageService.getTextMessage(
+                MessageId.STORE_PAGE_DUMP,
+                getIdentity(),
+                isOverflowPage,
+                getPageVersion(),
+                slotsInUse,
+                deletedRowCount,
+                getPageStatus(),
+                nextId,
+                firstFreeByte,
+                freeSpace,
+                totalSpace,
+                spareSpace,
+                minimumRecordSize,
+                getPageSize(),
+                pagedataToHexDump(pageData)));
+    }
+
     private String recordToString(int slot)
     {
         if (SanityManager.DEBUG)
@@ -8773,6 +8796,25 @@ slotScan:
                         hitLongColumn = true;
 
                     }
+                    catch (NoSpaceOnPage nsop)
+                    {
+                        // DERBY-4923
+                        //
+                        // The actionUpdate() call should not generate a 
+                        // NoSpaceOnPage error.  
+
+                        throw StandardException.newException(
+                                SQLState.DATA_UNEXPECTED_NO_SPACE_ON_PAGE,
+                                nsop,
+                                ((PageKey) curPage.getIdentity()).toString(),
+                                getPageDumpString(),
+                                slot,
+                                id,
+                                validColumns.toString(),
+                                realStartColumn,
+                                0,
+                                headRowHandle);
+                    }
 
                 } while (hitLongColumn);
 
@@ -8930,17 +8972,53 @@ slotScan:
                     // However, the insert log record do not have the head 
                     // row's page number so the rollback cannot put that
                     // information into the post commit work.
-                    RecordHandle portionHandle =
-                        op.insertAllowOverflow(
-                            0, newRow, newColumnList, nextColumn, mode, 100, 
-                            nextPortionHandle);
+
+                    RecordHandle portionHandle;
+
+                    try 
+                    {
+                        portionHandle =
+                            op.insertAllowOverflow(
+                                0, newRow, newColumnList, nextColumn, mode, 100,
+                                nextPortionHandle);
+
+                    }
+                    catch (NoSpaceOnPage nsop)
+                    {
+                        // DERBY-6319, intermittently application is getting
+                        // an unexpected NoSpaceOnPage error from the 
+                        // insertAllowOverflow() call.  The code expects that
+                        // the latched page returned by the above 
+                        // getOverflowPageForInsert() call should always have
+                        // at least enough space to insert with allowing 
+                        // overflow.
+                        // Not sure what is causing this and have not been able
+                        // to repro outside of the application, so catching the 
+                        // error and raising a new error with more information 
+                        // to be printed to the log.
+                        //
+
+                        throw StandardException.newException(
+                                SQLState.DATA_UNEXPECTED_NO_SPACE_ON_PAGE,
+                                nsop,
+                                ((PageKey) op.getIdentity()).toString(),
+                                getPageDumpString(),
+                                slot,
+                                id,
+                                newColumnList.toString(),
+                                nextColumn,
+                                mode,
+                                nextPortionHandle);
+                    }
 
                     // Update the previous record header to point to new portion
                     if (curPage == this)
                         updateOverflowDetails(this, handle, portionHandle);
                     else
                         updateOverflowDetails(handle, portionHandle);
+
                     op.unlatch();
+
                 } 
                 else 
                 {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=1535075&r1=1535074&r2=1535075&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Wed Oct 23 17:07:37
2013
@@ -5765,6 +5765,20 @@ ln=lower-case two-letter ISO-639 languag
                 <text>Internal error: page {0} attempted latched twice.</text>
                 <arg>pageNumber</arg>
             </msg>
+
+            <msg>
+                <name>XSDAP.S</name>
+                <text>Unexpected no space error while attempting to update a row on
page {0}. Values of internal fields at time of error are as follows: slot = {2}, recordId
= {3}, newColumnList = {4}, nextColumn = {5}, mode = {6}, nextPortionHandle = {7}, page dump
= {1}.</text>
+                <arg>pageId</arg>
+                <arg>pageDump</arg>
+                <arg>slot</arg>
+                <arg>recordId</arg>
+                <arg>columnList</arg>
+                <arg>nextColumn</arg>
+                <arg>updateMode</arg>
+                <arg>nextPortionHandle</arg>
+            </msg>
+
         </family>
 
 
@@ -7950,6 +7964,42 @@ Shutting down instance {0} on database d
                 <text>Could not read further because another transaction has modified
the value.</text>
             </msg>
 
+            <msg>
+                <name>D016</name>
+                <text>
+---------------------------------------------------
+page id:            {0}
+ Overflow:          {1}
+ PageVersion:       {2}
+ SlotsInUse:        {3}
+ DeletedRowCount:   {4}
+ PageStatus:        {5}
+ NextId:            {6}
+ firstFreeByte:     {7}
+ freeSpace:         {8}
+ totalSpace:        {9}
+ spareSpace:        {10}%
+ minimumRecordSize: {11}
+ PageSize:          {12}
+---------------------------------------------------
+{13}
+---------------------------------------------------</text>
+                <arg>pageId</arg>
+                <arg>overFlow</arg>
+                <arg>pageVersion</arg>
+                <arg>slotsInUse</arg>
+                <arg>deletedRowCount</arg>
+                <arg>pageStatus</arg>
+                <arg>nextId</arg>
+                <arg>firstFreeByte</arg>
+                <arg>freeSpace</arg>
+                <arg>totalSpace</arg>
+                <arg>spareSpace</arg>
+                <arg>minimumRecordSize</arg>
+                <arg>pageSize</arg>
+                <arg>hexPageDump</arg>
+            </msg>
+
         </family>
 
 

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/MessageId.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/MessageId.java?rev=1535075&r1=1535074&r2=1535075&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/MessageId.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/MessageId.java
Wed Oct 23 17:07:37 2013
@@ -88,12 +88,13 @@ public interface MessageId {
     String STORE_REMOVED_BACKUP             = "D011";
     String STORE_BACKUP_COMPLETED           = "D012";
     String STORE_DURABILITY_TESTMODE_NO_SYNC = "D013"; // for derby.system.durability is

-                                                       // set to test
+
     /**
      * When the specified overflow page isn't found while streaming from a
      * page overflow chain (large data values, typically BLOB or CLOB).
      */
     String STORE_STREAM_OVERFLOW_PAGE_NOT_FOUND = "D015";
+    String STORE_PAGE_DUMP                  = "D016";
 
 	/*
 	** ClassManager

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=1535075&r1=1535074&r2=1535075&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Wed Oct 23 17:07:37 2013
@@ -490,6 +490,7 @@ public interface SQLState {
     String DATA_SQLDATA_READ_INSTANTIATION_EXCEPTION            = "XSDAM.S";
     String DATA_SQLDATA_READ_ILLEGAL_ACCESS_EXCEPTION           = "XSDAN.S";
     String DATA_DOUBLE_LATCH_INTERNAL_ERROR                     = "XSDAO.S";
+    String DATA_UNEXPECTED_NO_SPACE_ON_PAGE                     = "XSDAP.S";
 
 	/*
 	** RawStore - Data.Generic transaction exceptions



Mime
View raw message