Transactions in Squeak?

Paul Fernhout pdfernhout at kurtz-fernhout.com
Sat Jul 8 13:19:41 UTC 2000


I and others would like to add transactions to the Squeak/Smalltalk
version of the Pointrel Data Repository System.

I thought the general issue of file-based transactions in Squeak might
be of interest to other Squeakers.

What would it take to add transactions (with files) to Squeak in a
platform independent way? Note the emphasis on platform independent,
which might either be completely platform independent because it uses
some common quality of file systems (eg. lock files based on possibly
atomic create, rename, or delete operations), or at the VM level (eg.
platform dependent, but with common primitives) or somewhere in the
Smalltalk API level (e.g. common interface to platform specific FFI
modules or primitives).

Is there already code to do transactions that is generally available,
clearly licensed, open source, and in Smalltalk? Squeak doesn't seem to
have much in the way to support transactions. I didn't see support for
locking files in 2.7 or anything related to OS support (for example,
Novell supports special locking procedures).

What I'm looking for could be broken into a several categories of
increasing difficulty:

SINGLE USER
1. SEQUENTIAL TRANSACTIONS, ONE FILE, APPENDS ONLY, SINGLE USER. 
A file is appended to reliably from Squeak as a single user. That is,
the extra part either goes in or it does not go in (or a partial append
is "cleaned up" and dicarded when the next transation starts.)
2. SEQUENTIAL TRANSACTIONS, MULTIPLE FILES, CHANGES, SINGLE USER. 
More than one file is modified and/or appended to reliably from Squeak
as a single user from one VM. That is, the modifications to any files
are either all made or none or made (or partial changes are rolled back
by an error recovery process on a new transaction or restart.)
3. SIMULTANEOUS TRANSACTIONS, MULTIPLE FILES, CHANGES, SINGLE USER. 
Multiple simultaneous transactions are supported to more than one file
is modified and/or appended to reliably from Squeak as a single user
from one VM. That is, several transactions can be partially complete (in
progress) at the same time.

MULTI-USER
4. SEQUENTIAL TRANSACTIONS, ONE FILE, APPENDS ONLY, MULTIPLE USERS. A
file is appended to reliably from Squeak by multiple Squeak VMs on the
same machine (or [even harder] different machines), although by only one
at a time. Some way is needed to coordinate multiple requests so one
proceeds at a time (like by file locking).
5. SEQUENTIAL TRANSACTIONS, MULTIPLE FILES, CHANGES, MULTIPLE USERS.
More than one file is modified and/or appended to reliably from Squeak
by multiple Squeak VMs on the same or different machines, although by
only one at a time.
6. SIMULTANEOUS TRANSACTIONS, MULTIPLE FILES, CHANGES, MULTIPLE USERS.
Multiple simultaneous transactions are supported to more than one file
from multiple VMs on the same or different machines. That is, multiple
users can have in progress multiple transactions, each of which is
partially complete.

The support for simultaneous transactions would of course depend to a
large extent on the database structure.

To an extent, the multi-user cases could be simplified to single user
cases by rotuting requests through a server. So, I am mostly interested
in solutions for the single user cases first. I am mostly interested in
a somewhat simplified version of #2, however solving #1 would get me
close to what I want. 

How do the existing Wikis or Squeak web servers deal with such issues? I
would guess they fall in the single VM case and just serve one
transaction at a time with an assumption of success.

It also wasn't obvious to me how to create a Squeak file stream which
was mostly read-only but could still also be used for writing (locking
for write only as needed). Is the only way around this to create a
stream with write priveledges as needed and close it when done?

Pointers to general theory (especially on the web) also appreciated.

-Paul Fernhout
Kurtz-Fernhout Software 
=========================================================
Developers of custom software and educational simulations
Creators of the Garden with Insight(TM) garden simulator
http://www.kurtz-fernhout.com





More information about the Squeak-dev mailing list