aboutsummaryrefslogtreecommitdiff
path: root/weed/util
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-09-25 01:18:44 -0700
committerChris Lu <chris.lu@gmail.com>2021-09-25 01:18:44 -0700
commit2baed2e1e995ad331985a7b8c359e732b223ad3a (patch)
treeb891a9330cb355d55cd8e35424d1eb0101c4b47e /weed/util
parenta814f3f0a80ac511132bd3ac97356f333f128b1c (diff)
downloadseaweedfs-2baed2e1e995ad331985a7b8c359e732b223ad3a.tar.xz
seaweedfs-2baed2e1e995ad331985a7b8c359e732b223ad3a.zip
avoid possible metadata subscription data loss
Previous implementation append filer logs into one file. So one file is not always sorted, which can lead to miss reading some entries, especially when different filers have different write throughput.
Diffstat (limited to 'weed/util')
-rw-r--r--weed/util/file_util.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/util/file_util.go b/weed/util/file_util.go
index f83f80265..f9cc4f70b 100644
--- a/weed/util/file_util.go
+++ b/weed/util/file_util.go
@@ -87,3 +87,11 @@ func ResolvePath(path string) string {
return path
}
+
+func FileNameBase(filename string) string {
+ lastDotIndex := strings.LastIndex(filename, ".")
+ if lastDotIndex < 0 {
+ return filename
+ }
+ return filename[:lastDotIndex]
+}