Merge lp://staging/~edoardo-serra/storm/select-for-update-support into lp://staging/storm

Proposed by Edoardo Serra
Status: Needs review
Proposed branch: lp://staging/~edoardo-serra/storm/select-for-update-support
Merge into: lp://staging/storm
Diff against target: 510 lines (+188/-18)
6 files modified
storm/databases/sqlite.py (+4/-0)
storm/expr.py (+7/-3)
storm/store.py (+51/-14)
storm/zope/interfaces.py (+3/-0)
tests/expr.py (+13/-1)
tests/store/base.py (+110/-0)
To merge this branch: bzr merge lp://staging/~edoardo-serra/storm/select-for-update-support
Reviewer Review Type Date Requested Status
Storm Developers Pending
Storm Developers Pending
Review via email: mp+35112@code.staging.launchpad.net

Description of the change

This branches implements the SELECT ... FOR UPDATE

To post a comment you must log in.
Revision history for this message
Jamu Kakar (jkakar) wrote :

Edoardo, thanks for this branch! Before we spend time reviewing the
changes, have you signed the Canonical copyright assignment forms?
This process will need to be completed before we can accept changes.

Revision history for this message
Edoardo Serra (edoardo-serra) wrote :

Hi Jamu, sorry I didn't find any mention of this on the Wiki.

I just accepdet the form via email.

Regards

On Sep 10, 2010, at 4:52 PM, Jamu Kakar wrote:

> Edoardo, thanks for this branch! Before we spend time reviewing the
> changes, have you signed the Canonical copyright assignment forms?
> This process will need to be completed before we can accept changes.
>
> --
> https://code.launchpad.net/~edoardo-serra/storm/select-for-update-support/+merge/35112
> You are the owner of lp:~edoardo-serra/storm/select-for-update-support.

Revision history for this message
James Henstridge (jamesh) wrote :

This isn't a full review, but here are a few initial comments:

1. If "SELECT FOR UPDATE" is incompatible with "GROUP BY", perhaps it would make sense to check for that in Select's compile function and raise ExprError there rather than trying to protect all the ResultSet entry points that could cause this problem.

2. You've added a comment asking whether it makes sense to remove the "FOR UPDATE" clause for ResultSet.is_empty(). If is_empty() returns True, then no rows would be locked if "FOR UPDATE" was left in. If it returns False, the program is likely to request those rows if it actually wants them locked. So I don't think the comment is necessary.

3. This doesn't need to go in your branch, but I wonder if it would be worth storing the face that a row has been locked in its obj_info, so that Store.get(..., for_update=True) can avoid a query if the row has already been locked? This could be set in Store._load_object() and unset by Store.invalidate().

Revision history for this message
James Henstridge (jamesh) wrote :

One other point: it is probably worth using an API that can support "FOR SHARE" read locks in addition to "FOR UPDATE" write locks.

Unmerged revisions

380. By Edoardo Serra <eserra@barbera>

SELECT ... FOR UPDATE implemented in Store.get

379. By Edoardo Serra <eserra@barbera>

Unit tests

378. By Edoardo Serra <eserra@barbera>

SELECT ... FOR UPDATE is not compatible with GROUP BY

377. By Edoardo Serra <eserra@barbera>

SQLite does not support SELECT ... FOR UPDATE

376. By Edoardo Serra <eserra@barbera>

Starting implementation of SELECT ... FOR UPATE

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: