Move background hashed object writes to their own DB connection.

This commit is contained in:
JoelKatz
2013-04-18 17:31:06 -07:00
parent fbaee6e323
commit e296a81c83
3 changed files with 43 additions and 11 deletions

View File

@@ -94,12 +94,14 @@ void HashedObjectStore::bulkWrite()
{
Database* db = theApp->getHashNodeDB()->getDB();
ScopedLock sl(theApp->getHashNodeDB()->getDBLock());
SqliteStatement pSt(db->getSqliteDB(),
static SqliteStatement pStB(db->getSqliteDB(), "BEGIN TRANSACTION;", true);
static SqliteStatement pStE(db->getSqliteDB(), "END TRANSACTION;", true);
static SqliteStatement pSt(db->getSqliteDB(),
"INSERT OR IGNORE INTO CommittedObjects "
"(Hash,ObjType,LedgerIndex,Object) VALUES (?, ?, ?, ?);");
"(Hash,ObjType,LedgerIndex,Object) VALUES (?, ?, ?, ?);", true);
db->executeSQL("BEGIN TRANSACTION;");
pStB.step();
pStB.reset();
BOOST_FOREACH(const boost::shared_ptr<HashedObject>& it, set)
{
@@ -127,7 +129,8 @@ void HashedObjectStore::bulkWrite()
pSt.reset();
}
db->executeSQL("END TRANSACTION;");
pStE.step();
pStE.reset();
}
#else