db-derby-dev mailing list archives

Re: [jira] Commented: (DERBY-3097) Unnecessary if statement can be removed from BaseActivation.getColumnFromNow

Date

Mon, 08 Oct 2007 19:04:33 GMT

On 10/7/07, Bryan Pendleton (JIRA) <jira@apache.org> wrote:
> Does anyone have access to the old Cloudscape test script for "Beetle 4880"?
> I'd like to see if this test sheds any light on the BaseActivation.getColumnFromRecord
code,
> and possibly add the test case to our current regression suite.
Hi,
I found is this:
------------
NEST_THIS definition:
public static int NEST_THIS( int returnValue,
String statement1 )
throws SQLException, StandardException
{
Connection conn = getCurrentConnection();
PreparedStatement ps = conn.prepareStatement( statement1 );
ps.execute();
return returnValue;
}
ij> create table L_1
(
pk int primary key,
s1 int,
b int,
s2 int,
s3 int
);
0 rows inserted/updated/deleted
ij> create unique btree index L_1_UNIQUE on L_1( s1, s2, s3 );
0 rows inserted/updated/deleted
ij> insert into L_1 ( pk, s1 ) values
( -16, NEST_THIS( 103, 'delete from L_1 properties index=null
where s2 = 103 and s1 =
NEST_THIS( 103, ''insert into L_1 ( pk, s1, s2, s3 ) values
( -18, 3, 1, 1 ), ( -19, 403, 403, 403 )'' )' ) );
-------------------------------
The info further indicates that at one time, this code caused a deadlock.
The notes say: "Consider a query like: select * from t1, t2 where
t2.c1 = MyClass::myMethod(t1.c1). Since the method call's arguments
have no local reference to t2, and the predicate is pushed down as a
qualifier, we should be able to deem it as scan-invariant and evaluate
it once per outer row, so all together row_count(t1) number of times.
And we should evaluate it outside the store, before a heap page is
latched."
I've not tried this code out; not sure the syntax even works in Derby.
I hope it helps.
I'll leave it to you to add this to the bug comments or not...
Myrna