Hi!
Just some comments on the patch...
cbell@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 6.0 repository of cbell. When cbell does a push these changes will
> be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2007-11-14 14:40:34-05:00, cbell@mysql_cab_desk. +13 -0
> BUG#31383 : Consistent Snapshot driver not consistent
>
> This patch changes the default driver to use a separate thread to open and lock
> tables.
> The default driver opens tables on the prelock() call from the kernel. The
> snapshot
> driver initiates the CS read on the lock() call from the kernel and opens tables in
> the first
> call to get_data() after the lock is taken. This is due to the fact that the
> default driver's
> validity point is at open_and_lock_tables() while the snapshot driver's validity
> point
> is at the start of the transaction.
>
>
[snip]
> +
> + /*
> + Signal the driver thread that it's ok to proceed with destructor.
> + */
> + pthread_cond_broadcast(&drv->COND_driver_wait);
> + pthread_mutex_unlock(&drv->THR_LOCK_driver);
>
Even though the use of pthread_cond_signal() and
pthread_cond_broadcast() are equivalent when using just a single waiter,
it is usually better to only use broadcast if necessary and instead
using signal. Since only a single thread can get the mutex afterwards,
it is unnecessary to awake all waiting threads and put all of them
except one of them back in waiting state.
It is also usually a good idea to place the unlock before the signal,
since that usually avoids a context switch for the waiting thread.
Just my few cents,
Mats Kindahl
--
Mats Kindahl
Lead Software Developer
Replication Team
MySQL AB, www.mysql.com