Django

Code

Ticket #10958 (closed: fixed)

Opened 11 months ago

Last modified 10 months ago

Autocommit setting never sets isolation_level of connection to 0

Reported by: kmishler@arinc.com Assigned to: nobody
Milestone: 1.1 Component: Database layer (models, ORM)
Version: SVN Keywords:
Cc: richard.davies@elastichosts.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

3460_r10645-autocommit.diff (0.7 kB) - added by anonymous on 04/29/09 08:38:13.

Change History

04/29/09 08:38:13 changed by anonymous

  • attachment 3460_r10645-autocommit.diff added.

04/29/09 09:18:12 changed by Richard Davies <richard.davies@elastichosts.com>

  • cc set to richard.davies@elastichosts.com.
  • needs_better_patch changed.
  • component changed from Uncategorized to Database layer (models, ORM).
  • needs_tests changed.
  • milestone set to 1.1.
  • needs_docs changed.
  • has_patch set to 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.

05/08/09 01:47:31 changed by mir

  • stage changed from Unreviewed to Ready 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.

05/08/09 04:24:45 changed by jacob

  • stage changed from Ready for checkin to Accepted.

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

05/10/09 01:23:30 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #10958 (Autocommit setting never sets isolation_level of connection to 0)




Change Properties
Action