Hi,
i'm not sure it's correct and possible...i have 4 Database with 200000
entry (Key = long; Data= long)...
i excute for 1 minute a function ( 1 singular transaction ) for search
item in every 4 database... a key is increased (1 -> 200000)...and at
the end i have calculate 45000 transaction/sec...
....for me it's a very big number and i'm not sure this is possible...in
particular:
1- my function is correct ? (see below)
2- is true? is a singular transaction with 4 different "Get/Select" in
four different database
3- i set the environment for memory log...it's correct ? are yet safe
transaction ???
4- i have a way for are sure that these are not simple "Get/Select" ?
Environment:
DbEnv myEnv(0);
DbEnv* myEnvp = &myEnv;
try{
myEnv.set_flags(DB_LOG_INMEMORY,1);
myEnv.set_lg_bsize(200 * 1024 * 1024);
myEnv.open(envHome.c_str(), env_flags, 0)

.....
}
My Function:
int show_item_table(DbEnv* myEnvp, Db* table1DBp, Db* table2DBp, Db*
table3DBp, Db* table4DBp, long &item)
{
DbTxn *txn = NULL;
Dbc *cursor1p =NULL;
Dbc *cursor2p =NULL;
Dbc *cursor3p =NULL;
Dbc *cursor4p =NULL;
try {
DbTxn *txn = NULL;
myEnvp->txn_begin(NULL, &txn, 0);
table1DBp->cursor(txn, &cursor1p, 0);
table2DBp->cursor(txn, &cursor2p, 0);
table3DBp->cursor(txn, &cursor3p, 0);
table4DBp->cursor(txn, &cursor4p, 0);
// query di una particolare KEY - DATA
Dbt key(&item,sizeof(long));
Dbt data;
try {
table1DBp->get(txn, &key, &data, 0);
Table1Data table1Item(data.get_data());
//table1Item.show();
table2DBp->get(txn, &key, &data, 0);
Table2Data table2Item(data.get_data());
//table2Item.show();
table3DBp->get(txn, &key, &data, 0);
Table3Data table3Item(data.get_data());
//table3Item.show();
table4DBp->get(txn, &key, &data, 0);
Table4Data table4Item(data.get_data());
//table4Item.show();
cursor1p->close();
cursor2p->close();
cursor3p->close();
cursor4p->close();
txn->commit(0);
} catch (DbException &e) {
std::cerr << "Error in transaction: "
<< e.what() << std::endl;
txn->abort();
}
} catch(DbException &e1) {
table1DBp->err(e1.get_errno(), "Error in show_all_records");
cursor1p->close();
cursor2p->close();
cursor3p->close();
cursor4p->close();
throw e1;
} catch(std::exception &e) {
cursor1p->close();
cursor2p->close();
cursor3p->close();
cursor4p->close();
throw e;
}
return (0);
}