Locking Metakit for CGI

Project homepage: http://rohanpall.com/projects/locktower/

Rohan Pall http://rohanpall.com/tclerspub/x.gif

2003-03-03 (March 03, 2003)

The wonderful Metakit database is a very useful tool, and I use it for many of my projects, including Tigerbliss.

I would like to use mk (shortform for Metakit) in harmony with cgi.tcl.

I document how to lock the mk db file, so that you don't get multiple processes writing to the same file at the same time -- which will inexorably corrupt your database.

The Wikit package contains the locking code that I'm interested in. I took the acquire and release code from utils.tcl, and the start up code from start.tcl. Thanks go to jcw.

I cleaned up the code, and fixed a bug.

I'm taking the code off the wiki because this morning it looks like some user-agent munged the code. Its hairy code and I don't want people getting bad copies of it.

It will be available at http://rohanpall.com/projects/locktower/ - Unfortunately, this address is dead. Even worse, I did not get any response from Rohan Pall to my email request for the code. Does anyone still have the code somewhere and could send it tp me or post a working address here, please? --DMA

I heartily recommend using Don Libes cgi.tcl, it works great and tastes yummy too.

ECS 20050215 - The wiki locking code has changed. Take a look at the new version in Wiki admin notice.

04mar03 jcw - Thanks for fixing the bug. It explains why lock-breaking always caused the CGI itself to fail, and the next one to work again. Change is also in wikit itself now.

Note that tcllib's ncgi is based on cgi.tcl, but the code has been namespaced.

Ro: Note that this does not make it better. Namespacing packages usually does, but in the case of cgi, where you want to hammer them out quick, the less code, the better. cgi.tcl is tested, time-worn, and made by Don Libes.

Nor does it make it worse. Having it namespaced, and in tcllib, means that more people will have the software on their system than cgi.tcl. That is the benefit.

If you want to use cgi.tcl - wonderful! We are happy for you. If someone else wants to come along and modify the code for ncgi namespacing names, wonderful again. Let's not get into a techno-politico battle over the issue.

Well, does the code now run with ncgi or not? --DMA

LES on 20070527: Wikit's database got corrupted early this year, so I suppose whatever method is currently employed to lock it is not that good. Is that right?