aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-06-09 12:14:57 -0700
committerchrislu <chris.lu@gmail.com>2024-06-09 12:14:57 -0700
commitb5d36541d9077c4cda4e0cc47e6115248d8534bb (patch)
treefb719c3ce9471a904a1cd5cbf1ee589862e0913f
parent25b2850e7d2f0a3e33568183fcb13c2862cb276b (diff)
parentdbfbabac5592d7dd5e4999c35b0619aa20921d6b (diff)
downloadseaweedfs-b5d36541d9077c4cda4e0cc47e6115248d8534bb.tar.xz
seaweedfs-b5d36541d9077c4cda4e0cc47e6115248d8534bb.zip
Merge branch 'master' into mq
-rw-r--r--k8s/charts/seaweedfs/templates/filer-statefulset.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/master-statefulset.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/s3-deployment.yaml6
-rw-r--r--k8s/charts/seaweedfs/templates/volume-statefulset.yaml6
-rw-r--r--k8s/charts/seaweedfs/values.yaml24
-rw-r--r--weed/filer/filer_deletion.go43
-rw-r--r--weed/server/master_grpc_server.go8
7 files changed, 62 insertions, 37 deletions
diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
index ae2a25ec8..22d5197c7 100644
--- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml
@@ -35,10 +35,16 @@ spec:
{{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.filer.podLabels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
annotations:
{{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.filer.podAnnotations }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
spec:
restartPolicy: {{ default .Values.global.restartPolicy .Values.filer.restartPolicy }}
{{- if .Values.filer.affinity }}
diff --git a/k8s/charts/seaweedfs/templates/master-statefulset.yaml b/k8s/charts/seaweedfs/templates/master-statefulset.yaml
index 2fe476fa4..358f7f1cf 100644
--- a/k8s/charts/seaweedfs/templates/master-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/master-statefulset.yaml
@@ -34,10 +34,16 @@ spec:
{{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.master.podLabels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
annotations:
{{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.master.podAnnotations }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
spec:
restartPolicy: {{ default .Values.global.restartPolicy .Values.master.restartPolicy }}
{{- if .Values.master.affinity }}
diff --git a/k8s/charts/seaweedfs/templates/s3-deployment.yaml b/k8s/charts/seaweedfs/templates/s3-deployment.yaml
index 365a32cdf..778cac60f 100644
--- a/k8s/charts/seaweedfs/templates/s3-deployment.yaml
+++ b/k8s/charts/seaweedfs/templates/s3-deployment.yaml
@@ -27,10 +27,16 @@ spec:
{{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.s3.podLabels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
annotations:
{{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.s3.podAnnotations }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
spec:
restartPolicy: {{ default .Values.global.restartPolicy .Values.s3.restartPolicy }}
{{- if .Values.s3.tolerations }}
diff --git a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
index 8732a810c..5a2c62505 100644
--- a/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
+++ b/k8s/charts/seaweedfs/templates/volume-statefulset.yaml
@@ -28,10 +28,16 @@ spec:
{{ with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.volume.podLabels }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
annotations:
{{ with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
+ {{- with .Values.volume.podAnnotations }}
+ {{- toYaml . | nindent 8 }}
+ {{- end }}
spec:
{{- if .Values.volume.affinity }}
affinity:
diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml
index 2e09887cc..fc16bd537 100644
--- a/k8s/charts/seaweedfs/values.yaml
+++ b/k8s/charts/seaweedfs/values.yaml
@@ -127,6 +127,12 @@ master:
extraVolumes: ""
extraVolumeMounts: ""
+ # Labels to be added to the master pods
+ podLabels: {}
+
+ # Annotations to be added to the master pods
+ podAnnotations: {}
+
## Set podManagementPolicy
podManagementPolicy: Parallel
@@ -369,6 +375,12 @@ volume:
extraVolumes: ""
extraVolumeMounts: ""
+ # Labels to be added to the volume pods
+ podLabels: {}
+
+ # Annotations to be added to the volume pods
+ podAnnotations: {}
+
## Set podManagementPolicy
podManagementPolicy: Parallel
@@ -551,6 +563,12 @@ filer:
extraVolumes: ""
extraVolumeMounts: ""
+ # Labels to be added to the filer pods
+ podLabels: {}
+
+ # Annotations to be added to the filer pods
+ podAnnotations: {}
+
## Set podManagementPolicy
podManagementPolicy: Parallel
@@ -761,6 +779,12 @@ s3:
extraVolumes: ""
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
# 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
diff --git a/weed/filer/filer_deletion.go b/weed/filer/filer_deletion.go
index 439a5296f..ccb732380 100644
--- a/weed/filer/filer_deletion.go
+++ b/weed/filer/filer_deletion.go
@@ -2,7 +2,6 @@ package filer
import (
"github.com/seaweedfs/seaweedfs/weed/storage"
- "math"
"strings"
"time"
@@ -138,47 +137,19 @@ func (f *Filer) DeleteChunksNotRecursive(chunks []*filer_pb.FileChunk) {
}
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 {
glog.Errorf("Failed to resolve old entry chunks when delete old entry chunks. new: %s, old: %s",
- newEntry.GetChunks(), oldEntry.GetChunks())
+ newChunks, oldChunks)
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)
}
diff --git a/weed/server/master_grpc_server.go b/weed/server/master_grpc_server.go
index 0a7bd5ef2..088e91be8 100644
--- a/weed/server/master_grpc_server.go
+++ b/weed/server/master_grpc_server.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
+ "github.com/google/uuid"
"github.com/seaweedfs/seaweedfs/weed/cluster"
"net"
"sort"
@@ -260,7 +261,12 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
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
stopChan := make(chan bool, 1)