15521: Include request ID etc. in PutBlock log messages.
authorTom Clegg <tclegg@veritasgenetics.com>
Tue, 29 Oct 2019 15:02:49 +0000 (11:02 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Tue, 29 Oct 2019 15:02:49 +0000 (11:02 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/keepstore/handlers.go

index 86de8fa194a65fbf99e9e53ecd30b574b1616843..30ea695f0c96e125598fc8042ae1501f7a2fe70b 100644 (file)
@@ -733,6 +733,8 @@ func GetBlock(ctx context.Context, volmgr *RRVolumeManager, hash string, buf []b
 //          provide as much detail as possible.
 //
 func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash string) (int, error) {
+       log := ctxlog.FromContext(ctx)
+
        // Check that BLOCK's checksum matches HASH.
        blockhash := fmt.Sprintf("%x", md5.Sum(block))
        if blockhash != hash {
@@ -762,7 +764,7 @@ func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash s
 
        writables := volmgr.AllWritable()
        if len(writables) == 0 {
-               log.Print("No writable volumes.")
+               log.Error("no writable volumes")
                return 0, FullError
        }
 
@@ -780,12 +782,12 @@ func PutBlock(ctx context.Context, volmgr *RRVolumeManager, block []byte, hash s
                        // write did not succeed.  Report the
                        // error and continue trying.
                        allFull = false
-                       log.Printf("%s: Write(%s): %s", vol, hash, err)
+                       log.Errorf("%s: Write(%s): %s", vol, hash, err)
                }
        }
 
        if allFull {
-               log.Print("All volumes are full.")
+               log.Error("all volumes are full")
                return 0, FullError
        }
        // Already logged the non-full errors.