Re: JDBC Large ResultSet problem + BadTimeStamp Patch

From: Peter Mount <peter(at)retep(dot)org(dot)uk>
To: Steve Wampler <swampler(at)noao(dot)edu>
Cc: Joseph Shraibman <jks(at)selectacast(dot)net>, "pgsql-interfaces(at)postgreSQL(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: JDBC Large ResultSet problem + BadTimeStamp Patch
Date: 2000-10-12 08:05:50
Message-ID: Pine.LNX.4.21.0010120858500.435-100000@maidast.demon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

On Wed, 11 Oct 2000, Steve Wampler wrote:

> Peter Mount wrote:
> ...
> > Yes, there is a problem with multiple statements and transactions on the
> > same connection when it comes to thread safety.
> >
> > The problem as I see it is two fold.
> >
> > 1: How to deal with two statements within one transaction. Related to this
> > is the metadata methods that issue queries, how to deal with them while
> > within a transaction.
> >
> > 2: Currently the JDBC Specs only have transactions supported at the
> > Connection level, so I can't see how they thought that Statements could
> > possibly run within their own transactions, unless they thought that a
> > workaround of this is the use of batches.
>
> Ah, that probably explains why I've seen "tuple arrived before metadata"
> messages when I've got several apps talking through CORBA to a java app
> that connects to postgres. Do I need to synchronize both inserts and
> queries at the java app level to prevent this? (I was hoping that
> the BEGIN/END block in a transaction would be sufficient, but this makes
> it sound as though it isn't.)

I think you may need to, although the existing thread locking in the
driver should prevent this. BEGIN/END is protecting the tables, but the
"tuple arrived before metadata" message is from the network protocol
(someone correct me at any point if I'm wrong).

What happens at the moment is that when a query is issued by JDBC, a lock
is made against the network connection, and then the query is issued. Once
everything has been read, the lock is released. This mechanism should
prevent any one thread using the same network connection as another which
is already using it.

Is your corba app under heavy load when this happens, or can it happen
with say 2-3 apps running?

Peter

--
Peter T Mount peter(at)retep(dot)org(dot)uk http://www.retep.org.uk
PostgreSQL JDBC Driver http://www.retep.org.uk/postgres/
Java PDF Generator http://www.retep.org.uk/pdf/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2000-10-12 08:11:41 Automatic code conversion between UNICODE and other encodings
Previous Message Matthew N. Dodd 2000-10-12 06:53:10 Re: TIOGA

Browse pgsql-interfaces by date

  From Date Subject
Next Message Peter Mount 2000-10-12 08:28:58 Re: JDBC Large ResultSet problem + BadTimeStamp Patch
Previous Message keke abe 2000-10-12 07:28:23 COPY BINARY to stdout