[ARVADOS] created: 1.1.1-262-g737f7d6

Git user git at public.curoverse.com
Thu Dec 14 22:31:23 EST 2017


        at  737f7d618ffc18152c5d09416884910bd180d890 (commit)


commit 737f7d618ffc18152c5d09416884910bd180d890
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Thu Dec 14 22:25:38 2017 -0500

    12715: Fix slow PROPFIND by avoiding content probing.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keep-web/handler.go b/services/keep-web/handler.go
index a1476d3..4cb2fdb 100644
--- a/services/keep-web/handler.go
+++ b/services/keep-web/handler.go
@@ -443,6 +443,7 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
 			FileSystem: &webdavFS{
 				collfs:  fs,
 				writing: writeMethod[r.Method],
+				reading: r.Method != "PROPFIND",
 			},
 			LockSystem: h.webdavLS,
 			Logger: func(_ *http.Request, err error) {
diff --git a/services/keep-web/webdav.go b/services/keep-web/webdav.go
index 3ceb0ed..98e6f01 100644
--- a/services/keep-web/webdav.go
+++ b/services/keep-web/webdav.go
@@ -8,6 +8,7 @@ import (
 	"crypto/rand"
 	"errors"
 	"fmt"
+	"io"
 	prand "math/rand"
 	"os"
 	"path"
@@ -37,6 +38,7 @@ var (
 type webdavFS struct {
 	collfs  arvados.CollectionFileSystem
 	writing bool
+	reading bool
 }
 
 func (fs *webdavFS) makeparents(name string) {
@@ -71,6 +73,15 @@ func (fs *webdavFS) OpenFile(ctx context.Context, name string, flag int, perm os
 		// have 405.
 		f = writeFailer{File: f, err: errReadOnly}
 	}
+	if !fs.reading {
+		// webdav PROPFIND reads the first few bytes of each
+		// file whose filename extension isn't recognized,
+		// which is prohibitively expensive: we end up
+		// fetching multiple 64MiB blocks. Avoid this by
+		// returning EOF on all reads when handling a
+		// PROPFIND.
+		f = readEOF{File: f}
+	}
 	return
 }
 
@@ -106,6 +117,14 @@ func (wf writeFailer) Close() error {
 	return wf.err
 }
 
+type readEOF struct {
+	webdav.File
+}
+
+func (readEOF) Read(p []byte) (int, error) {
+	return 0, io.EOF
+}
+
 // noLockSystem implements webdav.LockSystem by returning success for
 // every possible locking operation, even though it has no side
 // effects such as actually locking anything. This works for a

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list