Re: Derby behavior for Statement.cancel()

2024-03-26 Thread Craig Russell
Hi Rick,

Thanks so much for all of the work you did for us in this. Much more than I was 
expecting.

Best regards,
Craig

> On Mar 26, 2024, at 13:54, Rick Hillegas  wrote:
> 
> Hey Craig,
> 
> At the end of this message, I have attached a program which demonstrates the 
> behavior of Statement.cancel() in both the Derby embedded and network 
> drivers. As you can see from the following output, both drivers raise a 
> java.sql.SQLFeatureNotSupportedException exception. I ran the test on Open 
> JDK 22 using the latest Derby release (10.17.1.0):

Craig L Russell
c...@apache.org



Re: Derby behavior for Statement.cancel()

2024-03-26 Thread Rick Hillegas

Hey Craig,

At the end of this message, I have attached a program which demonstrates 
the behavior of Statement.cancel() in both the Derby embedded and 
network drivers. As you can see from the following output, both drivers 
raise a java.sql.SQLFeatureNotSupportedException exception. I ran the 
test on Open JDK 22 using the latest Derby release (10.17.1.0):


mainline (22) > runjavaExperimental 
/Users/rhillegas/derby/upgradeReleases/10.17.1.0 CancelTest embedded

[/Users/rhillegas/derby/upgradeReleases/10.17.1.0/derby.jar] 10.17.1.0 - 
(1913217)

java CancelTest embedded

java.sql.SQLFeatureNotSupportedException: Feature not implemented: cancel.

    at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:106)

    at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)

    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:225)

    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:220)

    at org.apache.derby.impl.jdbc.Util.notImplemented(Util.java:289)

    at org.apache.derby.impl.jdbc.EmbedStatement.cancel(EmbedStatement.java:556)

    at CancelTest.main(CancelTest.java:43)

Caused by: ERROR 0A000: Feature not implemented: cancel.

    at 
org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:299)

    at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:170)

    at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:75)

    ... 6 more

mainline (22) > runjavaExperimental 
/Users/rhillegas/derby/upgradeReleases/10.17.1.0 CancelTest network

[/Users/rhillegas/derby/upgradeReleases/10.17.1.0/derby.jar] 10.17.1.0 - 
(1913217)

java CancelTest network

java.sql.SQLFeatureNotSupportedException: cancel() not supported by the server.

    at 
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:103)

    at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:325)

    at 
org.apache.derby.client.am.ClientStatement.cancel(ClientStatement.java:902)

    at CancelTest.main(CancelTest.java:43)

Caused by: ERROR 0A000: cancel() not supported by the server.

    at 
org.apache.derby.client.am.ClientStatement.cancel(ClientStatement.java:897)

    ... 1 more



Derby code is managed by subversion at 
https://svn.apache.org/repos/asf/db/derby/code/trunk/


The code for EmbedStatement is at 
https://svn.apache.org/repos/asf/db/derby/code/trunk/java/org.apache.derby.engine/org/apache/derby/impl/jdbc/EmbedStatement.java


The code for ClientStatement is at 
https://svn.apache.org/repos/asf/db/derby/code/trunk/java/org.apache.derby.client/org/apache/derby/client/am/ClientStatement.java


Here is the CancelTest program:

import java.sql.*;

public class CancelTest

{

    private static final int MILLIS_PER_MINUTE = 1000 * 60;




    public static void main(String... args) throws Exception {

    String connectionURL = null;

    if ((args == null) || (args.length != 1)) { usage(); System.exit(1); }

    switch(args[0])

    {

    case "embedded" : connectionURL = 
"jdbc:derby:memory:db;create=true"; break;

    case "network" : connectionURL = 
"jdbc:derby://localhost:8246/memory:db;create=true"; break;

    default: usage(); System.exit(1);

    }

    Connection conn = DriverManager.getConnection(connectionURL);

    conn.prepareStatement

    (

    "CREATE PROCEDURE waitProc(IN minutesToWait INT)\n" +

    "LANGUAGE JAVA\n" +

    "PARAMETER STYLE JAVA\n" +

    "NO SQL\n" +

    "EXTERNAL NAME 'CancelTest.waitProc'\n"

    )

    .execute();

    PreparedStatement waitProcStatement = conn.prepareStatement

    (

    "CALL waitProc(1)"

    );

    StatementRunner statementRunner = new 
StatementRunner(waitProcStatement);

    Thread statementThread = new Thread(statementRunner);

    statementThread.start();

    Thread.currentThread().sleep(5000);

    try

    {

    waitProcStatement.cancel();

    }

    catch (Throwable t)  { t.printStackTrace(); }

    System.exit(1);

    }

    private static void usage() {

    println

    (

    "Usage:\n" +

    "\n" +

    "  java CancelTest driverType\n" +

    "\n" +

    "    driverType  embedded or network\n"

    );

    }

    public static void waitProc(int minutesToWait) throws Exception {

    Thread.currentThread().sleep(minutesToWait * MILLIS_PER_MINUTE);

    }

    private static void println(String text) { System.out.println(text); }

    public static class StatementRunner implements Runnable

    {

    private PreparedStatement _ps;

    public 

Re: JDO TCK meeting Tuesday March 26 1200 PDT 2000 CET

2024-03-26 Thread Craig Russell
Attendees: Michael Bouschen, Tobias Bouschen, Craig Russell

Next meeting: Tuesday April 9 1100 PDT 2000 CEsT

Agenda:

1. ASF - Infra newsletter for March, 2024: Policy change on use of GitHub 
Actions for heavy users.

This does not affect the JDO project. 

2. New db-jdo-site PR #51 "Update downloads.adoc" 
https://github.com/apache/db-jdo-site/pull/51

The change will also affect the dist repo. 
AI Craig merge the request and remove the artifacts from dist. The artifacts 
will live on in the archives.

3. JIRA JDO-835 "TCK: Check ResultClassRequirementsMap when running 
multithreaded" https://issues.apache.org/jira/browse/JDO-835

4. JIRA JDO-836 "TCK: QueryCancel Test class fails" 
https://issues.apache.org/jira/browse/JDO-836

Still looking into DataNucleus test case to explain the difference in execution 
time.

Running a DataNucleus test case (using a different datastore H2):

21:13:25,490 (main) DEBUG [DataNucleus.Query] - JDOQL Query : Executing "SELECT 
max (this.x) FROM mydomain.model.Point WHERE this.x >= 0 && p2.x >= 0 VARIABLES 
mydomain.model.Point p2" ...
21:13:25,502 (main) DEBUG [DataNucleus.Datastore] - Using PreparedStatement 
"prep100: SELECT MAX(A0.X) FROM POINT A0 CROSS JOIN POINT VAR_P2 WHERE A0.X >= 
0 AND VAR_P2.X >= 0" for connection 
"org.datanucleus.store.rdbms.datasource.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper@1c6ac73c"
21:13:25,502 (main) DEBUG [DataNucleus.Datastore.Native] - SELECT MAX(A0.X) 
FROM POINT A0 CROSS JOIN POINT VAR_P2 WHERE A0.X >= 0 AND VAR_P2.X >= 0
21:13:28,800 (main) DEBUG [DataNucleus.Datastore.Retrieve] - SQL Execution Time 
= 3298 ms
21:13:28,806 (main) DEBUG [DataNucleus.Query] - JDOQL Query : Execution Time = 
3316 ms

Still need to add a configuration option to the TCK to know what to expect from 
cancel().
We should also clarify the specification/javadoc regarding what the 
requirements are for query cancel.

5. sonarcloud issues

JIRA JDO-819 "Code quality analysis" 
https://issues.apache.org/jira/browse/JDO-819
JIRA JDO-823 "Fix sonarcloud issues of type Code Smells" 
https://issues.apache.org/jira/browse/JDO-823

Sonarcloud link: https://sonarcloud.io/summary/overall?id=db-jdo

* Cognitive Complexity of methods should not be too high:
https://sonarcloud.io/project/issues?resolved=false=java%3AS3776=CRITICAL=CODE_SMELL=db-jdo
 

* Raw types should not be used:
https://sonarcloud.io/project/issues?resolved=false=java%3AS3740=MAJOR=db-jdo
 

6. JIRA JDO-812 "Move to JDK 11 as the lowest supported version" 
https://issues.apache.org/jira/browse/JDO-812

7. Other issues

Action Items from weeks past:

[Jan 09 2024] AI everyone: take a look into the ResultClassRequirementsMap 
issue.
[Jan 02 2024] AI everyone: see if anyone can see a problem with the parallel 
execution of tests Cast.java and SupportedOptionalMethods.java
[Jul 13 2023] AI All Open a new JIRA for Android since having JNDI in the API 
disallows use with Android
[Jun 08 2023] AI All make a JIRA: JDO support for Java Records 
https://openjdk.org/jeps/395
[Dec 09 2021] AI Craig: Try to contact all current/former participants in JDO 
development and see if and how they want to be recognized on the JDO and DB web 
sites.https://db.apache.org/whoweare.html
[Oct 07 2021] AI Craig send a private message to all JSR-243 Expert Group 
members asking if they wish to continue.
[Mar 25 2021] AI Craig: investigate "merging" papajdo and apache.clr accounts
[Oct 17 2014] AI Matthew any updates for "Modify specification to address NoSQL 
datastores "https://issues.apache.org/jira/browse/JDO-651


Craig L Russell
c...@apache.org