[Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 15:50:18 +0000 (15:50 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 15:50:18 +0000 (15:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197040
<rdar://problem/49997641>

Reviewed by Antti Koivisto.

Delay write operations in case synchronize is ongoing.
This is restricted to AvoidRandomness mode which is always used by CacheAPI
and is also used by network cache for layout tests.

Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.

* NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::Storage::synchronize):
(WebKit::NetworkCache::Storage::store):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244645 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp

index ff09abe..e32eb49 100644 (file)
@@ -1,3 +1,21 @@
+2019-04-25  Youenn Fablet  <youenn@apple.com>
+
+        [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=197040
+        <rdar://problem/49997641>
+
+        Reviewed by Antti Koivisto.
+
+        Delay write operations in case synchronize is ongoing.
+        This is restricted to AvoidRandomness mode which is always used by CacheAPI
+        and is also used by network cache for layout tests.
+
+        Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.
+
+        * NetworkProcess/cache/NetworkCacheStorage.cpp:
+        (WebKit::NetworkCache::Storage::synchronize):
+        (WebKit::NetworkCache::Storage::store):
+
 2019-04-25  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r244627.
index 138cbb0..58be2ca 100644 (file)
@@ -349,6 +349,8 @@ void Storage::synchronize()
             m_blobFilter = WTFMove(blobFilter);
             m_approximateRecordsSize = recordsSize;
             m_synchronizationInProgress = false;
+            if (m_mode == Mode::AvoidRandomness)
+                dispatchPendingWriteOperations();
         });
 
     });
@@ -897,7 +899,7 @@ void Storage::store(const Record& record, MappedBodyHandler&& mappedBodyHandler,
     addToRecordFilter(record.key);
 
     bool isInitialWrite = m_pendingWriteOperations.size() == 1;
-    if (!isInitialWrite)
+    if (!isInitialWrite || (m_synchronizationInProgress && m_mode == Mode::AvoidRandomness))
         return;
 
     m_writeOperationDispatchTimer.startOneShot(m_initialWriteDelay);