Bug 8796 - Remove all manual transaction management
Summary: Remove all manual transaction management
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 2.1 M3
Assignee: Michael Wood
QA Contact: Mihail Stanciu
URL:
Whiteboard:
Depends on:
Blocks: 8895
  Show dependency tree
 
Reported: 2015-12-11 18:06 UTC by Michael Wood
Modified: 2016-03-01 13:53 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wood 2015-12-11 18:06:41 UTC
Currently we have a lot of manual database transaction management code, after upgrading to Django 1.8 this seems to cause issues on MySQL. MySQL has a complicated way of dealing with transactions 

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=cb23e3043bf5c07f111787287a321df0ece647dd

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=ee1af30548a6ac3f243c9ee61f0988aa307c0c6b

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=e248a503ba84658dea086e65e9cde8b845b9c0ed

I don't think managing our own transactions was the right solution as we support multiple database backends which may have different versions and we may also have different versions of the database adapter, we should just avoid this entirely and leave Django to manage the transactions for us.

See also

https://docs.djangoproject.com/en/1.8/topics/db/transactions/

"MySQL transaction peculiarities are outside the scope of this article, but the MySQL site has information on MySQL transactions.http://dev.mysql.com/doc/refman/5.6/en/sql-syntax-transactions.html "

https://code.djangoproject.com/ticket/24921

"
 The ORM assumes that Django has control of the database connection, including control of its transactional behavior.

The docs make it pretty clear that you're on your own in that case:

    Once you turn autocommit off, you get the default behavior of your database adapter, and Django won't help you."

So in summary manual transaction management is a can of worms we don't want to nor should open.
Comment 2 Mihail Stanciu 2016-03-01 13:53:32 UTC
Verified while checking bug 9116.