db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r785828 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java
Date Wed, 17 Jun 2009 21:59:36 GMT
Author: kahatlen
Date: Wed Jun 17 21:59:36 2009
New Revision: 785828

URL: http://svn.apache.org/viewvc?rev=785828&view=rev
Log:
DERBY-4274: SYSCS_UPDATE_STATISTICS takes unnecessary table lock

Merged fix from trunk (revision 785570).

Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 17 21:59:36 2009
@@ -1 +1 @@
-/db/derby/code/trunk:772090,772449,772534,774281,779681,782991,785163,785662
+/db/derby/code/trunk:772090,772449,772534,774281,779681,782991,785163,785570,785662

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java?rev=785828&r1=785827&r2=785828&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/execute/AlterTableConstantAction.java
Wed Jun 17 21:59:36 2009
@@ -322,6 +322,7 @@
 		if (updateStatistics)
 		{
 			updateStatistics(activation);
+            return;
 		}
 		/*
 		** Inform the data dictionary that we are about to write to it.

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java?rev=785828&r1=785827&r2=785828&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UpdateStatisticsTest.java
Wed Jun 17 21:59:36 2009
@@ -21,6 +21,7 @@
 
 package org.apache.derbyTesting.functionTests.tests.lang;
 
+import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Statement;
@@ -173,4 +174,29 @@
         //End of test case for better index selection after statistics
         //availability
     }
+
+    /**
+     * Test that SYSCS_UPDATE_STATISTICS doesn't obtain exclusive locks on
+     * the table or rows in the table (DERBY-4274).
+     */
+    public void testNoExclusiveLockOnTable() throws SQLException {
+        Statement s = createStatement();
+        s.execute("create table t (x char(1))");
+        s.execute("create index ti on t(x)");
+        s.execute("insert into t values 'a','b','c','d'");
+
+        setAutoCommit(false);
+        s.execute("lock table t in share mode");
+
+        Connection c2 = openDefaultConnection();
+        Statement s2 = c2.createStatement();
+        // This call used to time out because SYSCS_UPDATE_STATISTICS tried
+        // to lock T exclusively.
+        s2.execute("call syscs_util.syscs_update_statistics('APP', 'T', null)");
+        s2.close();
+        c2.close();
+
+        s.execute("drop table t");
+        commit();
+    }
 }



Mime
View raw message