summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-18 13:49:21 +0200
committerVincent Petry <pvince81@owncloud.com>2016-05-18 13:58:20 +0200
commitd46355a415a257535b4282740d3f9bb6794cf440 (patch)
tree5928c224176bd878fd5d5253c17754890e0ae215
parent76b4b367f6f2ad616abb02059e7bba0dd36cca8e (diff)
downloadnextcloud-server-d46355a415a257535b4282740d3f9bb6794cf440.tar.gz
nextcloud-server-d46355a415a257535b4282740d3f9bb6794cf440.zip
Allow chunk GC mtime tolerance for unfinished part chunks
Whenever part chunks are written, every fwrite in the write loop will reset the mtime to the current mtime. Only at the end will the touch() operation set the mtime to now + ttl, in the future. However the GC code is expecting that every chunk with mtime < now are old and must be deleted. This causes the GC to sometimes delete part chunks in which the write loop is slow. To fix this, a tolerance value is added in the GC code to allow for more time before a part chunk gets deleted.
-rw-r--r--lib/private/cache/file.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index 69008c7fab5..a5effd265cd 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -170,7 +170,9 @@ class File implements ICache {
public function gc() {
$storage = $this->getStorage();
if ($storage and $storage->is_dir('/')) {
- $now = time();
+ // extra hour safety, in case of stray part chunks that take longer to write,
+ // because touch() is only called after the chunk was finished
+ $now = time() - 3600;
$dh = $storage->opendir('/');
if (!is_resource($dh)) {
return null;