-
Ole John Aske authored
The Binlog injector depends heavily on synching the binlog injector thread and the mysqld clients by using the injector_mutex and injector_cond. When distributing schema changes, the function ndbcluster_log_schema_op() handles the change distribution across the mysqld, and it finally waits on events ack'ing that all mysqld has acted upon the changes. This was implemented as a wait for the NDB_SCHEMA_OBJECT::slock_bitmap to be cleared, using the injector_cond / injector_mutex pair in a pthread_condition wait. It is the binlog injector thread which receive and handles the events signaling the above ::slock_bitmap changes. As a lock on the injector_mutex was also held when polling the eventBuffer, where the injector thread spend 99.9...% of its time, it was hardly possible for the pthread_cond signaling of ::slock_bitmap changes to get through to ndbcluster_log_schema_op(). This patch introduce a condition variable in each NDB_SCHEMA_OBJECT (NDB_SCHEMA_OBJECT::cond). The above conditional wait for NDB_SCHEMA_OBJECT::slock_bitmap to be cleared, is changed to wait on / signal the NDB_SCHEMA_OBJECT::cond & ::mutex pair.
Ole John Aske authoredThe Binlog injector depends heavily on synching the binlog injector thread and the mysqld clients by using the injector_mutex and injector_cond. When distributing schema changes, the function ndbcluster_log_schema_op() handles the change distribution across the mysqld, and it finally waits on events ack'ing that all mysqld has acted upon the changes. This was implemented as a wait for the NDB_SCHEMA_OBJECT::slock_bitmap to be cleared, using the injector_cond / injector_mutex pair in a pthread_condition wait. It is the binlog injector thread which receive and handles the events signaling the above ::slock_bitmap changes. As a lock on the injector_mutex was also held when polling the eventBuffer, where the injector thread spend 99.9...% of its time, it was hardly possible for the pthread_cond signaling of ::slock_bitmap changes to get through to ndbcluster_log_schema_op(). This patch introduce a condition variable in each NDB_SCHEMA_OBJECT (NDB_SCHEMA_OBJECT::cond). The above conditional wait for NDB_SCHEMA_OBJECT::slock_bitmap to be cleared, is changed to wait on / signal the NDB_SCHEMA_OBJECT::cond & ::mutex pair.
Loading