Skip to content

Commit dc81585

Browse files
molnia1311chrislusf
authored andcommitted
feat: add configurable metadata cache TTL setting
1 parent 6a0d236 commit dc81585

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

cmd/seaweedfs-csi-driver/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var (
2525
concurrentWriters = flag.Int("concurrentWriters", 128, "limit concurrent goroutine writers if not 0")
2626
concurrentReaders = flag.Int("concurrentReaders", 128, "limit concurrent chunk fetches for read operations")
2727
cacheCapacityMB = flag.Int("cacheCapacityMB", 0, "local file chunk cache capacity in MB")
28+
cacheMetaTtlSec = flag.Int("cacheMetaTtlSec", 60, "metadata cache TTL in seconds")
2829
cacheDir = flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks and meta data")
2930
uidMap = flag.String("map.uid", "", "map local uid to uid on filer, comma-separated <local_uid>:<filer_uid>")
3031
gidMap = flag.String("map.gid", "", "map local gid to gid on filer, comma-separated <local_gid>:<filer_gid>")
@@ -88,6 +89,7 @@ func main() {
8889
drv.ConcurrentWriters = *concurrentWriters
8990
drv.ConcurrentReaders = *concurrentReaders
9091
drv.CacheCapacityMB = *cacheCapacityMB
92+
drv.CacheMetaTtlSec = *cacheMetaTtlSec
9193
drv.CacheDir = *cacheDir
9294
drv.UidMap = *uidMap
9395
drv.GidMap = *gidMap

deploy/helm/seaweedfs-csi-driver/templates/daemonset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ spec:
6767
{{- with .Values.cacheCapacityMB }}
6868
- --cacheCapacityMB={{ . }}
6969
{{- end }}
70+
{{- with .Values.cacheMetaTtlSec }}
71+
- --cacheMetaTtlSec={{ . }}
72+
{{- end }}
7073
env:
7174
- name: CSI_ENDPOINT
7275
value: unix:///csi/csi.sock

deploy/helm/seaweedfs-csi-driver/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ isDefaultStorageClass: false
66
tlsSecret: ""
77
#logVerbosity: 4
88
#cacheCapacityMB: 0
9+
#cacheMetaTtlSec: 60
910

1011
#concurrentWriters: 128
1112
#concurrentReaders: 128

pkg/driver/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type SeaweedFsDriver struct {
4242
ConcurrentWriters int
4343
ConcurrentReaders int
4444
CacheCapacityMB int
45+
CacheMetaTtlSec int
4546
CacheDir string
4647
UidMap string
4748
GidMap string

pkg/driver/mounter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ func (m *mountServiceMounter) buildMountArgs(targetPath, cacheDir, localSocket s
134134
"filer": strings.Join(filers, ","),
135135
"filer.path": filerPath,
136136
"cacheCapacityMB": strconv.Itoa(m.driver.CacheCapacityMB),
137+
"cacheMetaTtlSec": strconv.Itoa(m.driver.CacheMetaTtlSec),
137138
"concurrentReaders": strconv.Itoa(m.driver.ConcurrentReaders),
138139
"concurrentWriters": strconv.Itoa(m.driver.ConcurrentWriters),
139140
"map.uid": m.driver.UidMap,

0 commit comments

Comments
 (0)