You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ba...@apache.org on 2005/06/03 19:02:25 UTC

svn commit: r179834 - in /incubator/derby/code/trunk/java: engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall

Author: bandaram
Date: Fri Jun  3 10:02:23 2005
New Revision: 179834

URL: http://svn.apache.org/viewcvs?rev=179834&view=rev
Log:
Derby-230: Handle the case of someone else creating a schema from the time we check if it exists to creating it if not.

Submitted by Oystein Grovlen.(Oystein.Grovlen@Sun.COM)

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java?rev=179834&r1=179833&r2=179834&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DDLConstantAction.java Fri Jun  3 10:02:23 2005
@@ -136,9 +136,21 @@
 		SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, tc, false);
 
 		if (sd == null || sd.getUUID() == null) {
-			ConstantAction csca = new CreateSchemaConstantAction(schemaName, (String) null);
-			csca.executeConstantAction(activation);
+            ConstantAction csca 
+                = new CreateSchemaConstantAction(schemaName, (String) null);
 
+            try {
+                csca.executeConstantAction(activation);
+            } catch (StandardException se) {
+                if (se.getMessageId()
+                    .equals(SQLState.LANG_OBJECT_ALREADY_EXISTS)) {
+                    // Ignore "Schema already exists". Another thread has 
+                    // probably created it after we checked for it
+                } else {
+                    throw se;
+                }
+            }
+            
 			sd = dd.getSchemaDescriptor(schemaName, tc, true);
 		}
 

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall?rev=179834&r1=179833&r2=179834&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall Fri Jun  3 10:02:23 2005
@@ -3,6 +3,7 @@
 jdbcapi/odbc_metadata.java
 lang/AIjdbc.java
 lang/CharUTF8.java
+lang/ConcurrentImplicitCreateSchema.java
 lang/DB2IsolationLevels.sql
 lang/LOB.sql
 lang/LOBDB2compatibility.sql

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall?rev=179834&r1=179833&r2=179834&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall Fri Jun  3 10:02:23 2005
@@ -28,6 +28,7 @@
 jdbcapi/savepointJdbc30.java
 lang/big.sql
 lang/bug5054.java
+lang/ConcurrentImplicitCreateSchema.java
 lang/forupdate.sql
 lang/holdCursorIJ.sql
 lang/holdCursorJavaReflection.java