aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2025-11-03 14:09:02 +0500
committerKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2025-11-03 14:09:02 +0500
commite086793cb3f273c7cd726c43f3fdb96cb1f1a5bc (patch)
tree5a5a701a405bdc6dcf8380b64aaa3c5c0afd2df3
parentdcc84f9f34c2d19af26bf5d96f83331218b7a44a (diff)
downloadseaweedfs-e086793cb3f273c7cd726c43f3fdb96cb1f1a5bc.tar.xz
seaweedfs-e086793cb3f273c7cd726c43f3fdb96cb1f1a5bc.zip
disable delete expires s3 entry in filer
-rw-r--r--weed/filer/filer.go8
-rw-r--r--weed/s3api/s3api_object_handlers_put.go4
-rw-r--r--weed/server/filer_server_handlers_write_autochunk.go4
3 files changed, 13 insertions, 3 deletions
diff --git a/weed/filer/filer.go b/weed/filer/filer.go
index b86ac3c5b..510e5c711 100644
--- a/weed/filer/filer.go
+++ b/weed/filer/filer.go
@@ -8,6 +8,7 @@ import (
"strings"
"time"
+ "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
"github.com/seaweedfs/seaweedfs/weed/s3api/s3bucket"
"github.com/seaweedfs/seaweedfs/weed/cluster/lock_manager"
@@ -351,13 +352,18 @@ func (f *Filer) FindEntry(ctx context.Context, p util.FullPath) (entry *Entry, e
}
entry, err = f.Store.FindEntry(ctx, p)
if entry != nil && entry.TtlSec > 0 {
+ if entry.Extended != nil {
+ if _, found := entry.Extended[s3_constants.SeaweedFSExpiresS3]; found {
+ return
+ }
+ }
if entry.Crtime.Add(time.Duration(entry.TtlSec) * time.Second).Before(time.Now()) {
f.Store.DeleteOneEntry(ctx, entry)
return nil, filer_pb.ErrNotFound
}
}
- return
+ return
}
func (f *Filer) doListDirectoryEntries(ctx context.Context, p util.FullPath, startFileName string, inclusive bool, limit int64, prefix string, eachEntryFunc ListEachEntryFunc) (expiredCount int64, lastFileName string, err error) {
diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go
index 1fff23545..912cdab7b 100644
--- a/weed/s3api/s3api_object_handlers_put.go
+++ b/weed/s3api/s3api_object_handlers_put.go
@@ -333,7 +333,9 @@ func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader
proxyReq.Header.Set(s3_constants.SeaweedFSSSES3Key, base64.StdEncoding.EncodeToString(sseS3Metadata))
glog.V(3).Infof("putToFiler: storing SSE-S3 metadata for object %s with keyID %s", uploadUrl, sseS3Key.KeyID)
}
-
+ if s3a.option.AllowDeleteObjectsByTTL {
+ proxyReq.Header.Set(s3_constants.SeaweedFSExpiresS3, "true")
+ }
// ensure that the Authorization header is overriding any previous
// Authorization header which might be already present in proxyReq
s3a.maybeAddFilerJwtAuthorization(proxyReq, true)
diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go
index d2b3d8b52..308a0421a 100644
--- a/weed/server/filer_server_handlers_write_autochunk.go
+++ b/weed/server/filer_server_handlers_write_autochunk.go
@@ -330,7 +330,9 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa
}
entry.Extended = SaveAmzMetaData(r, entry.Extended, false)
-
+ if entry.TtlSec > 0 && r.Header.Get(s3_constants.SeaweedFSExpiresS3) == "true" {
+ entry.Extended[s3_constants.SeaweedFSExpiresS3] = []byte("true")
+ }
for k, v := range r.Header {
if len(v) > 0 && len(v[0]) > 0 {
if strings.HasPrefix(k, needle.PairNamePrefix) || k == "Cache-Control" || k == "Expires" || k == "Content-Disposition" {