mco_async_backup_stop

Stop the asynchronous backup process.

For an overview see page Incremental Online Backup in C

Prototype

    MCO_RET mco_async_backup_stop(
        /*IN*/ mco_db_h connection,
        /*IN*/ int force
    );

Arguments

connection
Database connection handle associated with the active backup operation.
force
Flag to control shutdown behavior:
  • 0 — allow the current backup cycle to complete before stopping (graceful shutdown),
  • non-zero — terminate the backup immediately (may leave the backup file in an invalid state).

Description

This function terminates the asynchronous backup cycle associated with the given database connection.

If force is zero, the function waits for the current backup record to be fully written before stopping. If force is non-zero, the backup thread is terminated immediately, which may result in a corrupted or incomplete backup record in the file.

Use forced termination only in exceptional circumstances (e.g., system shutdown or critical error).

See Incremental Backup and Restore for more details.

Return Codes

MCO_S_OK
Backup cycle successfully stopped.
MCO_E_BACKUP
No active backup cycle was found for the specified connection.

Example

    {
        const char *db_name = "myDb";
        mco_db_h con;
        MCO_RET rc;

        rc = mco_db_connect(db_name, &con);
        if (rc != MCO_S_OK) {
            /* handle connection error */
        }

        /* Forcefully stop the backup process */
        rc = mco_async_backup_stop(con, 1);
        if (rc != MCO_S_OK) {
            /* handle stop error (e.g., no active backup) */
        }
    }

Files

Header file:
mco.h
Source file:
mcobackup.c
Library:
libmcobackup.a