Обсуждение: ZPsycopgDA Isolation Levels Bug

Поиск
Список
Период
Сортировка

ZPsycopgDA Isolation Levels Bug

От
Lex Berezhny
Дата:
Hello,

  I have updated ZPsycopgDA add/edit screens to include all of the
isolation levels provided by psycopg2. It seems that even the ones
that were there had the wrong mappings between the isolation level
name and the internal integer identifier. "Read Commited" in the drop
down was actually mapping to "Read Uncommited" and "Serializable" was
mapping to "Read Committed".

  I have attached a diff of my changes, if there is a way for me to
git push my changes where someone with write access can pull from I
can do that too.

Thanks,

 Lex

Вложения

Re: ZPsycopgDA Isolation Levels Bug

От
Daniele Varrazzo
Дата:
2011/8/9 Lex Berezhny <eukreign@gmail.com>:
> Hello,
>
>  I have updated ZPsycopgDA add/edit screens to include all of the
> isolation levels provided by psycopg2. It seems that even the ones
> that were there had the wrong mappings between the isolation level
> name and the internal integer identifier. "Read Commited" in the drop
> down was actually mapping to "Read Uncommited" and "Serializable" was
> mapping to "Read Committed".

I'm not entirely sure Autocommit should be included in the list: it
isn't exactly a transaction isolation level. But I know little about
Zope so I may be wrong.

>  I have attached a diff of my changes, if there is a way for me to
> git push my changes where someone with write access can pull from I
> can do that too.

You may have a clone on github. I have my repos there and Federico
usually pulls my code from it.

-- Daniele

Re: ZPsycopgDA Isolation Levels Bug

От
Federico Di Gregorio
Дата:
On 09/08/11 17:23, Daniele Varrazzo wrote:
> 2011/8/9 Lex Berezhny <eukreign@gmail.com>:
>> Hello,
>>
>>  I have updated ZPsycopgDA add/edit screens to include all of the
>> isolation levels provided by psycopg2. It seems that even the ones
>> that were there had the wrong mappings between the isolation level
>> name and the internal integer identifier. "Read Commited" in the drop
>> down was actually mapping to "Read Uncommited" and "Serializable" was
>> mapping to "Read Committed".
>
> I'm not entirely sure Autocommit should be included in the list: it
> isn't exactly a transaction isolation level. But I know little about
> Zope so I may be wrong.

IMO, autocommit should not be included. Zope has the concept of "page
transaction" and we don't want to break that.

>>  I have attached a diff of my changes, if there is a way for me to
>> git push my changes where someone with write access can pull from I
>> can do that too.
>
> You may have a clone on github. I have my repos there and Federico
> usually pulls my code from it.

Yep, just send to me or to this list a pull request.

federico

--
Federico Di Gregorio                         federico.digregorio@dndg.it
Studio Associato Di Nunzio e Di Gregorio                  http://dndg.it
  Se consideri l'uso del software libero una concessione tu stesso,
   come potrai proporla agli altri?                         -- Nick Name

Re: ZPsycopgDA Isolation Levels Bug

От
Lex Berezhny
Дата:
Hi,

We have a pretty large Zope application that completely stopped
working (no transactions were being commited) after upgrading from
psycopg 2.4.1 to 2.4.2.

When I create the ZPsycopgDA adapter in the ZMI using Autocommit (via
the patch I submitted) as the Isolation Level it starts working again.

I think it would be useful to have all of the available isolation
levels in the drop down since they are all described in the API.

In our case, our application doesn't work at all without Autocommit.
ZSQL methods never commit. Even when using the database adapter "Test"
tab to run ad hoc queries all of them rollback.

I have added my change to github but couldn't figure out how to
generate a pull request so here is a link to the commit, let me know
if you need anything else from me:

https://github.com/eukreign/psycopg2/commit/fde7d5e019fbe119bb696ee7c7dafc12569a02f4

Right now, Autocommit is the default option when adding the database
adapater (because it's the first one in the API as well). If you would
rather have something else I can change it and resubmit.

Thanks a lot,

 Lex

Re: ZPsycopgDA Isolation Levels Bug

От
Federico Di Gregorio
Дата:
On 09/08/11 20:16, Lex Berezhny wrote:
> Hi,
>
> We have a pretty large Zope application that completely stopped
> working (no transactions were being commited) after upgrading from
> psycopg 2.4.1 to 2.4.2.
>
> When I create the ZPsycopgDA adapter in the ZMI using Autocommit (via
> the patch I submitted) as the Isolation Level it starts working again.
>
> I think it would be useful to have all of the available isolation
> levels in the drop down since they are all described in the API.
>
> In our case, our application doesn't work at all without Autocommit.
> ZSQL methods never commit. Even when using the database adapter "Test"
> tab to run ad hoc queries all of them rollback.

So, you're saying that psycopg 2.4.2 is broken (vs Zope) and that the
right way to fix it is to add autocommit (i.e., if the page fails your
changes are committed to the database anyway). I'm, not sure I like
that. ;) We'll try to fix the Zope problem before 2.4.3 release.

In the meantime, thanks for the patch.

federico

--
Federico Di Gregorio                         federico.digregorio@dndg.it
Studio Associato Di Nunzio e Di Gregorio                  http://dndg.it
  Gli avvoltoi cinesi si nutrono di arte, ma possono anche mangiare
   i `domani'.                                        -- Haruki Murakami

Re: ZPsycopgDA Isolation Levels Bug

От
Karsten Hilbert
Дата:
On Tue, Aug 09, 2011 at 02:16:39PM -0400, Lex Berezhny wrote:

> I think it would be useful to have all of the available isolation
> levels in the drop down since they are all described in the API.

You are correct !

The only problem with this: An isolation level "autocommit"
does not exist.

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Re: ZPsycopgDA Isolation Levels Bug

От
Daniele Varrazzo
Дата:
On Tue, Aug 9, 2011 at 7:16 PM, Lex Berezhny <eukreign@gmail.com> wrote:

> We have a pretty large Zope application that completely stopped
> working (no transactions were being commited) after upgrading from
> psycopg 2.4.1 to 2.4.2.

Well, this was not supposed to happen! The semantics regarding the
isolation level was not supposed to change in the refactoring released
in 2.4.2.

If you could investigate a little more in what changed between the
releases, in terms of communication between the application and the
database, it would be great. It may be helpful to bump up the level in
the database log (log_statement = 'all' in postgres.conf) to see the
sequence of commands received.

Thank you very much.

-- Daniele

Re: ZPsycopgDA Isolation Levels Bug

От
Lex Berezhny
Дата:
On Wed, Aug 10, 2011 at 6:04 AM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> If you could investigate a little more in what changed between the
> releases, in terms of communication between the application and the
> database, it would be great. It may be helpful to bump up the level in
> the database log (log_statement = 'all' in postgres.conf) to see the
> sequence of commands received.

In all cases, even in the "Test" tab of the adapter in the ZMI
entering queries immediately results in "rollback" being issued as
well.

 - lex