Обсуждение: disappearing data

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

disappearing data

От
Garry Saddington
Дата:
We have had a problem with postgresql 8.3 on a Windows server 2008. I
wonder whether there has been any other experiences like this. We have
connected to Potsgres from Zope via a Psycopg adapter and noticed that
sometimes when data is inserted via a form in Zope, the data is
available in Zope but doesn't get committed to the database. This has
come to a head over the weekend where at least one month's worth of data
has disappeared and this includes changes to the actual database
structure - luckily only on a testing machine, but concerning nevertheless.
The data seemed to disappear after we upgraded to the most recent
version of Zpsycopg2 database adapter, previously we were using version
1 (I know it's old, we are only testing after all) and have never had
these sorts of problem before. It's almost as if all the data and
changes to the db were held in memory, and Postgres continued to work
fine from there, but when the db adapter was changed and Zope restarted
everything was cleared from memory.
Has anyone had similar experinces or can anyone cast any light on where
the problem may lie. To us it seems the db adapter is the most likely
candidate but we can't understand how this could happen, explanations
also welcome.
Regards
Garry

Re: disappearing data

От
Magnus Hagander
Дата:
On Mon, Aug 23, 2010 at 12:12, Garry Saddington
<garry@schoolteachers.co.uk> wrote:
> We have had a problem with postgresql 8.3 on a Windows server 2008. I wonder
> whether there has been any other experiences like this. We have connected to
> Potsgres from Zope via a Psycopg adapter and noticed that sometimes when
> data is inserted via a form in Zope, the data is available in Zope but
> doesn't get committed to the database. This has come to a head over the
> weekend where at least one month's worth of data has disappeared and this
> includes changes to the actual database structure - luckily only on a
> testing machine, but concerning nevertheless.
> The data seemed to disappear after we upgraded to the most recent version of
> Zpsycopg2 database adapter, previously we were using version 1 (I know it's
> old, we are only testing after all) and have never had these sorts of
> problem before. It's almost as if all the data and changes to the db were
> held in memory, and Postgres continued to work fine from there, but when the
> db adapter was changed and Zope restarted everything was cleared from
> memory.
> Has anyone had similar experinces or can anyone cast any light on where the
> problem may lie. To us it seems the db adapter is the most likely candidate
> but we can't understand how this could happen, explanations also welcome.

I don't know anything about Zope, but it sounds like the db adapter
opens a transaction and never commits it. Perhaps the previous version
was working in autocommit mode by default, and the new one doesn't.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

Re: disappearing data

От
Adrian Klaver
Дата:
On Monday 23 August 2010 3:15:28 am Magnus Hagander wrote:
> On Mon, Aug 23, 2010 at 12:12, Garry Saddington

>
> I don't know anything about Zope, but it sounds like the db adapter
> opens a transaction and never commits it. Perhaps the previous version
> was working in autocommit mode by default, and the new one doesn't.
>
> --
>  Magnus Hagander
>  Me: http://www.hagander.net/
>  Work: http://www.redpill-linpro.com/


Sounds like it to me, see here for more detailed info:
http://initd.org/psycopg/docs/usage.html#transactions-control

You might also want to ask this question on the the Psycopg mailing list:
http://lists.initd.org/mailman/listinfo/psycopg

--
Adrian Klaver
adrian.klaver@gmail.com