From 357245b5954c28e84bec1c89467680995428945b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 15 Oct 2012 03:08:42 -0700 Subject: [PATCH] Fix a bug that would cause a write spinout. --- src/HashedObject.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/HashedObject.cpp b/src/HashedObject.cpp index bfa3d7ee1..ca0becbef 100644 --- a/src/HashedObject.cpp +++ b/src/HashedObject.cpp @@ -52,11 +52,10 @@ bool HashedObjectStore::store(HashedObjectType type, uint32 index, void HashedObjectStore::bulkWrite() { - std::vector< boost::shared_ptr > set; - set.reserve(128); - - do { + std::vector< boost::shared_ptr > set; + set.reserve(128); + { boost::recursive_mutex::scoped_lock sl(mWriteMutex); mWriteSet.swap(set); @@ -66,7 +65,6 @@ void HashedObjectStore::bulkWrite() return; } } - cLog(lsINFO) << "HOS: BulkWrite " << set.size(); static boost::format fExists("SELECT ObjType FROM CommittedObjects WHERE Hash = '%s';"); static boost::format @@ -125,7 +123,7 @@ HashedObject::pointer HashedObjectStore::retrieve(const uint256& hash) if (!db->executeSQL(sql) || !db->startIterRows()) { - cLog(lsTRACE) << "HOS: " << hash << " fetch: not in db"; +// cLog(lsTRACE) << "HOS: " << hash << " fetch: not in db"; return HashedObject::pointer(); }