[ARVADOS] updated: 35b91242eb6bcc002815519afa24effecd8fa6b6

git at public.curoverse.com git at public.curoverse.com
Tue Sep 8 11:32:55 EDT 2015


Summary of changes:
 services/keepstore/handlers.go                     | 24 ++++++++++++++--------
 .../{mutex_test.go => mock_mutex_for_test.go}      |  0
 services/keepstore/volume.go                       |  9 ++++----
 services/keepstore/volume_unix.go                  | 12 +++++------
 4 files changed, 27 insertions(+), 18 deletions(-)
 rename services/keepstore/{mutex_test.go => mock_mutex_for_test.go} (100%)

       via  35b91242eb6bcc002815519afa24effecd8fa6b6 (commit)
       via  856bce1cade4ccfdf821d8ad2d0e0ea22e68b875 (commit)
       via  5f4b7e74af4b85f290ffe396db84a5cab6af08a1 (commit)
       via  025bf2d0e657560202cb428cd2f27f9cfc76111f (commit)
       via  4d2984d9a3c826cd8938166adf402175bb59fef2 (commit)
       via  8cefa5450eb57cfa06f13721228ba1913e7f8c3a (commit)
      from  d2db86b680a87c67fbdd59e372f42505ae8c2d4e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 35b91242eb6bcc002815519afa24effecd8fa6b6
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 8 11:32:47 2015 -0400

    7121: Fixup log messages (remove excess \n, show which volume had a Get() error).

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index b3cad7f..e6129a7 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -210,8 +210,8 @@ func StatusHandler(resp http.ResponseWriter, req *http.Request) {
 	if err == nil {
 		resp.Write(jstat)
 	} else {
-		log.Printf("json.Marshal: %s\n", err)
-		log.Printf("NodeStatus = %v\n", &st)
+		log.Printf("json.Marshal: %s", err)
+		log.Printf("NodeStatus = %v", &st)
 		http.Error(resp, err.Error(), 500)
 	}
 }
@@ -321,7 +321,7 @@ func DeleteHandler(resp http.ResponseWriter, req *http.Request) {
 		if body, err := json.Marshal(result); err == nil {
 			resp.Write(body)
 		} else {
-			log.Printf("json.Marshal: %s (result = %v)\n", err, result)
+			log.Printf("json.Marshal: %s (result = %v)", err, result)
 			http.Error(resp, err.Error(), 500)
 		}
 	}
@@ -465,7 +465,7 @@ func GetBlock(hash string) ([]byte, error) {
 			// volumes. If all volumes report IsNotExist,
 			// we return a NotFoundError.
 			if !os.IsNotExist(err) {
-				log.Printf("GetBlock: reading %s: %s\n", hash, err)
+				log.Printf("%s: Get(%s): %s", vol, hash, err)
 			}
 			continue
 		}
@@ -475,7 +475,7 @@ func GetBlock(hash string) ([]byte, error) {
 		if filehash != hash {
 			// TODO: Try harder to tell a sysadmin about
 			// this.
-			log.Printf("%s: checksum mismatch for request %s (actual %s)\n",
+			log.Printf("%s: checksum mismatch for request %s (actual %s)",
 				vol, hash, filehash)
 			error_to_caller = DiskHashError
 			bufs.Put(buf)
@@ -556,7 +556,7 @@ func PutBlock(block []byte, hash string) error {
 			// write did not succeed.  Report the
 			// error and continue trying.
 			allFull = false
-			log.Printf("%s: Write(%s): %s\n", vol, hash, err)
+			log.Printf("%s: Write(%s): %s", vol, hash, err)
 		}
 	}
 
@@ -637,7 +637,7 @@ func GetApiToken(req *http.Request) string {
 func IsExpired(timestamp_hex string) bool {
 	ts, err := strconv.ParseInt(timestamp_hex, 16, 0)
 	if err != nil {
-		log.Printf("IsExpired: %s\n", err)
+		log.Printf("IsExpired: %s", err)
 		return true
 	}
 	return time.Unix(ts, 0).Before(time.Now())

commit 856bce1cade4ccfdf821d8ad2d0e0ea22e68b875
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 8 11:23:52 2015 -0400

    7121: Log all errors (except the everyday "not found") encountered during CompareAndTouch().

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 8cc7d8b..b3cad7f 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -582,9 +582,17 @@ func CompareAndTouch(hash string, buf []byte) error {
 			// to tell which one is wanted if we have
 			// both, so there's no point writing it even
 			// on a different volume.)
+			log.Printf("%s: Compare(%s): %s", vol, hash, err)
 			return err
+		} else if os.IsNotExist(err) {
+			// Block does not exist. This is the only
+			// "normal" error: we don't log anything.
+			continue
 		} else if err != nil {
-			// Couldn't find, couldn't open, etc.: try next volume.
+			// Couldn't open file, data is corrupt on
+			// disk, etc.: log this abnormal condition,
+			// and try the next volume.
+			log.Printf("%s: Compare(%s): %s", vol, hash, err)
 			continue
 		}
 		if err := vol.Touch(hash); err != nil {

commit 5f4b7e74af4b85f290ffe396db84a5cab6af08a1
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 8 11:22:50 2015 -0400

    7121: Clarify expected behavior of Compare() in Volume interface.

diff --git a/services/keepstore/volume.go b/services/keepstore/volume.go
index d3616d0..d17af44 100644
--- a/services/keepstore/volume.go
+++ b/services/keepstore/volume.go
@@ -15,10 +15,11 @@ type Volume interface {
 	// put the returned slice back into the buffer pool when it's
 	// finished with it.
 	Get(loc string) ([]byte, error)
-	// Confirm Get() would return buf. If so, return nil. If not,
-	// return CollisionError or DiskHashError (depending on
-	// whether the data on disk matches the expected hash), or
-	// whatever error was encountered opening/reading the file.
+	// Confirm Get() would return a buffer with exactly the same
+	// content as buf. If so, return nil. If not, return
+	// CollisionError or DiskHashError (depending on whether the
+	// data on disk matches the expected hash), or whatever error
+	// was encountered opening/reading the file.
 	Compare(loc string, data []byte) error
 	Put(loc string, data []byte) error
 	Touch(loc string) error

commit 025bf2d0e657560202cb428cd2f27f9cfc76111f
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 8 11:16:44 2015 -0400

    7121: Rename mutex_test.go -> mock_mutex_for_test.go

diff --git a/services/keepstore/mutex_test.go b/services/keepstore/mock_mutex_for_test.go
similarity index 100%
rename from services/keepstore/mutex_test.go
rename to services/keepstore/mock_mutex_for_test.go

commit 4d2984d9a3c826cd8938166adf402175bb59fef2
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 8 11:06:37 2015 -0400

    7121: Update comment to match new argument name.

diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go
index 68ab06b..74bee52 100644
--- a/services/keepstore/volume_unix.go
+++ b/services/keepstore/volume_unix.go
@@ -109,7 +109,7 @@ func (v *UnixVolume) Get(loc string) ([]byte, error) {
 }
 
 // Compare returns nil if Get(loc) would return the same content as
-// cmp. It is functionally equivalent to Get() followed by
+// expect. It is functionally equivalent to Get() followed by
 // bytes.Compare(), but uses less memory.
 func (v *UnixVolume) Compare(loc string, expect []byte) error {
 	path := v.blockPath(loc)

commit 8cefa5450eb57cfa06f13721228ba1913e7f8c3a
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Sep 8 11:05:45 2015 -0400

    7121: 7218: Get the serialize lock before opening a file.
    
    In certain error cases (Stat() succeeds but Open() fails) this can
    cause a failure to wait behind the serialize lock, but in normal
    operation ("success" and "not found") it conserves open file handles
    when there's a lot of contention for the serialize lock.

diff --git a/services/keepstore/volume_unix.go b/services/keepstore/volume_unix.go
index f91861a..68ab06b 100644
--- a/services/keepstore/volume_unix.go
+++ b/services/keepstore/volume_unix.go
@@ -58,18 +58,18 @@ func (v *UnixVolume) Mtime(loc string) (time.Time, error) {
 	}
 }
 
-// Open the given file, lock the "serialize" locker if enabled, and
+// Lock the locker (if one is in use), open the file for reading, and
 // call the given function if and when the file is ready to read.
 func (v *UnixVolume) getFunc(path string, fn func(io.Reader) error) error {
+	if v.locker != nil {
+		v.locker.Lock()
+		defer v.locker.Unlock()
+	}
 	f, err := os.Open(path)
 	if err != nil {
 		return err
 	}
 	defer f.Close()
-	if v.locker != nil {
-		v.locker.Lock()
-		defer v.locker.Unlock()
-	}
 	return fn(f)
 }
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list