Commit 309eb62d authored by dgrogan@chromium.org's avatar dgrogan@chromium.org
Browse files

IndexedDB: Histogram cause of LevelDB write errors

https://bugs.webkit.org/show_bug.cgi?id=113350

Reviewed by Tony Chang.

Add histogram for source of LevelDB errors on Write in addition to
Open.

No new tests - no good way to test histogram code.

* platform/leveldb/LevelDBDatabase.cpp:
(WebCore::histogramLevelDBError):
(WebCore):
(WebCore::LevelDBDatabase::open):
(WebCore::LevelDBDatabase::write):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146950 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1f897272
2013-03-26 David Grogan <dgrogan@chromium.org>
IndexedDB: Histogram cause of LevelDB write errors
https://bugs.webkit.org/show_bug.cgi?id=113350
Reviewed by Tony Chang.
Add histogram for source of LevelDB errors on Write in addition to
Open.
No new tests - no good way to test histogram code.
* platform/leveldb/LevelDBDatabase.cpp:
(WebCore::histogramLevelDBError):
(WebCore):
(WebCore::LevelDBDatabase::open):
(WebCore::LevelDBDatabase::write):
2013-03-26 Chris Fleizach <cfleizach@apple.com>
 
WebKit does not expose @required or @aria-required as AXRequired on select elements
......@@ -159,6 +159,26 @@ static void histogramFreeSpace(const char* type, String fileName)
#endif
}
static void histogramLevelDBError(const char* histogramName, const leveldb::Status& s)
{
ASSERT(!s.ok());
enum {
LevelDBNotFound,
LevelDBCorruption,
LevelDBIOError,
LevelDBOther,
LevelDBMaxError
};
int levelDBError = LevelDBOther;
if (s.IsNotFound())
levelDBError = LevelDBNotFound;
else if (s.IsCorruption())
levelDBError = LevelDBCorruption;
else if (s.IsIOError())
levelDBError = LevelDBIOError;
HistogramSupport::histogramEnumeration(histogramName, levelDBError, LevelDBMaxError);
}
PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const LevelDBComparator* comparator)
{
OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter(comparator));
......@@ -167,22 +187,7 @@ PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const
const leveldb::Status s = openDB(comparatorAdapter.get(), leveldb::IDBEnv(), fileName, &db);
if (!s.ok()) {
enum {
LevelDBNotFound,
LevelDBCorruption,
LevelDBIOError,
LevelDBOther,
LevelDBMaxError
};
int levelDBError = LevelDBOther;
if (s.IsNotFound())
levelDBError = LevelDBNotFound;
else if (s.IsCorruption())
levelDBError = LevelDBCorruption;
else if (s.IsIOError())
levelDBError = LevelDBIOError;
HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDBOpenErrors", levelDBError, LevelDBMaxError);
histogramLevelDBError("WebCore.IndexedDB.LevelDBOpenErrors", s);
histogramFreeSpace("Failure", fileName);
LOG_ERROR("Failed to open LevelDB database from %s: %s", fileName.ascii().data(), s.ToString().c_str());
......@@ -276,6 +281,7 @@ bool LevelDBDatabase::write(LevelDBWriteBatch& writeBatch)
const leveldb::Status s = m_db->Write(writeOptions, writeBatch.m_writeBatch.get());
if (s.ok())
return true;
histogramLevelDBError("WebCore.IndexedDB.LevelDBWriteErrors", s);
LOG_ERROR("LevelDB write failed: %s", s.ToString().c_str());
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment