From bff99ecc75417c3e428cb1883da34a60de3204e0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 18 Oct 2020 21:02:08 -0700 Subject: [PATCH 1/5] build add git version --- docker/Dockerfile.go_build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.go_build b/docker/Dockerfile.go_build index 306ce3aa1..3628d0c0d 100644 --- a/docker/Dockerfile.go_build +++ b/docker/Dockerfile.go_build @@ -2,7 +2,9 @@ FROM frolvlad/alpine-glibc as builder RUN apk add git go g++ RUN mkdir -p /go/src/github.com/chrislusf/ RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs -RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install +RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \ + && LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \ + && go install -ldflags ${LDFLAGS} FROM alpine AS final LABEL author="Chris Lu" From a47e8f4c06c916552bca5ccc00d67e889b04968b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 18 Oct 2020 21:07:37 -0700 Subject: [PATCH 2/5] adjust --- docker/Dockerfile.go_build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.go_build b/docker/Dockerfile.go_build index 3628d0c0d..213ed2dee 100644 --- a/docker/Dockerfile.go_build +++ b/docker/Dockerfile.go_build @@ -3,7 +3,7 @@ RUN apk add git go g++ RUN mkdir -p /go/src/github.com/chrislusf/ RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \ - && LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \ + && export LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \ && go install -ldflags ${LDFLAGS} FROM alpine AS final From b843358d65ce61cb2efaae7b3f81aeb2457e427f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 18 Oct 2020 21:27:07 -0700 Subject: [PATCH 3/5] adjust --- docker/Dockerfile.go_build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.go_build b/docker/Dockerfile.go_build index 213ed2dee..29b9a85d8 100644 --- a/docker/Dockerfile.go_build +++ b/docker/Dockerfile.go_build @@ -4,7 +4,7 @@ RUN mkdir -p /go/src/github.com/chrislusf/ RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \ && export LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \ - && go install -ldflags ${LDFLAGS} + && go install -ldflags "${LDFLAGS}" FROM alpine AS final LABEL author="Chris Lu" From da6b9e673b3ab1cfe87db40eb7eff540316f8b13 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 18 Oct 2020 21:28:19 -0700 Subject: [PATCH 4/5] add build version --- docker/Dockerfile.go_build_large | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.go_build_large b/docker/Dockerfile.go_build_large index e0af93173..fa22aeade 100644 --- a/docker/Dockerfile.go_build_large +++ b/docker/Dockerfile.go_build_large @@ -2,7 +2,9 @@ FROM frolvlad/alpine-glibc as builder RUN apk add git go g++ RUN mkdir -p /go/src/github.com/chrislusf/ RUN git clone https://github.com/chrislusf/seaweedfs /go/src/github.com/chrislusf/seaweedfs -RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install -tags 5BytesOffset +RUN cd /go/src/github.com/chrislusf/seaweedfs/weed \ + && export LDFLAGS="-X github.com/chrislusf/seaweedfs/weed/util.COMMIT=$(git rev-parse --short HEAD)" \ + && go install -tags 5BytesOffset -ldflags "${LDFLAGS}" FROM alpine AS final LABEL author="Chris Lu" From 69f0da5d73b6f681b2313e3230a39e254693f453 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 19 Oct 2020 00:12:42 -0700 Subject: [PATCH 5/5] mount: pass along replication and collection parameters --- weed/filesys/wfs_write.go | 2 +- weed/server/filer_server_handlers_write.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.go index e7db31203..27b2297ed 100644 --- a/weed/filesys/wfs_write.go +++ b/weed/filesys/wfs_write.go @@ -65,6 +65,6 @@ func (wfs *WFS) saveDataAsChunk(dir string) filer.SaveDataAsChunkFunctionType { wfs.chunkCache.SetChunk(fileId, data) chunk = uploadResult.ToPbFileChunk(fileId, offset) - return chunk, "", "", nil + return chunk, collection, replication, nil } } diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go index 0091ae3ce..584ab9823 100644 --- a/weed/server/filer_server_handlers_write.go +++ b/weed/server/filer_server_handlers_write.go @@ -139,6 +139,7 @@ func (fs *FilerServer) detectCollection(requestURI, qCollection, qReplication st } // required by buckets folder + bucketDefaultReplication := "" if strings.HasPrefix(requestURI, fs.filer.DirBucketsPath+"/") { bucketAndObjectKey := requestURI[len(fs.filer.DirBucketsPath)+1:] t := strings.Index(bucketAndObjectKey, "/") @@ -148,7 +149,10 @@ func (fs *FilerServer) detectCollection(requestURI, qCollection, qReplication st if t > 0 { collection = bucketAndObjectKey[:t] } - replication, fsync = fs.filer.ReadBucketOption(collection) + bucketDefaultReplication, fsync = fs.filer.ReadBucketOption(collection) + } + if replication == "" { + replication = bucketDefaultReplication } return