Table exists in same JVM after Derby is shutdown
Hello, all: While executing a bunch of JUnit tests within the same JVM (all executed by IntelliJ IDEA) I started seeing strange and unexpected errors occurring . Upon closer inspection, I noticed that in many of those tests tables with the same names are attempted to be created. Then I realized that although Derby is shutdown and then re-created, the tables remain, thus causing collisions. I've created a digest (attached) which is executed as one JUnit test to illustrate what I'm seeing. The behavior I would expect is that once Derby is shutdown, no tables would remain in the JVM, and if a database (with the same name) is re-created, it would be a tabula rasa. Can you please let me know whether my expectations are erroneous and whether I should find workarounds (albeit trivial to implement). However, what would concern me in that case is that the tables and the data remain in the JVM, thus consuming memory (and, if unused, creating memory leaks). Thank you, Pavel. Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited. In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies International Limited is authorised and regulated by the Financial Services Authority. DerbyTest.java Description: Binary data
Re: Table exists in same JVM after Derby is shutdown
Pavel Bortnovskiy pbortnovs...@jefferies.com writes: Hello, all: While executing a bunch of JUnit tests within the same JVM (all executed by IntelliJ IDEA) I started seeing strange and unexpected errors occurring . Upon closer inspection, I noticed that in many of those tests tables with the same names are attempted to be created. Then I realized that although Derby is shutdown and then re-created, the tables remain, thus causing collisions. The create=true connection attribute is ignored (with a warning) if the database with the same name alrady exists. I've created a digest (attached) which is executed as one JUnit test to illustrate what I'm seeing. The behavior I would expect is that once Derby is shutdown, no tables would remain in the JVM, and if a database (with the same name) is re-created, it would be a tabula rasa. The tables are no longer in memory (or should not be unless you found a bug), but they are not erased from the disk image of the database. As per the above, one would need to explicitly delete it using OS file system tools for the data to be cleared. Some JUnit tests delete tables in TestCase#tearDown, others use singleUseDatabaseDecorator to isolate itself from the rest of the tests. The tests not necessarily very consistent in their patterns for this.. Dag Can you please let me know whether my expectations are erroneous and whether I should find workarounds (albeit trivial to implement). However, what would concern me in that case is that the tables and the data remain in the JVM, thus consuming memory (and, if unused, creating memory leaks). Thank you, Pavel. Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited. In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies International Limited is authorised and regulated by the Financial Services Authority.
Re: Table exists in same JVM after Derby is shutdown
Pavel Bortnovskiy pbortnovs...@jefferies.com writes: 1) I create an in-memory database and then a table in it. Then the database is shut down. I would expect that the shutdown effectively cleans everything up. Is it not so? Ah, I misunderstood you Pavel. Have a look here: http://wiki.apache.org/db-derby/InMemoryBackEndPrimer As you can see, you need to provide the drop=true connection attribute to wipe the data. Thanks, Dag Thanks, Pavel. From: dag.wan...@oracle.com (Dag H. Wanvik) To: Derby Discussion derby-user@db.apache.org Date: 08/05/2011 05:57 PM Subject: Re: Table exists in same JVM after Derby is shutdown Pavel Bortnovskiy pbortnovs...@jefferies.com writes: Hello, all: While executing a bunch of JUnit tests within the same JVM (all executed by IntelliJ IDEA) I started seeing strange and unexpected errors occurring . Upon closer inspection, I noticed that in many of those tests tables with the same names are attempted to be created. Then I realized that although Derby is shutdown and then re-created, the tables remain, thus causing collisions. The create=true connection attribute is ignored (with a warning) if the database with the same name alrady exists. I've created a digest (attached) which is executed as one JUnit test to illustrate what I'm seeing. The behavior I would expect is that once Derby is shutdown, no tables would remain in the JVM, and if a database (with the same name) is re-created, it would be a tabula rasa. The tables are no longer in memory (or should not be unless you found a bug), but they are not erased from the disk image of the database. As per the above, one would need to explicitly delete it using OS file system tools for the data to be cleared. Some JUnit tests delete tables in TestCase#tearDown, others use singleUseDatabaseDecorator to isolate itself from the rest of the tests. The tests not necessarily very consistent in their patterns for this.. Dag Can you please let me know whether my expectations are erroneous and whether I should find workarounds (albeit trivial to implement). However, what would concern me in that case is that the tables and the data remain in the JVM, thus consuming memory (and, if unused, creating memory leaks). Thank you, Pavel. Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited. In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies International Limited is authorised and regulated by the Financial Services Authority. Jefferies archives and monitors outgoing and incoming e-mail. The contents of this email, including any attachments, are confidential to the ordinary user of the email address to which it was addressed. If you are not the addressee of this email you may not copy, forward, disclose or otherwise use it or any part of it in any form whatsoever. This email may be produced at the request of regulators or in connection with civil litigation. Jefferies accepts no liability for any errors or omissions arising as a result of transmission. Use by other than intended recipients is prohibited. In the United Kingdom, Jefferies operates as Jefferies International Limited; registered in England: no. 1978621; registered office: Vintners Place, 68 Upper Thames Street, London EC4V 3BJ. Jefferies International Limited is authorised and regulated by the Financial Services Authority.