You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Øystein Grøvlen (JIRA)" <de...@db.apache.org> on 2005/05/03 15:44:05 UTC

[jira] Commented: (DERBY-230) "Schema already exists" when creating a table

     [ http://issues.apache.org/jira/browse/DERBY-230?page=comments#action_64351 ]
     
Øystein Grøvlen commented on DERBY-230:
---------------------------------------

According to Dan Debrunner alternative 1 is not correct since there are other ways schemas come into existence than through this method.  Hence, I will fix this as suggested in the second alternative by catching exceptions with messageId == SQLState.LANG_OBJECT_ALREADY_EXISTS.  

> "Schema already exists" when creating a table
> ---------------------------------------------
>
>          Key: DERBY-230
>          URL: http://issues.apache.org/jira/browse/DERBY-230
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.0.2.1, 10.0.2.0, 10.0.2.2, 10.1.0.0
>     Reporter: Øystein Grøvlen
>     Assignee: Øystein Grøvlen
>     Priority: Minor
>  Attachments: Main.java
>
> When running a multithreaded program where several threads in parallell create tables in a schema that is not explicitly created, one often get the following exception:
> ERROR X0Y68: Schema 'TESTSCHEMA' already exists.
>     at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:322)
>     at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.duplicateDescriptorException(DataDictionaryImpl.java:1512)
>     at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptorNow(DataDictionaryImpl.java:1496)
>     at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptor(DataDictionaryImpl.java:1478)
>     at org.apache.derby.impl.sql.execute.CreateSchemaConstantAction.executeConstantAction(CreateSchemaConstantAction.java:147)
>     at org.apache.derby.impl.sql.execute.DDLConstantAction.getSchemaDescriptorForCreate(Unknown Source)
>     at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(CreateTableConstantAction.java:213)
>     at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
>     at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1108)
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:475)
>     at derbytest.Main$CreateTable.run(Main.java:42)
>     at java.lang.Thread.run(Thread.java:595)
> A program that reproduces this bug will be attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by Daniel John Debrunner <dj...@debrunners.com>.
Øystein Grøvlen (JIRA) wrote:

>      [ http://issues.apache.org/jira/browse/DERBY-230?page=comments#action_64351 ]
>      
> Øystein Grøvlen commented on DERBY-230:
> ---------------------------------------
> 
> [skip>
> second alternative by catching exceptions with messageId ==
SQLState.LANG_OBJECT_ALREADY_EXISTS.

Using equals() of course :-)

Dan.



Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by "Lance J. Andersen" <La...@Sun.COM>.

Myrna van Lunteren wrote:

>correct. Actually, you don't have to build derbyTesting.jar - the
>*.out files are all copied into the classes directory - but only when
>you build (ant all).
>
>So, the steps are: 
>- run the new test
>- copy the .out to the master directory - (this is where it lives in
>the subversion source tree)
>- build (ant all) so the test files - including the .out files and any
>other relevant supporting files go to the classes dir
>  
>
Yes i noticed that the *.out was copied to classes as well.  I didnt 
think to change my CLASSPATH to run the tests from the classes directory.

Perhaps we should provide instructions for running the tests using the 
classes directory as well in the README

>- If you want to run the test using the jars, use the ant buildjars
>target & all required testing files are pulled from the classes dir
>into the derbyTesting.jar.
>
>I'll look at making this more obvious in the testing README some time soon.
>Or someone else can, of course.
>
>Myrna
>
>On 5/6/05, Lance J. Andersen <La...@sun.com> wrote:
>  
>
>>I believe that is the key and I discovered that myself the other day.  The
>>master *.outs are included  in the derbyingTesting.jar
>>
>>
>>Mamta Satoor wrote:
>>Hi,
>>    
>>
>
>Did you do a build again after copying the .out file to the master
>  
>
>>directory?
>>    
>>
>
>Mamta
>
>On 5/6/05, �ystein Gr�vlen <Oy...@sun.com>
>  
>
>>wrote:
>>    
>>
> 
>  
>
>>
>>"DVC" == David Van Couvering <Da...@Sun.COM> writes:
>>    
>>
> 
>  
>
>> DVC> I'm stil learning this harness, but I am pretty sure you can run any
>>DVC> program with a main() that you want from within the test harness, just
>>DVC> by adding the .java file to functionTests/tests. I don't think the
>>DVC> harness has any restrctions on this main() program being
>>    
>>
> DVC>
>  
>
>>multi-threaded or single-threaded.
>>    
>>
>
>I guess I must have misunderstood
>  
>
>>something. I thought that I had read
>>    
>>
>on this mailing list that the ordinary
>  
>
>>testing framework did not
>>    
>>
>support multithreaded tests.
>
>Anyway, I have now
>  
>
>>transformed my program into a test. However, when
>>    
>>
>I run it using RunTest, I
>  
>
>>get "No master file was found" even after I
>>    
>>
>copied the .out file to the
>  
>
>>master directory. Do I have to set some
>>    
>>
>property in order for the test to
>  
>
>>find the master file? I was not
>>    
>>
>able to find anything about this in the
>  
>
>>testing README file.
>>    
>>
>
>--
>�ystein
>
> 
>  
>
> 
>>
>  
>

Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by Myrna van Lunteren <m....@gmail.com>.
correct. Actually, you don't have to build derbyTesting.jar - the
*.out files are all copied into the classes directory - but only when
you build (ant all).

So, the steps are: 
- run the new test
- copy the .out to the master directory - (this is where it lives in
the subversion source tree)
- build (ant all) so the test files - including the .out files and any
other relevant supporting files go to the classes dir
- If you want to run the test using the jars, use the ant buildjars
target & all required testing files are pulled from the classes dir
into the derbyTesting.jar.

I'll look at making this more obvious in the testing README some time soon.
Or someone else can, of course.

Myrna

On 5/6/05, Lance J. Andersen <La...@sun.com> wrote:
> I believe that is the key and I discovered that myself the other day.  The
> master *.outs are included  in the derbyingTesting.jar
> 
> 
> Mamta Satoor wrote:
> Hi,

Did you do a build again after copying the .out file to the master
> directory?

Mamta

On 5/6/05, Øystein Grøvlen <Oy...@sun.com>
> wrote:
 
> 
> 
> 
> "DVC" == David Van Couvering <Da...@Sun.COM> writes:
 
>  DVC> I'm stil learning this harness, but I am pretty sure you can run any
> DVC> program with a main() that you want from within the test harness, just
> DVC> by adding the .java file to functionTests/tests. I don't think the
> DVC> harness has any restrctions on this main() program being
 DVC>
> multi-threaded or single-threaded.

I guess I must have misunderstood
> something. I thought that I had read
on this mailing list that the ordinary
> testing framework did not
support multithreaded tests.

Anyway, I have now
> transformed my program into a test. However, when
I run it using RunTest, I
> get "No master file was found" even after I
copied the .out file to the
> master directory. Do I have to set some
property in order for the test to
> find the master file? I was not
able to find anything about this in the
> testing README file.

--
Øystein

 
> >
 
>

Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by "Lance J. Andersen" <La...@Sun.COM>.
I believe that is the key and I discovered that myself the other day.  
The master *.outs are included  in the derbyingTesting.jar

Mamta Satoor wrote:

>Hi,
>
>Did you do a build again after copying the .out file to the master directory?
>
>Mamta
>
>On 5/6/05, �ystein Gr�vlen <Oy...@sun.com> wrote:
>  
>
>>>>>>>"DVC" == David Van Couvering <Da...@Sun.COM> writes:
>>>>>>>              
>>>>>>>
>>   DVC> I'm stil learning  this harness, but I am pretty sure  you can run any
>>   DVC> program with a main() that you want from within the test harness, just
>>   DVC> by adding  the .java file  to functionTests/tests. I don't  think the
>>   DVC> harness   has   any  restrctions   on   this   main()  program   being
>>   DVC> multi-threaded or single-threaded.
>>
>>I guess I must have misunderstood something. I thought that I had read
>>on this mailing list that the ordinary testing framework did not
>>support multithreaded tests.
>>
>>Anyway, I have now transformed my program into a test.  However, when
>>I run it using RunTest, I get "No master file was found" even after I
>>copied the .out file to the master directory.  Do I have to set some
>>property in order for the test to find the master file?  I was not
>>able to find anything about this in the testing README file.
>>
>>--
>>�ystein
>>
>>    
>>
>>
>  
>

Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by Mamta Satoor <ms...@gmail.com>.
Hi,

Did you do a build again after copying the .out file to the master directory?

Mamta

On 5/6/05, Øystein Grøvlen <Oy...@sun.com> wrote:
> >>>>> "DVC" == David Van Couvering <Da...@Sun.COM> writes:
> 
>    DVC> I'm stil learning  this harness, but I am pretty sure  you can run any
>    DVC> program with a main() that you want from within the test harness, just
>    DVC> by adding  the .java file  to functionTests/tests. I don't  think the
>    DVC> harness   has   any  restrctions   on   this   main()  program   being
>    DVC> multi-threaded or single-threaded.
> 
> I guess I must have misunderstood something. I thought that I had read
> on this mailing list that the ordinary testing framework did not
> support multithreaded tests.
> 
> Anyway, I have now transformed my program into a test.  However, when
> I run it using RunTest, I get "No master file was found" even after I
> copied the .out file to the master directory.  Do I have to set some
> property in order for the test to find the master file?  I was not
> able to find anything about this in the testing README file.
> 
> --
> Øystein
> 
>

Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by David Van Couvering <Da...@Sun.COM>.
I may have misspoken here.  I can't make the harness run the same test 
in multiple threads (something I was trying to do).  But you can run a 
single test that is multithreaded...  Sorry if I was misleading.

The master file has to be copied into the classes hierarchy.  To do 
this, run the main ant target from java/testing and it will be copied over.

David

Øystein Grøvlen wrote:

>>>>>>"DVC" == David Van Couvering <Da...@Sun.COM> writes:
> 
> 
>     DVC> I'm stil learning  this harness, but I am pretty sure  you can run any
>     DVC> program with a main() that you want from within the test harness, just
>     DVC> by adding  the .java file  to functionTests/tests. I don't  think the
>     DVC> harness   has   any  restrctions   on   this   main()  program   being
>     DVC> multi-threaded or single-threaded.
> 
> I guess I must have misunderstood something. I thought that I had read
> on this mailing list that the ordinary testing framework did not
> support multithreaded tests.
> 
> Anyway, I have now transformed my program into a test.  However, when
> I run it using RunTest, I get "No master file was found" even after I
> copied the .out file to the master directory.  Do I have to set some
> property in order for the test to find the master file?  I was not
> able to find anything about this in the testing README file.
> 

Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by Øystein Grøvlen <Oy...@Sun.COM>.
>>>>> "DVC" == David Van Couvering <Da...@Sun.COM> writes:

    DVC> I'm stil learning  this harness, but I am pretty sure  you can run any
    DVC> program with a main() that you want from within the test harness, just
    DVC> by adding  the .java file  to functionTests/tests. I don't  think the
    DVC> harness   has   any  restrctions   on   this   main()  program   being
    DVC> multi-threaded or single-threaded.

I guess I must have misunderstood something. I thought that I had read
on this mailing list that the ordinary testing framework did not
support multithreaded tests.

Anyway, I have now transformed my program into a test.  However, when
I run it using RunTest, I get "No master file was found" even after I
copied the .out file to the master directory.  Do I have to set some
property in order for the test to find the master file?  I was not
able to find anything about this in the testing README file.

-- 
Øystein


Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by David Van Couvering <Da...@Sun.COM>.
I'm stil learning this harness, but I am pretty sure you can run any 
program with a main() that you want from within the test harness, just 
by adding the .java file to functionTests/tests.  I don't think the 
harness has any restrctions on this main() program being multi-threaded 
or single-threaded.

David

Øystein Grøvlen wrote:

> I was thinking I should add a test for this bug fix.  Since a
> multithreaded program is needed, I was trying to use the MultiTest
> framework, but despite trying several approaches I have not been able
> to reproduce it that way.  Note that I in 20 minutes was able to write
> the Java program that is attached to the jira entry.  This programs
> will reproduce the bug in approx. 1 of 3 runs (each run takes less
> than 10 seconds).
> 
> Is there any way to add a multi-threaded program to the testsuite?
> 
> In my opinion, the MultiTest framework is not very suited for
> reproducing bugs or testing specific concurrency
> mechanisms/algorithms/protocols.  You have no control of what is
> executing concurrently and just has to rely on that the scenario you
> are looking for will happen by accident if run long enough.  That does
> not make the testing very efficient.
> 
> --
> Øystein
> 
> 
>>>>>>"ØG(" == Øystein Grøvlen (JIRA) <de...@db.apache.org> writes:
> 
> 
>     >> "Schema already exists" when creating a table
>     >> ---------------------------------------------
>     >> 
>     >> Key: DERBY-230
>     >> URL: http://issues.apache.org/jira/browse/DERBY-230
>     >> Project: Derby
>     >> Type: Bug
>     >> Components: SQL
>     >> Versions: 10.0.2.1, 10.0.2.0, 10.0.2.2, 10.1.0.0
>     >> Reporter: Øystein Grøvlen
>     >> Assignee: Øystein Grøvlen
>     >> Priority: Minor
>     >> Attachments: Main.java
>     >> 
>     >> When running a multithreaded program where several threads in parallell create tables in a schema that is not explicitly created, one often get the following exception:
>     >> ERROR X0Y68: Schema 'TESTSCHEMA' already exists.
>     >> at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:322)
>     >> at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.duplicateDescriptorException(DataDictionaryImpl.java:1512)
>     >> at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptorNow(DataDictionaryImpl.java:1496)
>     >> at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptor(DataDictionaryImpl.java:1478)
>     >> at org.apache.derby.impl.sql.execute.CreateSchemaConstantAction.executeConstantAction(CreateSchemaConstantAction.java:147)
>     >> at org.apache.derby.impl.sql.execute.DDLConstantAction.getSchemaDescriptorForCreate(Unknown Source)
>     >> at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(CreateTableConstantAction.java:213)
>     >> at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
>     >> at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
>     >> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1108)
>     >> at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
>     >> at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:475)
>     >> at derbytest.Main$CreateTable.run(Main.java:42)
>     >> at java.lang.Thread.run(Thread.java:595)
>     >> A program that reproduces this bug will be attached.
> 
>     ØG(> -- 
>     ØG(> This message is automatically generated by JIRA.
>     ØG(> -
>     ØG(> If you think it was sent incorrectly contact one of the administrators:
>     ØG(>    http://issues.apache.org/jira/secure/Administrators.jspa
>     ØG(> -
>     ØG(> For more information on JIRA, see:
>     ØG(>    http://www.atlassian.com/software/jira
> 
> 
> 
> 

Re: [jira] Commented: (DERBY-230) "Schema already exists" when creating a table

Posted by Øystein Grøvlen <Oy...@Sun.COM>.
I was thinking I should add a test for this bug fix.  Since a
multithreaded program is needed, I was trying to use the MultiTest
framework, but despite trying several approaches I have not been able
to reproduce it that way.  Note that I in 20 minutes was able to write
the Java program that is attached to the jira entry.  This programs
will reproduce the bug in approx. 1 of 3 runs (each run takes less
than 10 seconds).

Is there any way to add a multi-threaded program to the testsuite?

In my opinion, the MultiTest framework is not very suited for
reproducing bugs or testing specific concurrency
mechanisms/algorithms/protocols.  You have no control of what is
executing concurrently and just has to rely on that the scenario you
are looking for will happen by accident if run long enough.  That does
not make the testing very efficient.

--
Øystein

>>>>> "ØG(" == Øystein Grøvlen (JIRA) <de...@db.apache.org> writes:

    >> "Schema already exists" when creating a table
    >> ---------------------------------------------
    >> 
    >> Key: DERBY-230
    >> URL: http://issues.apache.org/jira/browse/DERBY-230
    >> Project: Derby
    >> Type: Bug
    >> Components: SQL
    >> Versions: 10.0.2.1, 10.0.2.0, 10.0.2.2, 10.1.0.0
    >> Reporter: Øystein Grøvlen
    >> Assignee: Øystein Grøvlen
    >> Priority: Minor
    >> Attachments: Main.java
    >> 
    >> When running a multithreaded program where several threads in parallell create tables in a schema that is not explicitly created, one often get the following exception:
    >> ERROR X0Y68: Schema 'TESTSCHEMA' already exists.
    >> at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:322)
    >> at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.duplicateDescriptorException(DataDictionaryImpl.java:1512)
    >> at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptorNow(DataDictionaryImpl.java:1496)
    >> at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.addDescriptor(DataDictionaryImpl.java:1478)
    >> at org.apache.derby.impl.sql.execute.CreateSchemaConstantAction.executeConstantAction(CreateSchemaConstantAction.java:147)
    >> at org.apache.derby.impl.sql.execute.DDLConstantAction.getSchemaDescriptorForCreate(Unknown Source)
    >> at org.apache.derby.impl.sql.execute.CreateTableConstantAction.executeConstantAction(CreateTableConstantAction.java:213)
    >> at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
    >> at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
    >> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1108)
    >> at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:517)
    >> at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:475)
    >> at derbytest.Main$CreateTable.run(Main.java:42)
    >> at java.lang.Thread.run(Thread.java:595)
    >> A program that reproduces this bug will be attached.

    ØG(> -- 
    ØG(> This message is automatically generated by JIRA.
    ØG(> -
    ØG(> If you think it was sent incorrectly contact one of the administrators:
    ØG(>    http://issues.apache.org/jira/secure/Administrators.jspa
    ØG(> -
    ØG(> For more information on JIRA, see:
    ØG(>    http://www.atlassian.com/software/jira




-- 
Øystein