Dag, thanks for refering me to lowmem suite. Does this suite get run on a regular basis or is it part of the junit all suite? It will be nice to incoporate my tests in this suite but in a disabled mode at this point since they will run into OOM. Also, the minimum memory requirement for my test is 100M whereas lowmem seems to be running with 16M. Maybe i should rework the data in my test to work with 16M rather than 100M?
thanks, Mamta On Tue, Feb 16, 2010 at 1:51 PM, Dag H. Wanvik <[email protected]> wrote: > Mamta Satoor <[email protected]> writes: > > >> trying to see if I can run this with limited heap to do the insert >> ps.setBinaryStream(1, new LoopingAlphabetStream(300000*1024), >> 300000*1024); > > You shold be able to insert, yes, cf. BlobMemTest running as part of > the lowmem suite > > org.apache.derbyTesting.functionTests.tests.memory._Suite > > cf. junit-lowmem ant target. > > Dag > >> >> >> On Tue, Feb 16, 2010 at 11:54 AM, Mamta Satoor <[email protected]> wrote: >>> Yes, I just ran into it and trying it. thanks, Dag. >>> >>> On Tue, Feb 16, 2010 at 11:51 AM, Dag H. Wanvik <[email protected]> wrote: >>>> Mamta Satoor <[email protected]> writes: >>>> >>>> >>>>> Hi, >>>>> >>>>> I am working on writing a test for INSERT statement which will cause >>>>> INSERT trigger to fire. The INSERT is being done into a table with a >>>>> large BLOB column. The table definition looks as follows create table >>>>> table1 (id int, status smallint, bl blob(2G)) >>>>> >>>>> My goal is to run this INSERT statement inside a java program with a >>>>> limited heap to see if I will run into any OOMs during trigger >>>>> execution because we are trying to stream the data into memory. The >>>>> way I am trying to insert large LOB is as follows >>>>> System.out.println("Inserting into table1 to cause insert >>>>> trigger to fire"); >>>>> PreparedStatement ps = conn.prepareStatement( >>>>> "insert into table1(id, status, bl) values(101, 0, >>>>> ?)"); >>>>> byte[] arr = new byte[300000*1024]; >>>>> for (int i = 0; i < arr.length; i++) >>>>> arr[i] = (byte)4; >>>>> ps.setBinaryStream(1, new ByteArrayInputStream(arr), >>>>> arr.length); >>>>> ps.executeUpdate(); >>>>> conn.commit(); >>>>> But the above code runs into OOM for byte[] arr = new >>>>> byte[300000*1024]; because I do not have enough heap available. I was >>>>> wondering if there was a way for me to use a stream to insert a pretty >>>>> large LOB into my table without having a physical file on the disk >>>>> from which I will stream the data in. I do not care about the actual >>>>> data. As shown above, I am just inserting a large quantity of (byte)4 >>>>> in the LOB. Would appreciate if anyone knows of a way for me to stream >>>>> large data into LOB while running with limited heap. >>>> >>>> You might use the same method as used in BlobMemTest, perhaps? >>>> (LoopingAlphabetStream). >>>> >>>> Thanks, >>>> Dag >>>> >>> >> > > -- > Dag H. Wanvik, staff engineer > Sun Microsystems, Java Core and Desktop - Java DB/Derby > Haakon VII gt. 7b, N-7485 Trondheim, Norway > Tel: x43496/+47 73842196, Fax: +47 73842101 > Sun IM: dw136674, Yahoo IM: dag_h_wanvik >
