Title: [146628] trunk/Source
- Revision
- 146628
- Author
- [email protected]
- Date
- 2013-03-22 10:34:20 -0700 (Fri, 22 Mar 2013)
Log Message
IndexedDB: Histogram available disk space on attempt to open database
https://bugs.webkit.org/show_bug.cgi?id=112862
Reviewed by Tony Chang.
Source/Platform:
* chromium/public/Platform.h:
(WebKit::Platform::availableDiskSpaceInBytes):
(Platform):
Source/WebCore:
ChromeOS suspects they might be hitting disk corruption when the disks
are nearly full. This patch logs the available space to either the
"success" or the "fail" histogram as appropriate so that the
distributions can be compared.
No new tests - I don't know of a good way to test histograms. Local
printf testing didn't turn up any bugs.
* platform/leveldb/LevelDBDatabase.cpp:
(WebCore::HistogramFreeSpace):
(WebCore):
(WebCore::LevelDBDatabase::open):
Modified Paths
Diff
Modified: trunk/Source/Platform/ChangeLog (146627 => 146628)
--- trunk/Source/Platform/ChangeLog 2013-03-22 17:11:53 UTC (rev 146627)
+++ trunk/Source/Platform/ChangeLog 2013-03-22 17:34:20 UTC (rev 146628)
@@ -1,3 +1,14 @@
+2013-03-22 David Grogan <[email protected]>
+
+ IndexedDB: Histogram available disk space on attempt to open database
+ https://bugs.webkit.org/show_bug.cgi?id=112862
+
+ Reviewed by Tony Chang.
+
+ * chromium/public/Platform.h:
+ (WebKit::Platform::availableDiskSpaceInBytes):
+ (Platform):
+
2013-03-22 Tommy Widenflycht <[email protected]>
MediaStream API: Finalize the RTCPeerConnection states
Modified: trunk/Source/Platform/chromium/public/Platform.h (146627 => 146628)
--- trunk/Source/Platform/chromium/public/Platform.h 2013-03-22 17:11:53 UTC (rev 146627)
+++ trunk/Source/Platform/chromium/public/Platform.h 2013-03-22 17:34:20 UTC (rev 146628)
@@ -359,7 +359,10 @@
// Callable from a background WebKit thread.
virtual void callOnMainThread(void (*func)(void*), void* context) { }
+ // Checks the partition/volume where fileName resides.
+ virtual long long availableDiskSpaceInBytes(const WebString& fileName) { return 0; }
+
// Testing -------------------------------------------------------------
#define HAVE_WEBUNITTESTSUPPORT 1
Modified: trunk/Source/WebCore/ChangeLog (146627 => 146628)
--- trunk/Source/WebCore/ChangeLog 2013-03-22 17:11:53 UTC (rev 146627)
+++ trunk/Source/WebCore/ChangeLog 2013-03-22 17:34:20 UTC (rev 146628)
@@ -1,3 +1,23 @@
+2013-03-22 David Grogan <[email protected]>
+
+ IndexedDB: Histogram available disk space on attempt to open database
+ https://bugs.webkit.org/show_bug.cgi?id=112862
+
+ Reviewed by Tony Chang.
+
+ ChromeOS suspects they might be hitting disk corruption when the disks
+ are nearly full. This patch logs the available space to either the
+ "success" or the "fail" histogram as appropriate so that the
+ distributions can be compared.
+
+ No new tests - I don't know of a good way to test histograms. Local
+ printf testing didn't turn up any bugs.
+
+ * platform/leveldb/LevelDBDatabase.cpp:
+ (WebCore::HistogramFreeSpace):
+ (WebCore):
+ (WebCore::LevelDBDatabase::open):
+
2013-03-22 Nate Chapin <[email protected]>
REGRESSION (r146239): Reproducible crash in WebCore::DocumentLoader::responseReceived.
Modified: trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp (146627 => 146628)
--- trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp 2013-03-22 17:11:53 UTC (rev 146627)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp 2013-03-22 17:34:20 UTC (rev 146628)
@@ -46,6 +46,7 @@
#if PLATFORM(CHROMIUM)
#include <env_idb.h>
+#include <public/Platform.h>
#endif
#if !PLATFORM(CHROMIUM)
@@ -142,6 +143,22 @@
return s.ok();
}
+static void histogramFreeSpace(const char* type, String fileName)
+{
+#if PLATFORM(CHROMIUM)
+ String name = "WebCore.IndexedDB.LevelDB.Open" + String(type) + "FreeDiskSpace";
+ long long freeDiskSpaceInKBytes = WebKit::Platform::current()->availableDiskSpaceInBytes(fileName) / 1024;
+ if (freeDiskSpaceInKBytes < 0) {
+ HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDB.FreeDiskSpaceFailure", 1/*sample*/, 2/*boundary*/);
+ return;
+ }
+ int clampedDiskSpaceKBytes = freeDiskSpaceInKBytes > INT_MAX ? INT_MAX : freeDiskSpaceInKBytes;
+ const uint64_t histogramMax = static_cast<uint64_t>(1e9);
+ COMPILE_ASSERT(histogramMax <= INT_MAX, histogramMaxTooBig);
+ HistogramSupport::histogramCustomCounts(name.utf8().data(), clampedDiskSpaceKBytes, 1, histogramMax, 11/*buckets*/);
+#endif
+}
+
PassOwnPtr<LevelDBDatabase> LevelDBDatabase::open(const String& fileName, const LevelDBComparator* comparator)
{
OwnPtr<ComparatorAdapter> comparatorAdapter = adoptPtr(new ComparatorAdapter(comparator));
@@ -166,10 +183,14 @@
levelDBError = LevelDBIOError;
HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDBOpenErrors", levelDBError, LevelDBMaxError);
+ histogramFreeSpace("Failure", fileName);
+
LOG_ERROR("Failed to open LevelDB database from %s: %s", fileName.ascii().data(), s.ToString().c_str());
return nullptr;
}
+ histogramFreeSpace("Success", fileName);
+
OwnPtr<LevelDBDatabase> result = adoptPtr(new LevelDBDatabase);
result->m_db = adoptPtr(db);
result->m_comparatorAdapter = comparatorAdapter.release();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes