summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-11-24 11:40:15 +0000
committerTor Egge <Tor.Egge@oath.com>2017-11-24 11:41:28 +0000
commitea0cf7742e910dbb9c60cb6f3a8ac8ba92b5744e (patch)
tree53c00e648bb338e9a1f212689f7f0d401ee303df
parente47d6d47edec6779f11a5160e469aef4649293d5 (diff)
Use standard locking in BucketOperationLogger.
-rw-r--r--storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp1
-rw-r--r--storage/src/vespa/storage/common/bucketoperationlogger.cpp8
-rw-r--r--storage/src/vespa/storage/common/bucketoperationlogger.h4
3 files changed, 7 insertions, 6 deletions
diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
index 5ac4c4b1ee7..ad56a4083f8 100644
--- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
+++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp
@@ -4,6 +4,7 @@
#include <vespa/storage/common/bucketoperationlogger.h>
#include <vespa/vespalib/util/backtrace.h>
#include <ostream>
+#include <cassert>
#include <vespa/log/bufferedlogger.h>
LOG_SETUP(".mapbucketdatabase");
diff --git a/storage/src/vespa/storage/common/bucketoperationlogger.cpp b/storage/src/vespa/storage/common/bucketoperationlogger.cpp
index d6df7f928e2..905b704409f 100644
--- a/storage/src/vespa/storage/common/bucketoperationlogger.cpp
+++ b/storage/src/vespa/storage/common/bucketoperationlogger.cpp
@@ -34,7 +34,7 @@ BucketOperationLogger::log(const document::BucketId& id,
bool hasError = false;
{
- vespalib::LockGuard lock(_logLock);
+ std::lock_guard<std:.mutex> guard(_logLock);
BucketMapType::iterator i = _bucketMap.lower_bound(id);
if (i != _bucketMap.end() && i->first == id) {
if (i->second._history.size() >= MAX_ENTRIES) {
@@ -145,7 +145,7 @@ void
BucketOperationLogger::dumpHistoryToLog(const document::BucketId& id) const
{
LogWarnAppender handler;
- vespalib::LockGuard lock(_logLock);
+ std::lock_guard<std::mutex> guard(_logLock);
processHistory(*this, id, handler);
}
@@ -153,7 +153,7 @@ vespalib::string
BucketOperationLogger::getHistory(const document::BucketId& id) const
{
LogStringBuilder handler;
- vespalib::LockGuard lock(_logLock);
+ std::lock_guard<std::mutex> lock(_logLock);
processHistory(*this, id, handler);
return handler.ss.str();
}
@@ -167,7 +167,7 @@ BucketOperationLogger::searchBucketHistories(
ss << "<ul>\n";
// This may block for a while... Assuming such searches run when system
// is otherwise idle.
- vespalib::LockGuard lock(_logLock);
+ std::lock_guard<std::mutex> guard(_logLock);
for (BucketMapType::const_iterator
bIt(_bucketMap.begin()), bEnd(_bucketMap.end());
bIt != bEnd; ++bIt)
diff --git a/storage/src/vespa/storage/common/bucketoperationlogger.h b/storage/src/vespa/storage/common/bucketoperationlogger.h
index dce9334a9cf..af4b539a4c8 100644
--- a/storage/src/vespa/storage/common/bucketoperationlogger.h
+++ b/storage/src/vespa/storage/common/bucketoperationlogger.h
@@ -2,10 +2,10 @@
#pragma once
#include <vespa/vespalib/stllike/string.h>
-#include <vespa/vespalib/util/sync.h>
#include <vespa/document/bucket/bucketid.h>
#include <map>
#include <list>
+#include <mutex>
/**
* Enable this to log most slotfile operations (such as all mutations) as
@@ -85,7 +85,7 @@ struct BucketOperationLogger
typedef std::map<document::BucketId, State> BucketMapType;
- vespalib::Lock _logLock;
+ std::mutex _logLock;
BucketMapType _bucketMap;
void log(const document::BucketId& id,