Re: [Zope] Rollback and delete weird behavior

2006-07-03 Thread dieter
Luiz Fernando B. Ribeiro wrote at 2006-7-1 14:24 -0300:
> ...
>The problem is that the raise is not rolling back the delete, looking in 
>mysql log the following sequence was found:

Be warned that "mysql" needs special precaution to be
transaction aware.

Your "mysql" connection may have been made transaction unaware
(to allow the use of non-transaction capable tables).



-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Rollback and delete weird behavior

2006-07-01 Thread Chris McDonough
Can you provide a reproducible test case?  There are really too many  
moving parts here to know what is going on without being able to  
reproduce it.


On Jul 1, 2006, at 1:24 PM, Luiz Fernando B. Ribeiro wrote:


Hello,

In a python script I got a structure like this:

# Many request checks

# A zSQl method deleting some old data
cotainer.doDelete(key=key)

errors = [ ]
for data in list:
  # Other checks
  if error:
errors.append(error)
continue

  # Inserts in mysql database
  cotainer.doInsert(data=data, other=stuff)

if errors:
  raise "An Error with list of error: %s" % ', '.join(errors)

# --- cut ---

The problem is that the raise is not rolling back the delete,  
looking in mysql log the following sequence was found:


--Begin transaction
[delete statement]
[the insert statements]
--Rollback
--Begin transaction!!
[delete statement again]   !!
--Commit   !!!

We tried it many times and revised our code. The only solution was  
to put the delete statement in weird block like this:


if True:
  cotainer.doDelete(key=key)

As if the rollback was only effective against a "2nd level"  
instruction. This is a really odd behavior but with this trick the  
rollback was done correctly.


Has anyone ever seen this?

Luiz Fernando B. Ribeiro
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Rollback and delete weird behavior

2006-07-01 Thread Luiz Fernando B. Ribeiro

Hello,

In a python script I got a structure like this:

# Many request checks

# A zSQl method deleting some old data
cotainer.doDelete(key=key)

errors = [ ]
for data in list:
  # Other checks
  if error:
errors.append(error)
continue

  # Inserts in mysql database
  cotainer.doInsert(data=data, other=stuff)

if errors:
  raise "An Error with list of error: %s" % ', '.join(errors)

# --- cut ---

The problem is that the raise is not rolling back the delete, looking in 
mysql log the following sequence was found:


--Begin transaction
[delete statement]
[the insert statements]
--Rollback
--Begin transaction!!
[delete statement again]   !!
--Commit   !!!

We tried it many times and revised our code. The only solution was to 
put the delete statement in weird block like this:


if True:
  cotainer.doDelete(key=key)

As if the rollback was only effective against a "2nd level" instruction. 
This is a really odd behavior but with this trick the rollback was done 
correctly.


Has anyone ever seen this?

Luiz Fernando B. Ribeiro
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )