On Fri, Jun 03, 2011 at 06:07:01AM +0200, Andreas Rogge wrote:
> Change to apacheHandler.py to make sure a transaction that might be
> open at the end of the request handling will be committed (or rolled
> back)
> 
> ---
>  backend/server/apacheHandler.py |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/backend/server/apacheHandler.py
> b/backend/server/apacheHandler.py
> index 2d3530f..a1b4e04 100644
> --- a/backend/server/apacheHandler.py
> +++ b/backend/server/apacheHandler.py
> @@ -193,6 +193,8 @@ class apacheHandler(apacheSession):
>          # Avoid leaving Oracle deadlocks
>          try:
>              ret = self._req_processor.process()
> +            if not CFG.SEND_MESSAGE_TO_ALL:
> +                rhnSQL.commit()
>          except:
>              if not CFG.SEND_MESSAGE_TO_ALL:
>                  rhnSQL.rollback()

Andreas,

thanks for the patch. While I agree that we should not leave
active transactions behind when we are finished processing the
request, I am not sure the commit is the best way to go. Ideally it
should be the individual application which would make an informed
decision about committing its work. And if it decided not to commit
(or it did not commit due to a bug in the code), we should probably
just rollback.

Would rhnSQL.rollback() instead of rhnSQL.commit() sound reasonable?

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to