Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 7965 invoked from network); 12 Apr 2007 23:59:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Apr 2007 23:59:42 -0000 Received: (qmail 93838 invoked by uid 500); 12 Apr 2007 23:59:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 93617 invoked by uid 500); 12 Apr 2007 23:59:48 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 93608 invoked by uid 99); 12 Apr 2007 23:59:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Apr 2007 16:59:47 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [32.97.182.143] (HELO e3.ny.us.ibm.com) (32.97.182.143) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Apr 2007 16:59:41 -0700 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e3.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id l3CMwYuO001981 for ; Thu, 12 Apr 2007 18:58:34 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l3CNxKex310422 for ; Thu, 12 Apr 2007 19:59:20 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l3CNxK40023573 for ; Thu, 12 Apr 2007 19:59:20 -0400 Received: from [127.0.0.1] (IBM-IKEJ04B1IMA-009072133081.usca.ibm.com [9.72.133.81]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l3CNxJ5x023536 for ; Thu, 12 Apr 2007 19:59:19 -0400 Message-ID: <461EC7B4.8000408@sbcglobal.net> Date: Thu, 12 Apr 2007 16:58:44 -0700 From: Mike Matrigali Reply-To: mikem_app@sbcglobal.net User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: derby-dev@db.apache.org Subject: Re: Question about UpdateCursorTest.testVirtualMemoryHeap References: <461EB325.1030004@amberpoint.com> <461EC44E.3000907@sbcglobal.net> In-Reply-To: <461EC44E.3000907@sbcglobal.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Mike Matrigali wrote: > >> I'm a bit confused about the test program >> UpdateCursorTest.testVirtualMemoryHeap. This test program >> appears to depend on the order of the rows returned, but >> it does not contain an ORDER BY clause in the query. Here's >> the code I'm looking at, from UpdateCursorTest.java: >> >> /** >> * Test the virtual memory heap. >> * >> * @throws SQLException >> */ >> public void testVirtualMemoryHeap() throws SQLException { >> PreparedStatement select = prepareStatement("select c1, c3 >> from t1 where c3 > 1 and c1 > 0 for update"); >> Statement update = createStatement(); >> String cursorName; >> ResultSet cursor; >> int expectedValue = 1; >> >> cursor = select.executeQuery(); // cursor is now open >> cursorName = cursor.getCursorName(); >> >> /* scan the entire table except the last row. */ >> for (int i = 0; i < SIZE_OF_T1 - 1; i++) { >> >> /* Notice the order in the rows we get: from 2 to 102 asc >> order on second column (c3) >> * then from 202 down to 103 on that column; then from >> 203 up to 250. The reason is >> * we are using asc index on c3, all the rows updated are >> in the future direction of the >> * index scan, so they all get filled into a hash table. >> The MAX_MEMORY_PER_TABLE >> * property determines max cap of hash table 100. So >> from row 103 it goes into virtual >> * memory heap, whose in memory part is also 100 >> entries. So row 103 to 202 goes into >> * the in-memory part and gets dumped out in reverse >> order. Finally Row 203 to 250" >> * goes into file system. Here we mean row ids. >> */ I have not looked at test code or derby code, but the comments do seem worrysome. Picking a specific plan can be dependent on machine speed, amount of memory at the particular time the test is run (so very easily could change as more tests are added to suite). Also the comments talk about expecting a particular order when scanning a hash table - I know that I have seen different order of rows coming out of java hash tables depending on what JVM you are using. I have filed DERBY-2543 to track the new regression suite bug. >> >> This test seems to be very sensitive to the precise query execution >> strategy that is being used, but I don't see how the test is >> controlling that query execution strategy. >> >> Can somebody clarify how the test works for me? >> >> thanks, >> >> bryan >> >> P.S. The reason that I'm asking is that my proposed change for >> DERBY-2526 causes this test to fail, but I'm not sure whether that >> means my change is bad, or whether this test is depending on a >> query execution strategy that is not guaranteed to occur. >> >> >> > > >