Merge pull request #333 from hxiaodon/master

fix volume_layout bug, add new feature for volume etag write,filer pa…
This commit is contained in:
Chris Lu 2016-06-29 01:48:30 -07:00 committed by GitHub
commit 5771225f54
3 changed files with 11 additions and 2 deletions

View file

@ -70,6 +70,13 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
return
}
u, _ := url.Parse(urlString)
q := u.Query()
for key, values := range r.URL.Query() {
for _, value := range values {
q.Add(key, value)
}
}
u.RawQuery = q.Encode()
request := &http.Request{
Method: r.Method,
URL: u,

View file

@ -42,6 +42,8 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
ret.Name = string(needle.Name)
}
ret.Size = size
etag := needle.Etag()
w.Header().Set("Etag", etag)
writeJsonQuiet(w, r, httpStatus, ret)
}

View file

@ -79,11 +79,11 @@ func (vl *VolumeLayout) addToWritable(vid storage.VolumeId) {
}
func (vl *VolumeLayout) isOversized(v *storage.VolumeInfo) bool {
return uint64(v.Size) < vl.volumeSizeLimit
return uint64(v.Size) >= vl.volumeSizeLimit
}
func (vl *VolumeLayout) isWritable(v *storage.VolumeInfo) bool {
return vl.isOversized(v) &&
return !vl.isOversized(v) &&
v.Version == storage.CurrentVersion &&
!v.ReadOnly
}