Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

Nested Set Trees
Project Home Known Issues Contact Project

Nested Set Trees Issue: Add locking to library functions.

Name: Add locking to library functions.
ID: 1
Project: Nested Set Trees
Type: Enhancement
Area: Code
Severity: High
Status: Closed
Related URL:
Creator: Kevan Stannard
Created: 06/01/08 3:59 PM
Updated: 06/14/08 1:12 AM
Description: What is your position on handling "race conditions" which could crop up by a subsequent call to - for example - moveToNextSibling() whilst a previous call to it is still running, so that the queries end up running like this:

Request 1: updateLeft
Request 2: updateLeft
Request 1: updateRight
Request 2: updateRight

Rather then the required:

Request 1: updateLeft
Request 1: updateRight
Request 2: updateLeft
Request 2: updateRight

Your tree data will become corrupted. I was caught out by this with my initial implementation of this sort of thing, in high-traffic situations.

You might want to put some locking or transactionality around your queries.

(Reported by Adam Cameron)
History: Created by kevanstannard (Kevan Stannard) : 06/01/08 3:59 PM

Updated by kevanstannard (Kevan Stannard) : 06/14/08 1:12 AM
Locking added in v0.2. For usage details see:
http://stannard.net.au/blog/index.cfm/2008/5/30/Nested-Set-Trees-in-ColdFusion

To add a comment to this bug, please login using the link above.