db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r749656 - in /db/derby/code/branches/10.4/java: engine/org/apache/derby/impl/store/raw/log/LogToFile.java engine/org/apache/derby/loc/messages.xml shared/org/apache/derby/shared/common/reference/MessageId.java
Date Tue, 03 Mar 2009 17:00:34 GMT
Author: kmarsden
Date: Tue Mar  3 17:00:33 2009
New Revision: 749656

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


Modified:
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/branches/10.4/java/shared/org/apache/derby/shared/common/reference/MessageId.java

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java?rev=749656&r1=749655&r2=749656&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Tue Mar  3 17:00:33 2009
@@ -978,7 +978,7 @@
 							logFile = getLogFileName(++logFileNumber);
 						}
 					}
-
+					IOException accessException = null;
 					try
 					{
                         theLog =   privRandomAccessFile(logFile, "rw");
@@ -986,6 +986,7 @@
 					catch (IOException ioe)
 					{
 						theLog = null;
+						accessException = ioe;
 					}
 
                     if (theLog == null || !privCanWrite(logFile))
@@ -994,7 +995,9 @@
 							theLog.close();
 
 						theLog = null;
-
+						Monitor.logTextMessage(MessageId.LOG_CHANGED_DB_TO_READ_ONLY);
+						if (accessException != null)
+							Monitor.logThrowable(accessException);
 						ReadOnlyDB = true;
 					}
 					else
@@ -1064,6 +1067,7 @@
 					{
 						// if datafactory doesn't think it is readonly, we can
 						// do some futher test of our own
+						IOException accessException = null;
 						try
 						{
 							if(isWriteSynced)
@@ -1074,14 +1078,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;
+											
 						}
 					}
 
@@ -3335,6 +3343,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.4/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/loc/messages.xml?rev=749656&r1=749655&r2=749656&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/loc/messages.xml Tue Mar  3 17:00:33
2009
@@ -7681,7 +7681,11 @@
                 <arg>testModeProperty</arg>
                 <arg>testMode</arg>
             </msg>
-
+            <msg>
+               <name>L022</name>
+               <text>WARNING: Due to a permissions issue accessing the log files, the
status of the database has been changed to read only. 
+               </text>
+           </msg>
         </family>
 
 

Modified: db/derby/code/branches/10.4/java/shared/org/apache/derby/shared/common/reference/MessageId.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/shared/org/apache/derby/shared/common/reference/MessageId.java?rev=749656&r1=749655&r2=749656&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/shared/org/apache/derby/shared/common/reference/MessageId.java
(original)
+++ db/derby/code/branches/10.4/java/shared/org/apache/derby/shared/common/reference/MessageId.java
Tue Mar  3 17:00:33 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