django icon indicating copy to clipboard operation
django copied to clipboard

Fixed #10088 -- Added QuerySet.select_for_share().

Open ngnpope opened this issue 1 year ago • 2 comments

Initial work to address ticket-10088.

Alternative to #15939 and #16172.

Thought I'd get this out there as I've been sitting on it for a couple of years. I've rebased it.

  • Adds support for nowait, skip_locked, of and key options
    • Note that select_for_update() has no_key, but select_for_share() has key
  • Adds support for LOCK IN SHARE MODE for MariaDB ~and MySQL < 8.0.1~ (Django 5.0 will support MySQL 8.0.11+)
  • Implements support of for_share_after_from like for_update_after_from used by MSSQL backend
  • Shared documentation for select_for_share() and select_for_update() as very similar
  • Shared tests for select_for_share() and select_for_update() as very similar

The patch is quite mature, but there is still some work to be done:

  • [ ] Properly implement the "blocking" tests using other thread for FOR SHARE case
  • [x] Determine what to do about subTest() not supporting skipTest()
    • Have split into separate test modules with some preliminary refactoring to make things more maintainable.
  • [x] Review whether anything has been missed. I've rebased this but it was written a long time ago...

I've marked this as a draft because of needing to think about the testing issues, but it's ready for a first round of review.

ngnpope avatar Dec 13 '22 18:12 ngnpope

Have pushed progress so far. Still some tidying up to be done, fixing some tests, etc.

So no review required yet.

ngnpope avatar Jun 09 '23 14:06 ngnpope

buildbot, test on oracle.

ngnpope avatar Aug 04 '23 14:08 ngnpope