From: Oliver Jowett <oliver@opencloud.com>
To: Mikko T. <mtiihone@cc.hut.fi>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: OutOfMemory when inserting stream of unknown length
Date: Fri, 20 Aug 2004 22:04:40 +1200
Message-ID: <4125CCB8.10801@opencloud.com> (raw)
In-Reply-To: <Pine.OSF.4.60.0408201155140.368856@kosh.hut.fi>
References: <Pine.OSF.4.60.0408191028070.368856@kosh.hut.fi>
<41251B4C.9020205@opencloud.com>
<Pine.OSF.4.60.0408201155140.368856@kosh.hut.fi>
Mikko T. wrote:
> I think that commiting to send very large data values that are not even
> guaranteed to exist (or be available) makes it impossible to get the
> protocol back to known state if for some reason the data cannot be sent
> or the last command should be aborted. In the current solution the only
> option seems to be to kill the whole connection but I find that quite an
> extreme thing to do.
I discussed some alternatives with Kris a while ago but no
implementation has happened yet. The most promising approach was to pad
out the parameter in the Bind message, then immediately Close the
resulting portal without executing it and return an error to the
application.
> In my opinion the protocol level should support sending the data in
> chunks (4K - 16K could be optimal). This way the jdbc driver only has to
> buffer one chunk ahead and not the whole stream and it always knows
> there won't be any IOExceptions or EOF occuring during the sending.
> Supporting chunked sending would also allow the jdbc driver to support
> cancel/rollback the streaming if it needs to or is asked to do so by the
> database even if there would still be megabytes of data to send.
Right -- something like HTTP/1.1's chunked transfer scheme. We would
have to have some "partially bound portal" state floating around on the
server side which seems ugly (and coordinating multiple parameters is
going to get nasty). Is it worth it? I have a feeling that pgsql-hackers
may take some convincing; sending data of unknown length doesn't seem
like it would be widely used, and it'd be quite a lot of complexity to add.
There's nothing much we can do about this with the current protocol
unfortunately :(
-O
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, mtiihone@cc.hut.fi
Subject: Re: OutOfMemory when inserting stream of unknown length
In-Reply-To: <4125CCB8.10801@opencloud.com>
References: <Pine.OSF.4.60.0408191028070.368856@kosh.hut.fi> <41251B4C.9020205@opencloud.com> <Pine.OSF.4.60.0408201155140.368856@kosh.hut.fi> <4125CCB8.10801@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox