Opened 11 months ago

Last modified 3 months ago

#28901 new Cleanup/optimization

Document considerations with read committed isolation level and InnoDB

Reported by: Dirkjan Ochtman Owned by: nobody
Component: Documentation Version: 2.0
Severity: Normal Keywords:
Cc: Adam (Chainz) Johnson Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

After upgrading my application to Django 2.0, I have been seeing errors: "Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED."

The 2.0 release notes at https://docs.djangoproject.com/en/2.0/releases/2.0/#default-mysql-isolation-level-is-read-committed don't mention anything about this particular problem. Since, as far as I can tell, InnoDB and BINLOG_FORMAT = STATEMENT are the default values, it would be useful if the documentation could warn about this problem.

Change History (5)

comment:1 Changed 11 months ago by Tim Graham

Cc: Adam (Chainz) Johnson added
Summary: Read committed isolation level does not work with InnoDBDocument considerations with read committed isolation level and InnoDB
Type: UncategorizedCleanup/optimization

Would you like to draft something?

comment:2 Changed 11 months ago by Dirkjan Ochtman

I wouldn't mind typing up the above in a way that is feasible for the documentation -- however, it would sure be nice if someone with deeper knowledge of Django and MySQL reviews that what I'm saying is correct and makes sense, and simply reverting the isolation level is the best solution here. It sure doesn't feel like the right solution -- but I couldn't figure out so far what the best alternative is.

comment:3 Changed 10 months ago by Tim Graham

Triage Stage: UnreviewedSomeday/Maybe

comment:4 Changed 3 months ago by Nir Izraeli

Hi, I encountered a related issue and opened (and later answered) a stackoverflow question I think may be useful for others stumbling upon this ticket, so I'm linking it here: https://stackoverflow.com/a/51399292/1146713

The gist of it is I was using an old MariaDB version (10.0) which defaulted to BINLOG_FORMAT = STATEMENT instead of the more flexible BINLOG_FORMAT = MIXED that is the default since version 10.2.4.

Django may want to add that as part of the default-override, to avoid this problem when working with older versions of MariaDB, or include as part of the documentation section about changing the default transaction isolation level. I have no opinion on the matter but I'm up to contribute a change once it's decided.

comment:5 Changed 3 months ago by Adam (Chainz) Johnson

Django can't override binlog_format since it is set on the server level only, which requires either super privilege (django apps shouldn't have this) or editing the config file. Also it has a huge number of considerations, see https://mariadb.com/kb/en/library/binary-log-formats/ .

Note: See TracTickets for help on using tickets.
Back to Top