Re: New significance of holdable result sets in Java 8

From: Florent Guillaume <fg(at)nuxeo(dot)com>
To: Marko Topolnik <marko(dot)topolnik(at)gmail(dot)com>
Cc: Steven Schlansker <stevenschlansker(at)gmail(dot)com>, "pgsql-jdbc(at)postgresql(dot)org JDBC" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: New significance of holdable result sets in Java 8
Date: 2014-11-13 13:12:25
Message-ID: CAF-4BpO6Lez5ZCbYcEdJwpepMHHBS+S-BtaYxBYDtjrO_xBWCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, Nov 13, 2014 at 1:08 PM, Marko Topolnik
<marko(dot)topolnik(at)gmail(dot)com> wrote:
> Yes, your approach makes perfect sense---as long as you don't care about transactional semantics.
>
> If the transaction boundary is moved all the way to the end of serving the response, the following happens:
>
> 1. 200 OK status code reported, but transaction still not committed;
> 2. transaction may roll back due to errors in transfer;
> 3. thanks to buffering, the transfer may also fail _after_ the transaction has committed.
>
> So, not only have you established quite messy and illogical transaction semantics for your client (for example, a typical onSuccess callback on the HTTP request cannot assume the transaction succeeded); the client has no idea _in principle_ what happened to the transaction if transfer is aborted for any reason.
>
> In an earlier incarnation of my project I did indeed have setup exactly as you describe it, but after realizing the above problems, I had to back off and revert to standard transaction boundaries.
>

Another slightly subtler problem is the following:
1. 200 OK reported but transaction still not committed due to various
async delays
2. client makes another request assuming the transaction is committed
3. result of 2. returned fast to client, transaction in 1. still not committed
4. client doesn't see committed data

Florent

--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Content Management Platform for Business Apps
http://www.nuxeo.com http://community.nuxeo.com

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message George Woodring 2014-11-13 13:31:07 Re: Anyway to tell jdbc to use server timezone?
Previous Message Marko Topolnik 2014-11-13 13:02:54 Re: New significance of holdable result sets in Java 8