db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1140583 - in /db/derby/code/branches/10.8: ./ java/engine/org/apache/derby/impl/db/ java/engine/org/apache/derby/impl/services/daemon/ java/engine/org/apache/derby/impl/sql/catalog/
Date Tue, 28 Jun 2011 13:13:46 GMT
Author: kristwaa
Date: Tue Jun 28 13:13:46 2011
New Revision: 1140583

URL: http://svn.apache.org/viewvc?rev=1140583&view=rev
Log:
DERBY-5108: Intermittent failure in AutomaticIndexStatisticsTest.testShutdownWhileScanningThenDelete
on Windows

Merged fixes 2a and 3a (revisions 1133304 and 1133317).

Modified:
    db/derby/code/branches/10.8/   (props changed)
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java
    db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java

Propchange: db/derby/code/branches/10.8/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 28 13:13:46 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.7:1061570,1061578,1082235
-/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1125305,1126358,1126468,1127825,1127883,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132860,1132928,1133741,1133752,1136371,1136397,1136844,1138201,1138787,1138795,1139449,1139451
+/db/derby/code/trunk:1063809,1088633,1091000,1091221,1091285,1092067,1092795,1094315,1094572,1094728,1096741,1096890,1097247,1097249,1097460,1097469,1097471,1101059,1101839,1102620,1102826,1103681,1103718,1103742,1125305,1126358,1126468,1127825,1127883,1129136,1129764,1129797,1130077,1130084,1130632,1130895,1131030,1131272,1132546,1132664,1132860,1132928,1133304,1133317,1133741,1133752,1136371,1136397,1136844,1138201,1138787,1138795,1139449,1139451

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java?rev=1140583&r1=1140582&r2=1140583&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/db/DatabaseContextImpl.java
Tue Jun 28 13:13:46 2011
@@ -24,6 +24,7 @@ package org.apache.derby.impl.db;
 import org.apache.derby.iapi.services.context.ContextImpl;
 import org.apache.derby.iapi.services.context.ContextManager;
 import org.apache.derby.iapi.services.context.ContextService;
+import org.apache.derby.iapi.sql.dictionary.DataDictionary;
 import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.db.Database;
 import org.apache.derby.iapi.db.DatabaseContext;
@@ -55,6 +56,20 @@ final class DatabaseContextImpl extends 
 
         popMe();
         
+        if (se.getSeverity() >= ExceptionSeverity.DATABASE_SEVERITY) {
+            // DERBY-5108: Shut down the istat daemon thread before shutting
+            // down the various modules belonging to the database. An active
+            // istat daemon thread at the time of shutdown may result in
+            // containers being reopened after the container cache has been
+            // shut down. On certain platforms, this results in database
+            // files that can't be deleted until the VM exits.
+            DataDictionary dd = db.getDataDictionary();
+            // dd is null if the db is an active slave db (replication)
+            if (dd != null) {
+                dd.disableIndexStatsRefresher();
+            }
+        }
+
         if (se.getSeverity() == ExceptionSeverity.DATABASE_SEVERITY) {
 		    ContextService.getFactory().notifyAllActiveThreads(this);
             // This may be called multiple times, but is short-circuited

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java?rev=1140583&r1=1140582&r2=1140583&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/services/daemon/IndexStatisticsDaemonImpl.java
Tue Jun 28 13:13:46 2011
@@ -1032,9 +1032,15 @@ public class IndexStatisticsDaemonImpl
         // timings[x] = [conglomId, start, end]
         StringBuffer sb = new StringBuffer("scan durations (");
         for (int i=0; i < timings.length && timings[i][0] > 0; i++) {
-            long duration = timings[i][2] - timings[i][1];
-            sb.append('c').append(timings[i][0]).append('=').append(duration).
-                    append("ms,");
+            sb.append('c').append(timings[i][0]).append('=');
+            // Handle corner-case where the scans are aborted due to the
+            // index statistics daemon being shut down under us.
+            if (timings[i][2] == 0) {
+                sb.append("ABORTED,");   
+            } else {
+                long duration = timings[i][2] - timings[i][1];
+                sb.append(duration).append("ms,");
+            }
         }
         sb.deleteCharAt(sb.length() -1).append(")");
         return sb.toString();

Modified: db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=1140583&r1=1140582&r2=1140583&view=diff
==============================================================================
--- db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/branches/10.8/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Tue Jun 28 13:13:46 2011
@@ -13764,12 +13764,13 @@ public final class	DataDictionaryImpl
 
     /** {@inheritDoc} */
     public void disableIndexStatsRefresher() {
-        indexStatsUpdateDisabled = true;
-        // NOTE: This will stop the automatic updates of index statistics,
-        //       but users can still do this explicitly (i.e. by invoking
-        //       the SYSCS_UTIL.SYSCS_UPDATE_STATISTICS system procedure).
-        // Set at boot time, we expect it to be non-null.
-        indexRefresher.stop();
+        if (!indexStatsUpdateDisabled) {
+            indexStatsUpdateDisabled = true;
+            // NOTE: This will stop the automatic updates of index statistics,
+            //       but users can still do this explicitly (i.e. by invoking
+            //       the SYSCS_UTIL.SYSCS_UPDATE_STATISTICS system procedure).
+            indexRefresher.stop();
+        }
     }
 
     /** {@inheritDoc} */



Mime
View raw message