Reject (roll back) a database transaction left in an “incomplete” state.
MCO_RET mco_disk_reject_transaction(/*IN*/ char const* log_file_path,
/*IN*/ MCO_LOG_TYPE log_type);
log_file_path
log_type
This function rejects (rolls back) a database transaction left in an “incomplete” state. It is used to process two-phase commit for persistent databases. The two-phase commit is intended to coordinate multiple external eXtremeDB transactions or an eXtremeDB transaction with some other external transaction processing system (such as another DBMS). If the application running a persistent eXtremeDB database has failed in between the first and the second phase of the commit, upon restart the eXtremeDB application needs to receive instructions from an external transaction coordinator to either commit or roll back the last uncommitted transaction. This function does exactly this: it rolls back the last (uncompleted) transaction. It is important to note that this function must be called before opening the database.
MCO_S_OK
Application snippet:
const char *dbname = "SimpleDb";
int main(int argc, char *argv[])
{
mco_db_h db;
MCO_RET rc;
mco_device_t dev;
mco_db_params_t db_params;
bool recover = true;
...
if ( recover )
{
rc = mco_disk_confirm_transaction("ph2disk.log", REDO_LOG);
}
else
{
rc = mco_disk_reject_transaction("ph2disk.log", REDO_LOG);
}
...
rc = mco_db_open_dev(dbname, simple_get_dictionary(), &dev, 1, &db_params);
if ( MCO_S_OK != rc )
{
rc = mco_db_connect(dbname, &db);
...
}
...
}