Table of Contents
Locking in Pootle
Basic Concept
- Need simple locking to be able to handle multiprocess Apache servers
- This should be done with a view to handling distributed servers (although that also needs a synchronise-and-resolve-conflicts approach)
- Helpful to bear in mind that the whole process is distributed already if you include the web client
- client requests page with translation units, user edits and makes changes
- client sends changes back to server
- between the above two steps, someone else could have made changes on the server
- we therefore should be able to work out whether such a conflict has occurred anyway
- may be useful to have a 'queue of changes' that contains both the original version and the changed version
- the locking can then make sure each change is processed atomically, and that only one process tries to write to the file
- revision control etc should all go through this mechanism
- need to document all the basic change operations we expect
Investigation
looking at pootlefile for locking needs
The changes are being done on the Pootle-locking-branch branch in CVS
notes:
- complexity of having multiple files is unhelpful
- currently have timestamp id for the main file
- obscurer features (should they be dropped?)
- tracking
- this file is far too complex, it needs to be broken down
recommended plan:
temporarily remove suggestions featureseparate out stats / assigns into separate interface(may do more here)- find simpler more standard way to store stats (simple database)
- find simpler more standard way to store assigns (as above)
- add tests for concurrent access (maybe benchmarks too…)
- introduce generic pessimistic locking
- add back in suggestions etc
files currently used
- x.po
- x.po.stats
- x.po.pending
- x.po.assigns
functions, classes and locking needs
- common pattern - ability to check if file modified and reload
- getmodtime - file timestamp
pootleelement
- read properties / methosd
- getunquotedmsgid
- getunquotedmsgstr
- write properties / methods
- setunquotedmsgstr
pootlestatistics
- file system interaction
- getstats - checks modtimes, calls readstats, readpendingfile, calcstats, savestats
- readstats
- savestats
- update methods (no new data, just refresh)
- reclassifyelement
- reclassifysuggestions
pootleassigns
- file system interaction
- getassigns / readassigns
- saveassigns
- write properties / methods
- assignto
- unassign
pootlefile
- init triggers getstats, getassigns
- file system interaction
- readpofile
- savepofile
- pofreshen
- readpendingfile
- savependingfile
- read properties / methods
- getoutput
- getsuggestions
- iteritems (updates stats)
- write properties / methods
- setmsgstr
- addsuggestion
- deletesuggestion
- mergeitem
- mergefile