Control the MVCC Transaction Manager behavior with respect to the number of conflicts.
void mco_trans_optimistic_threshold( /*IN*/ mco_db_h db,
/*IN*/ int max_conflicts_percent,
/*IN*/ int disable_period );
| db | The database handle that was established by mco_db_connect() |
|
max_conflicts_percent |
The number of conflicts to process before switching to “exclusive mode” |
|
disable_period |
The number of |
This function helps optimization of MVCC performance. It controls the MVCC Transaction Manager behavior with respect to the number of conflicts (MVCC works best when the number of conflicts is small and poorly when there are many conflicts). The function sets two related parameters:
max_conflicts_percentanddisable_period. During the commit the MVCC Transaction Manager increments its internal “conflicts counter” (n_conflicts) if a conflict is detected and increments its internal successful "commit counter" (n_commits) otherwise. Furthermore, if the following condition holds:n_conflicts/(n_conflicts + n_commits)*100 > max_conflicts_percentthe subsequent
READ_WRITEtransactions up to the number specified in parameterdisable_period, are executed in “exclusive mode” (only oneREAD_WRITEtransaction at a time). Note that this does not affectREAD_ONLYtransactions—they are executed in parallel withREAD_WRITEtransactions and with otherREAD_ONLYtransactions.By default this optimization is turned off, or in other words
max_conflicts_percent= 100%.
| void | No return value |
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;
...
rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
if ( MCO_S_OK != rc )
{
rc = mco_db_connect( dbname, &db );
...
mco_trans_optimistic_threshold( db, 10, 10);
...
}
...
}