MCO_RET mco_trans_rt_get_remaining_time (mco_trans_h t,
mco_interval_t* remaining)
t
remaining
This function returns the time in milliseconds left until the deadline expires. The time is calculated based on the current number of dirty pages (pages that have been modified by the current transaction).
This function can be used by the deadline policy callbacks. For instance the pre-defined callback for the strict deadline policy mco_trans_rt_deadline_check is implemented as follows:
MCO_RET mco_trans_rt_deadline_check(mco_trans_h t) { mco_db_connection_h con = (mco_db_connection_h)t; mco_interval_t remaining; MCO_RET ret = mco_trans_rt_get_remaining_time(t, &remaining); /* do not interrupt the rollback unless the deadline was adjusted explicitly */ if (ret == MCO_S_OK && remaining <= 0 && (con->trans.deadline != con->trans.orig_deadline || !(con->trans.flags & MCO_TRANSDF_ROLLBACK))) { ret = MCO_E_INTERRUPTED; } return ret; }
MCO_S_OK
MCO_E_INTERRUPTED