Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10958 closed (fixed)

Autocommit setting never sets isolation_level of connection to 0

Reported by: kmishler@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: richard.davies@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using the latest django code from subversion (revision 10645), when I have autocommit set to True in my settings.py, it looks like the isolation_level of the connection is never being set to 0. 3460_r10645-autocommit.diff patch seems to fix the problem, but I don't know if it's the right way to fix it.

Attachments (1)

3460_r10645-autocommit.diff (676 bytes) - added by anonymous 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by anonymous

Attachment: 3460_r10645-autocommit.diff added

comment:1 Changed 8 years ago by Richard Davies <richard.davies@…>

Cc: richard.davies@… added
Component: UncategorizedDatabase layer (models, ORM)
Has patch: set
milestone: 1.1

I believe this is correct - the problem is that the call to "self.connection._set_isolation_level(int(not autocommit))" in "DatabaseWrapper._init_()" is made before "self.connection" exists.

An alternative approach might be to move this entire call from "DatabaseWrapper._init_()" to the location highlighted in this patch.

Looking historically, this appears to have got broken when #3460 was applied, between the final patch on the ticket (http://code.djangoproject.com/attachment/ticket/3460/3640_r9736-autocommit-safe.diff) and the commit r10029.

The autocommit feature is in the Version1.1Features list, and is fundamentally broken without this fix, so I'm tagging this ticket to 1.1.

comment:2 Changed 8 years ago by Michael Radziej

Triage Stage: UnreviewedReady for checkin

looks sane. Test suite passed with autocommit enabled (postgres 8.3). Would be nice to have a buildbot that checks autocommit mode since it probably won't get much testing attention.

comment:3 Changed 8 years ago by Jacob

Triage Stage: Ready for checkinAccepted

I'm not sure this is RFC; I want to look closer first.

comment:4 Changed 8 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [10728]) Fixed #10958 -- Corrected the setting of PostgreSQL isolation level. Thanks to kmishler for the report.

comment:5 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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