[Monetdb-developers] JDBC: transaction/savepoint issue

Fabian Fabian.Groffen at cwi.nl
Wed Aug 31 18:58:57 CEST 2005


Hi,

Thanks for your interest in MonetDB/SQL.

I looked through your example code.  I think it can be summarised as
follows:

Client A                Client B
setAutoCommit(false)
                         setAutoCommit(false)
create table X;
commit; (1)
savepoint s1;
insert y into X;
release savepoint s1;
select * from X;
commit; (2)
                         select * from X;
                         commit; (3)


Now the actual problem is that client B doesn't see the inserted row by
A.  Without commit marked with (1), B does return the row inserted by A.

I could limit this problem to a single user problem as follows:

(pegasus:~/develop/MonetJDBC) fabian% java -jar jars/MonetDB_JDBC.jar
Connection warning: database specifier not supported on this server 
(mserver_sql), protocol version 4
Welcome to the MonetDB interactive JDBC terminal!
Database: MonetDB 4.9.2
Driver: MonetDB Native Driver 1.2 (Blunt+)
Type \q to quit, \h for a list of available commands
auto commit mode: on
monetdb-> start transaction;
auto commit mode: off
monetdb-> create table x (id int);
Operation successful

monetdb-> commit;
auto commit mode: on
monetdb-> start transaction;
auto commit mode: off
monetdb-> savepoint s1;

monetdb-> insert into x values (1);
1 affected row

monetdb-> release savepoint s1;

monetdb-> select * from x;
+------------+
| id         |
+============+
|          1 |
+------------+
1 row

monetdb-> commit;
auto commit mode: on
monetdb-> select * from x;
+------------+
| id         |
+============+
+------------+
0 rows

monetdb->


It appears that on the last commit, the inserted row is gone.  Something 
which has something to do with the savepoint, because if I omit it, the 
last select does return my 1.

Niels, can you look into this issue?


Andrei Martsinchyk wrote:
> Hello,
> 
> I am trying to use MonetDB as a backend for Java application I am developing. 
> I have noticed that inserts the application does have no effect.
> Statements are executed without exceptions, but data rows do not get into table.
> I have investigated the problem and have figured out that problem is
> in transaction and savepoint handling. If transaction had savepoints,
> it could be silently rolled back when Connection.commit() is called.
> I have finished with short Java program that demonstrate the bug(?), I
> am attaching it to the message. Please, take a look.
> I tested with MonetDB-4.8.2+sql-2.8.2 (release, source tarball) and    
> with MonetDB-4.8.3+sql-2.8.3 (nightly build, August 30).
> Platforms: 32-bit Linux RedHat 9,   32-bit Linux Ubuntu 5.04
>      
> --
> Best regards,
> Andrei Martsinchyk                   mailto:andrei.martsinchyk at gmail.com





More information about the developers-list mailing list