[mythtv] [mythtv-commits] mythtv commit: r17970 by nigel

Chris Pinkham cpinkham at bc2va.org
Tue Jul 29 21:00:07 UTC 2008


* On Tue Jul 29, 2008 at 04:39:44PM +1000, Nigel Pearson wrote:
> > DBUtil::lockSchema() only returns false if there was an error locking
> > the schemalock table.  If it tries to lock and is blocked by another
> > existing lock, then the SQL lock command blocks waiting for the lock
> > to succeed.
> 
> Damn. No, that isn't quite what I was expecting.
> Thanks for the code review.
> 
> 
> Blocking is OK for now, but in the long term
> something like this might be better:
> 
> bool DBUtil::isSchemaLocked(void)
> ...
>      query.exec('SHOW OPEN TABLES');
> ...
>          if (query.value(1) == 'schemalock' &&
>              query.value(2) == 1)
>              return true;

The blocking ability was used as a feature when I originally added the
schemalock code.  Rather than trying to devise our own cross-network
mutex, we just let MySQL handle it via the table lock.  It also
prevented any race conditions in the upgrade code.

--
Chris


More information about the mythtv-dev mailing list