Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

MySQL NDB Cluster API Developer Guide  /  ...  /  Structured Log Events

3.1.2 Structured Log Events

The following steps are involved:

  1. Create an NdbLogEventHandle using ndb_mgm_create_logevent_handle().

  2. Wait for and store log events using ndb_logevent_get_next().

  3. The log event data is available in the structure ndb_logevent. The data which is specific to a particular event is stored in a union between structures; use ndb_logevent::type to decide which structure is valid.

The following sample code demonstrates listening to events related to backups:

int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
NdbLogEventHandle le_handle= ndb_mgm_create_logevent_handle(handle, filter);
struct ndb_logevent le;
int r= ndb_logevent_get_next(le_handle, &le, 0);
if(r < 0)
  /*  error  */
else if(r == 0)
  /*  no event  */

  case NDB_LE_BackupStarted:
    ... le.BackupStarted.starting_node;
    ... le.BackupStarted.backup_id;
  case NDB_LE_BackupFailedToStart:
    ... le.BackupFailedToStart.error;
  case NDB_LE_BackupCompleted:
    ... le.BackupCompleted.stop_gci;
  case NDB_LE_BackupAborted:
    ... le.BackupStarted.backup_id;

For more information, see Section 3.2.1, “Log Event Functions”.

Available log event types are listed in Section 3.3.4, “The Ndb_logevent_type Type”, as well as in the file /storage/ndb/include/mgmapi/ndb_logevent.h in the NDB Cluster sources.

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.