db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject svn commit: r1535408 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/iapi/services/i18n/ java/engine/org/apache/derby/impl/store/raw/data/ java/engine/org/apache/derby/loc/ java/shared/org/apache/derby/shared/common/reference/
Date Thu, 24 Oct 2013 15:16:47 GMT
Author: mikem
Date: Thu Oct 24 15:16:46 2013
New Revision: 1535408

URL: http://svn.apache.org/r1535408
Log:
DERBY-6320 Log a page dump to derby.log if ERROR nospc: nospc.U is returned to the user

backported change #1535206 from 10.10 to 10.8 branch, merge was clean.

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/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/store/raw/data/StoredPage.java
    db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/MessageId.java
    db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1535075
  Merged /db/derby/code/branches/10.10:r1535206

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java?rev=1535408&r1=1535407&r2=1535408&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/iapi/services/i18n/MessageService.java
Thu Oct 24 15:16:46 2013
@@ -81,6 +81,14 @@ public final class MessageService {
         return getCompleteMessage(messageID, new Object[]{a1, a2, a3, a4, a5});
     }
 
+    // 14 arg message
+    //     note that new vararg JAVA syntax is used in releases after 10.10, 
+    //     so not going to add 6 arg through 13 arg versions in these old 
+    //     releases, unless actually needed.
+    public static String getTextMessage(String messageID, Object a1, Object a2, Object a3,
Object a4, Object a5, Object a6, Object a7, Object a8, Object a9, Object a10, Object a11,
Object a12, Object a13, Object a14) {
+        return getCompleteMessage(messageID, new Object[]{a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14});
+    }
+
 	/**
 	  Transform the message from messageID to the actual error, warning, or
 	  info message using the correct locale.

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=1535408&r1=1535407&r2=1535408&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 15:16:46 2013
@@ -32,7 +32,9 @@ 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.i18n.MessageService;
 import org.apache.derby.iapi.services.io.ArrayInputStream;
 import org.apache.derby.iapi.services.io.ArrayOutputStream;
 import org.apache.derby.iapi.services.io.CompressedNumber;
@@ -8185,6 +8187,27 @@ public class StoredPage extends CachedPa
         }
     }
 
+    String getPageDumpString()
+    {
+        return(
+            MessageService.getTextMessage(
+                MessageId.STORE_PAGE_DUMP,
+                getIdentity(),
+                new Boolean(isOverflowPage),
+                new Long(getPageVersion()),
+                new Integer(slotsInUse),
+                new Integer(deletedRowCount),
+                new Integer(getPageStatus()),
+                new Integer(nextId),
+                new Integer(firstFreeByte),
+                new Integer(freeSpace),
+                new Integer(totalSpace),
+                new Integer(spareSpace),
+                new Integer(minimumRecordSize),
+                new Integer(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(),
+                                new Integer(slot),
+                                new Integer(id),
+                                validColumns.toString(),
+                                new Integer(realStartColumn),
+                                new Integer(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(),
+                                new Integer(slot),
+                                new Integer(id),
+                                newColumnList.toString(),
+                                new Integer(nextColumn),
+                                new Integer(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/branches/10.8/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml?rev=1535408&r1=1535407&r2=1535408&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/loc/messages.xml Thu Oct 24 15:16:46
2013
@@ -5559,6 +5559,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>
 
 
@@ -7628,6 +7642,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/branches/10.8/java/shared/org/apache/derby/shared/common/reference/MessageId.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/MessageId.java?rev=1535408&r1=1535407&r2=1535408&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/MessageId.java
(original)
+++ db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/MessageId.java
Thu Oct 24 15:16:46 2013
@@ -87,13 +87,14 @@ 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
+
     String STORE_BOOT_READONLY_MSG          = "D014";
     /**
      * 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/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=1535408&r1=1535407&r2=1535408&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/branches/10.8/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Thu Oct 24 15:16:46 2013
@@ -488,6 +488,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