MySQL :: MySQL 8.0 Reference Manual :: 7.5.5 Scheduler Component (original) (raw)

7.5.5 Scheduler Component

Note

The scheduler component is included in MySQL Enterprise Edition, a commercial product. To learn more about commercial products, see https://www.mysql.com/products/.

As of MySQL 8.0.34, the scheduler component provides an implementation of themysql_scheduler service that enables applications, components, or plugins to configure, run, and unconfigure tasks every N seconds. For example, the audit_log server plugin calls thescheduler component at its initialization and configures a regular, recurring flush of its memory cache (seeEnabling the Audit Log Flush Task).

For installation instructions, seeSection 7.5.1, “Installing and Uninstalling Components”.

The scheduler component implements the service using these elements:

When a caller invokes themysql_scheduler.create() service, it creates a new scheduled task instance to add to the queue, which signals the semaphore of the background thread. A handle to the new task is returned to the caller. The calling code should keep this handle and the service reference to the scheduling service until after calling the mysql_scheduler.destroy() service. When the caller invokes destroy() and passes in the handle it received from create(), the service waits for the task to become inactive (if running) and then removes it from the inactive queue.

The component service calls each application-provided callback (function pointer) into the same scheduler thread, one at a time and in ascending order, based on the time each requires to run.

Developers who wish to incorporate scheduler-queueing capabilities into an application, component, or plugin should consult themysql_scheduler.h file in a MySQL source distribution.