Changeset 146628 in webkit


Ignore:
Timestamp:
Mar 22, 2013, 10:34:20 AM (12 years ago)
Author:
dgrogan@chromium.org
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):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/Platform/ChangeLog

    r146582 r146628  
     12013-03-22  David Grogan  <dgrogan@chromium.org>
     2
     3        IndexedDB: Histogram available disk space on attempt to open database
     4        https://bugs.webkit.org/show_bug.cgi?id=112862
     5
     6        Reviewed by Tony Chang.
     7
     8        * chromium/public/Platform.h:
     9        (WebKit::Platform::availableDiskSpaceInBytes):
     10        (Platform):
     11
    1122013-03-22  Tommy Widenflycht  <tommyw@google.com>
    213
  • trunk/Source/Platform/chromium/public/Platform.h

    r146561 r146628  
    359359    // Callable from a background WebKit thread.
    360360    virtual void callOnMainThread(void (*func)(void*), void* context) { }
     361
     362    // Checks the partition/volume where fileName resides.
     363    virtual long long availableDiskSpaceInBytes(const WebString& fileName) { return 0; }
    361364
    362365
  • trunk/Source/WebCore/ChangeLog

    r146626 r146628  
     12013-03-22  David Grogan  <dgrogan@chromium.org>
     2
     3        IndexedDB: Histogram available disk space on attempt to open database
     4        https://bugs.webkit.org/show_bug.cgi?id=112862
     5
     6        Reviewed by Tony Chang.
     7
     8        ChromeOS suspects they might be hitting disk corruption when the disks
     9        are nearly full. This patch logs the available space to either the
     10        "success" or the "fail" histogram as appropriate so that the
     11        distributions can be compared.
     12
     13        No new tests - I don't know of a good way to test histograms. Local
     14        printf testing didn't turn up any bugs.
     15
     16        * platform/leveldb/LevelDBDatabase.cpp:
     17        (WebCore::HistogramFreeSpace):
     18        (WebCore):
     19        (WebCore::LevelDBDatabase::open):
     20
    1212013-03-22  Nate Chapin  <japhet@chromium.org>
    222
  • trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp

    r146561 r146628  
    4747#if PLATFORM(CHROMIUM)
    4848#include <env_idb.h>
     49#include <public/Platform.h>
    4950#endif
    5051
     
    141142    const leveldb::Status s = leveldb::DestroyDB(fileName.utf8().data(), options);
    142143    return s.ok();
     144}
     145
     146static void histogramFreeSpace(const char* type, String fileName)
     147{
     148#if PLATFORM(CHROMIUM)
     149    String name = "WebCore.IndexedDB.LevelDB.Open" + String(type) + "FreeDiskSpace";
     150    long long freeDiskSpaceInKBytes = WebKit::Platform::current()->availableDiskSpaceInBytes(fileName) / 1024;
     151    if (freeDiskSpaceInKBytes < 0) {
     152        HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDB.FreeDiskSpaceFailure", 1/*sample*/, 2/*boundary*/);
     153        return;
     154    }
     155    int clampedDiskSpaceKBytes = freeDiskSpaceInKBytes > INT_MAX ? INT_MAX : freeDiskSpaceInKBytes;
     156    const uint64_t histogramMax = static_cast<uint64_t>(1e9);
     157    COMPILE_ASSERT(histogramMax <= INT_MAX, histogramMaxTooBig);
     158    HistogramSupport::histogramCustomCounts(name.utf8().data(), clampedDiskSpaceKBytes, 1, histogramMax, 11/*buckets*/);
     159#endif
    143160}
    144161
     
    167184        HistogramSupport::histogramEnumeration("WebCore.IndexedDB.LevelDBOpenErrors", levelDBError, LevelDBMaxError);
    168185
     186        histogramFreeSpace("Failure", fileName);
     187
    169188        LOG_ERROR("Failed to open LevelDB database from %s: %s", fileName.ascii().data(), s.ToString().c_str());
    170189        return nullptr;
    171190    }
     191
     192    histogramFreeSpace("Success", fileName);
    172193
    173194    OwnPtr<LevelDBDatabase> result = adoptPtr(new LevelDBDatabase);
Note: See TracChangeset for help on using the changeset viewer.