Re: an attempt to make clsql more thread safe

Nathan Bird <[email protected]> Wed, 09 May 2012 14:34:32 -0400
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
On 05/09/2012 03:55 AM, JTK wrote:
>
> As discussed earlier, I had a stab at making clsql more thread safe.
>
> In summary:
>
> 1. fix some mysql issues; restore sigpipe in SBCL; initialize mysql 
> library and threads properly.
>
> 2. put a new DATABASE-DESC object into the VIEW-DATABASE slot.  This is
> used by UPDATE-XXX  methods to find or open an appropriate database.
>
> 3. acquire/release databases to their threads, so that other threads won't
> try to use a database in use by a thread.   Any database in use must be
> owned by a thread and this is compared to the current thread.
>
> The code is here: 
> https://sites.google.com/site/lithpthtuff/home/clsql-threads
> in the form of a tarball of Nathan's git tree.
>
> The tests all pass for mysql.  Some additional thread parallelism has 
> been tested.
>
> There is a longer description of changes in the text file.
>
> Hope this is of use to someone.
>
> J.K.
>

Thanks a bunch for this work! My initial skim-through impression is that 
the code looks good but there is a *lot* of changes there.

Do you think you could try breaking it into some smaller pieces so we 
can go through this and review it a chunk at a time?  It's hard to 
digest a big hunk of changes like that and you're the best one for 
dividing it into smaller pieces. Having separate patches for the three 
items mentioned above would be a great start-- finer grained if it makes 
sense.

We use git (http://git-scm.com/) to track the code of CLSQL. It is great 
for keeping track of patches and pushing them around; there is a good 
tutorial about the system at http://git-scm.com/book.

Additionally (this is my fault) you based those changes on a slightly 
out of date version of CLSQL. When I pointed you at my github page I had 
forgotten that the 'development' branch was marked as default and now 
out of date. I've cleaned up that page so you (or anyone else) shouldn't 
hit this problem again. I've also added a bit to the README about 
contributing to help be a guide for future authors.

Because of that there are a few conflicts bringing your version of the 
patch up to HEAD. We can help resolve these, but it will be 
significantly easier to do with smaller patches; hence likely to be in 
the official release sooner.

If you need help with git, give us a shout, and we'll try to provide 
pointers.

Nathan