Browse Source

Merge branch 'master' into mq

pull/5890/head
chrislu 8 months ago
parent
commit
b5d36541d9
  1. 6
      k8s/charts/seaweedfs/templates/filer-statefulset.yaml
  2. 6
      k8s/charts/seaweedfs/templates/master-statefulset.yaml
  3. 6
      k8s/charts/seaweedfs/templates/s3-deployment.yaml
  4. 6
      k8s/charts/seaweedfs/templates/volume-statefulset.yaml
  5. 24
      k8s/charts/seaweedfs/values.yaml
  6. 43
      weed/filer/filer_deletion.go
  7. 8
      weed/server/master_grpc_server.go

6
k8s/charts/seaweedfs/templates/filer-statefulset.yaml

@ -35,10 +35,16 @@ spec:
{{ with .Values.podLabels }} {{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.filer.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations: annotations:
{{ with .Values.podAnnotations }} {{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.filer.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec: spec:
restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }} restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }}
{{- if .Values.filer.affinity }} {{- if .Values.filer.affinity }}

6
k8s/charts/seaweedfs/templates/master-statefulset.yaml

@ -34,10 +34,16 @@ spec:
{{ with .Values.podLabels }} {{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.master.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations: annotations:
{{ with .Values.podAnnotations }} {{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.master.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec: spec:
restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }} restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }}
{{- if .Values.master.affinity }} {{- if .Values.master.affinity }}

6
k8s/charts/seaweedfs/templates/s3-deployment.yaml

@ -27,10 +27,16 @@ spec:
{{ with .Values.podLabels }} {{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.s3.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations: annotations:
{{ with .Values.podAnnotations }} {{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.s3.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec: spec:
restartPolicy: {{ default .Values.global.restartPolicy .Values.s3.restartPolicy }} restartPolicy: {{ default .Values.global.restartPolicy .Values.s3.restartPolicy }}
{{- if .Values.s3.tolerations }} {{- if .Values.s3.tolerations }}

6
k8s/charts/seaweedfs/templates/volume-statefulset.yaml

@ -28,10 +28,16 @@ spec:
{{ with .Values.podLabels }} {{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.volume.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations: annotations:
{{ with .Values.podAnnotations }} {{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.volume.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec: spec:
{{- if .Values.volume.affinity }} {{- if .Values.volume.affinity }}
affinity: affinity:

24
k8s/charts/seaweedfs/values.yaml

@ -127,6 +127,12 @@ master:
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
# Labels to be added to the master pods
podLabels: {}
# Annotations to be added to the master pods
podAnnotations: {}
## Set podManagementPolicy ## Set podManagementPolicy
podManagementPolicy: Parallel podManagementPolicy: Parallel
@ -369,6 +375,12 @@ volume:
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
# Labels to be added to the volume pods
podLabels: {}
# Annotations to be added to the volume pods
podAnnotations: {}
## Set podManagementPolicy ## Set podManagementPolicy
podManagementPolicy: Parallel podManagementPolicy: Parallel
@ -551,6 +563,12 @@ filer:
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
# Labels to be added to the filer pods
podLabels: {}
# Annotations to be added to the filer pods
podAnnotations: {}
## Set podManagementPolicy ## Set podManagementPolicy
podManagementPolicy: Parallel podManagementPolicy: Parallel
@ -761,6 +779,12 @@ s3:
extraVolumes: "" extraVolumes: ""
extraVolumeMounts: "" extraVolumeMounts: ""
# Labels to be added to the s3 pods
podLabels: {}
# Annotations to be added to the s3 pods
podAnnotations: {}
# Resource requests, limits, etc. for the server cluster placement. This # Resource requests, limits, etc. for the server cluster placement. This
# should map directly to the value of the resources field for a PodSpec, # should map directly to the value of the resources field for a PodSpec,
# formatted as a multi-line string. By default no direct resource request # formatted as a multi-line string. By default no direct resource request

43
weed/filer/filer_deletion.go

@ -2,7 +2,6 @@ package filer
import ( import (
"github.com/seaweedfs/seaweedfs/weed/storage" "github.com/seaweedfs/seaweedfs/weed/storage"
"math"
"strings" "strings"
"time" "time"
@ -138,47 +137,19 @@ func (f *Filer) DeleteChunksNotRecursive(chunks []*filer_pb.FileChunk) {
} }
func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) { func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
if oldEntry == nil {
return
var oldChunks, newChunks []*filer_pb.FileChunk
if oldEntry != nil {
oldChunks = oldEntry.GetChunks()
} }
if newEntry == nil {
f.DeleteChunks(oldEntry.GetChunks())
return
if newEntry != nil {
newChunks = newEntry.GetChunks()
} }
var toDelete []*filer_pb.FileChunk
newChunkIds := make(map[string]bool)
newDataChunks, newManifestChunks, err := ResolveChunkManifest(f.MasterClient.GetLookupFileIdFunction(),
newEntry.GetChunks(), 0, math.MaxInt64)
if err != nil {
glog.Errorf("Failed to resolve new entry chunks when delete old entry chunks. new: %s, old: %s",
newEntry.GetChunks(), oldEntry.Chunks)
return
}
for _, newChunk := range newDataChunks {
newChunkIds[newChunk.GetFileIdString()] = true
}
for _, newChunk := range newManifestChunks {
newChunkIds[newChunk.GetFileIdString()] = true
}
oldDataChunks, oldManifestChunks, err := ResolveChunkManifest(f.MasterClient.GetLookupFileIdFunction(),
oldEntry.GetChunks(), 0, math.MaxInt64)
toDelete, err := MinusChunks(f.MasterClient.GetLookupFileIdFunction(), oldChunks, newChunks)
if err != nil { if err != nil {
glog.Errorf("Failed to resolve old entry chunks when delete old entry chunks. new: %s, old: %s", glog.Errorf("Failed to resolve old entry chunks when delete old entry chunks. new: %s, old: %s",
newEntry.GetChunks(), oldEntry.GetChunks())
newChunks, oldChunks)
return return
} }
for _, oldChunk := range oldDataChunks {
if _, found := newChunkIds[oldChunk.GetFileIdString()]; !found {
toDelete = append(toDelete, oldChunk)
}
}
for _, oldChunk := range oldManifestChunks {
if _, found := newChunkIds[oldChunk.GetFileIdString()]; !found {
toDelete = append(toDelete, oldChunk)
}
}
f.DeleteChunksNotRecursive(toDelete) f.DeleteChunksNotRecursive(toDelete)
} }

8
weed/server/master_grpc_server.go

@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/google/uuid"
"github.com/seaweedfs/seaweedfs/weed/cluster" "github.com/seaweedfs/seaweedfs/weed/cluster"
"net" "net"
"sort" "sort"
@ -260,7 +261,12 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
return ms.informNewLeader(stream) return ms.informNewLeader(stream)
} }
peerAddress := pb.ServerAddress(req.ClientAddress)
clientAddress := req.ClientAddress
// Ensure that the clientAddress is unique.
if clientAddress == "" {
clientAddress = uuid.New().String()
}
peerAddress := pb.ServerAddress(clientAddress)
// buffer by 1 so we don't end up getting stuck writing to stopChan forever // buffer by 1 so we don't end up getting stuck writing to stopChan forever
stopChan := make(chan bool, 1) stopChan := make(chan bool, 1)

Loading…
Cancel
Save