db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r749658 - in /db/derby/code/branches/10.2/java: engine/org/apache/derby/iapi/services/monitor/ engine/org/apache/derby/impl/store/raw/log/ engine/org/apache/derby/loc/ shared/org/apache/derby/shared/common/reference/
Date Tue, 03 Mar 2009 17:02:05 GMT
Author: kmarsden
Date: Tue Mar  3 17:02:04 2009
New Revision: 749658

URL: http://svn.apache.org/viewvc?rev=749658&view=rev
Log:
DERBY-4072 Improve error logging if we can't write to log files.


Modified:
    db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
    db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties
    db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/MessageId.java

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java?rev=749658&r1=749657&r2=749658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
(original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
Tue Mar  3 17:02:04 2009
@@ -689,6 +689,13 @@
 		getStream().println(MessageService.getTextMessage(messageID, a1, a2, a3, a4));
 	}
 
+	 /**
+	  * Logs the stack trace of the specified throwable object.
+	  */
+	public static void logThrowable(Throwable t) {
+		t.printStackTrace(getStream().getPrintWriter());
+	}
+    
 	/**
 	 *  Translate a localeDescription of the form ll[_CC[_variant]] to
 	 *  a Locale object.

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=749658&r1=749657&r2=749658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Tue Mar  3 17:02:04 2009
@@ -860,7 +860,7 @@
 							logFile = getLogFileName(++logFileNumber);
 						}
 					}
-
+					IOException accessException = null;
 					try
 					{
                         theLog =   privRandomAccessFile(logFile, "rw");
@@ -868,6 +868,7 @@
 					catch (IOException ioe)
 					{
 						theLog = null;
+						accessException = ioe;
 					}
 
                     if (theLog == null || !privCanWrite(logFile))
@@ -876,7 +877,9 @@
 							theLog.close();
 
 						theLog = null;
-
+						Monitor.logTextMessage(MessageId.LOG_CHANGED_DB_TO_READ_ONLY);
+						if (accessException != null)
+							Monitor.logThrowable(accessException);
 						ReadOnlyDB = true;
 					}
 					else
@@ -946,6 +949,7 @@
 					{
 						// if datafactory doesn't think it is readonly, we can
 						// do some futher test of our own
+						IOException accessException = null;
 						try
 						{
 							if(isWriteSynced)
@@ -956,14 +960,18 @@
 						catch (IOException ioe)
 						{
 							theLog = null;
+                            accessException = ioe;
 						}
                         if (theLog == null || !privCanWrite(logFile))
 						{
 							if (theLog != null)
 								theLog.close();
 							theLog = null;
-
+							Monitor.logTextMessage(MessageId.LOG_CHANGED_DB_TO_READ_ONLY);
+							if (accessException != null)
+								Monitor.logThrowable(accessException);	
 							ReadOnlyDB = true;
+											
 						}
 					}
 
@@ -3126,6 +3134,8 @@
 				}
 				else
 				{
+					Monitor.logTextMessage(MessageId.LOG_CHANGED_DB_TO_READ_ONLY);
+					Monitor.logThrowable(new Exception("Error writing control file"));
 					// read only database
 					ReadOnlyDB = true;
 					logOut = null;

Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties?rev=749658&r1=749657&r2=749658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/loc/messages_en.properties Tue
Mar  3 17:02:04 2009
@@ -1426,7 +1426,7 @@
 L018=System may be in a inconsistent state, missing file {0}
 L020=WARNING: The database was at least at one time booted with {0}={1}. As a result of this
mode being used, it is possible that the database may not be able to recover, committed transactions
may be lost, and the database may be in an inconsistent state. This may cause unexpected errors.\n
 L021=WARNING: The database was either previously booted or is currently booted with {0} set
to {1}. Note that this mode {0}={1} does not guarantee recoverability, and is probably what
might have caused this boot error.\n
-
+L022=WARNING: Due to a permissions issue accessing the log files, the status of the database
has been changed to read only. 
 
 # Class Manager
 C000=Wrote class {0} to file {1}. Please provide support with the file and the following
exception information: {2}

Modified: db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/MessageId.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/MessageId.java?rev=749658&r1=749657&r2=749658&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/MessageId.java
(original)
+++ db/derby/code/branches/10.2/java/shared/org/apache/derby/shared/common/reference/MessageId.java
Tue Mar  3 17:02:04 2009
@@ -63,6 +63,9 @@
     String LOG_DURABILITY_TESTMODE_NO_SYNC_ERR = "L021"; // hint that error could be because

                                                          // derby.system.durability was set
to test
 
+    String LOG_CHANGED_DB_TO_READ_ONLY        = "L022"; // a permissions error on log caused
us
+    													// to change db to read only.
+    
     /*
      * Raw Store data
      */



Mime
View raw message