better logs

This commit is contained in:
Chris Lu 2018-05-24 23:20:26 -07:00
parent 9f4f8de9ad
commit 7b81cf3762

View file

@ -143,9 +143,9 @@ func (fh *FileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *f
Collection: "", Collection: "",
} }
glog.V(1).Infof("assign volume: %v", request)
resp, err := client.AssignVolume(ctx, request) resp, err := client.AssignVolume(ctx, request)
if err != nil { if err != nil {
glog.V(0).Infof("assign volume failure %v: %v", request, err)
return err return err
} }
@ -160,9 +160,11 @@ func (fh *FileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *f
bufReader := bytes.NewReader(req.Data) bufReader := bytes.NewReader(req.Data)
uploadResult, err := operation.Upload(fileUrl, fh.name, bufReader, false, "application/octet-stream", nil, "") uploadResult, err := operation.Upload(fileUrl, fh.name, bufReader, false, "application/octet-stream", nil, "")
if err != nil { if err != nil {
glog.V(0).Infof("upload data %v to %s: %v", req, fileUrl, err)
return fmt.Errorf("upload data: %v", err) return fmt.Errorf("upload data: %v", err)
} }
if uploadResult.Error != "" { if uploadResult.Error != "" {
glog.V(0).Infof("upload failure %v to %s: %v", req, fileUrl, err)
return fmt.Errorf("upload result: %v", uploadResult.Error) return fmt.Errorf("upload result: %v", uploadResult.Error)
} }
@ -217,6 +219,9 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
} }
glog.V(1).Infof("%s/%s set chunks: %v", fh.dirPath, fh.name, len(fh.Chunks)) glog.V(1).Infof("%s/%s set chunks: %v", fh.dirPath, fh.name, len(fh.Chunks))
for i, chunk := range fh.Chunks {
glog.V(1).Infof("%s/%s chunks %d: %v [%d,%d)", fh.dirPath, fh.name, i, chunk.FileId, chunk.Offset, chunk.Offset+int64(chunk.Size))
}
if _, err := client.UpdateEntry(ctx, request); err != nil { if _, err := client.UpdateEntry(ctx, request); err != nil {
return fmt.Errorf("update fh: %v", err) return fmt.Errorf("update fh: %v", err)
} }