|
@ -171,28 +171,27 @@ func (fs *FilerServer) dataToChunk(fileName, contentType string, data []byte, ch |
|
|
var auth security.EncodedJwt |
|
|
var auth security.EncodedJwt |
|
|
var uploadErr error |
|
|
var uploadErr error |
|
|
var uploadResult *operation.UploadResult |
|
|
var uploadResult *operation.UploadResult |
|
|
for i := 0; i < 3; i++ { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err := util.Retry("filerDataToChunk", func() error { |
|
|
// assign one file id for one chunk
|
|
|
// assign one file id for one chunk
|
|
|
fileId, urlLocation, auth, uploadErr = fs.assignNewFileInfo(so) |
|
|
fileId, urlLocation, auth, uploadErr = fs.assignNewFileInfo(so) |
|
|
if uploadErr != nil { |
|
|
if uploadErr != nil { |
|
|
glog.V(4).Infof("retry later due to assign error: %v", uploadErr) |
|
|
glog.V(4).Infof("retry later due to assign error: %v", uploadErr) |
|
|
stats.FilerRequestCounter.WithLabelValues(stats.ChunkAssignRetry).Inc() |
|
|
stats.FilerRequestCounter.WithLabelValues(stats.ChunkAssignRetry).Inc() |
|
|
time.Sleep(time.Duration(i+1) * 251 * time.Millisecond) |
|
|
|
|
|
continue |
|
|
|
|
|
|
|
|
return uploadErr |
|
|
} |
|
|
} |
|
|
// upload the chunk to the volume server
|
|
|
// upload the chunk to the volume server
|
|
|
uploadResult, uploadErr, _ = fs.doUpload(urlLocation, dataReader, fileName, contentType, nil, auth) |
|
|
uploadResult, uploadErr, _ = fs.doUpload(urlLocation, dataReader, fileName, contentType, nil, auth) |
|
|
if uploadErr != nil { |
|
|
if uploadErr != nil { |
|
|
glog.V(4).Infof("retry later due to upload error: %v", uploadErr) |
|
|
glog.V(4).Infof("retry later due to upload error: %v", uploadErr) |
|
|
stats.FilerRequestCounter.WithLabelValues(stats.ChunkDoUploadRetry).Inc() |
|
|
stats.FilerRequestCounter.WithLabelValues(stats.ChunkDoUploadRetry).Inc() |
|
|
time.Sleep(time.Duration(i+1) * 251 * time.Millisecond) |
|
|
|
|
|
continue |
|
|
|
|
|
} |
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
return uploadErr |
|
|
} |
|
|
} |
|
|
if uploadErr != nil { |
|
|
|
|
|
glog.Errorf("upload error: %v", uploadErr) |
|
|
|
|
|
return nil, uploadErr |
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
glog.Errorf("upload error: %v", err) |
|
|
|
|
|
return nil, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// if last chunk exhausted the reader exactly at the border
|
|
|
// if last chunk exhausted the reader exactly at the border
|
|
|