SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
rename backup to local_incremental and use mtime
Konstantin Lebedev02fdc0a333be
diff --git a/docker/replication.toml b/docker/replication.tomlindex 75e34a899f..833bb16920 100644--- a/docker/replication.toml+++ b/docker/replication.toml@@ -6,6 +6,6 @@ grpcAddress = "filer:18888"# i.e., all files with this "prefix" are sent to notification message queue.directory = "/buckets"-[sink.backup]+[sink.local_incremental]enabled = truedirectory = "/data"\ No newline at end of filediff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.goindex f2754139b5..47ef5d1b6e 100644--- a/weed/command/filer_replication.go+++ b/weed/command/filer_replication.go@@ -9,9 +9,9 @@ import ("github.com/chrislusf/seaweedfs/weed/replication/sink"_ "github.com/chrislusf/seaweedfs/weed/replication/sink/azuresink"_ "github.com/chrislusf/seaweedfs/weed/replication/sink/b2sink"- _ "github.com/chrislusf/seaweedfs/weed/replication/sink/backupsink"_ "github.com/chrislusf/seaweedfs/weed/replication/sink/filersink"_ "github.com/chrislusf/seaweedfs/weed/replication/sink/gcssink"+ _ "github.com/chrislusf/seaweedfs/weed/replication/sink/localincrementalsink"_ "github.com/chrislusf/seaweedfs/weed/replication/sink/localsink"_ "github.com/chrislusf/seaweedfs/weed/replication/sink/s3sink""github.com/chrislusf/seaweedfs/weed/replication/sub"diff --git a/weed/replication/replicator.go b/weed/replication/replicator.goindex 81d546c3cf..7688029e60 100644--- a/weed/replication/replicator.go+++ b/weed/replication/replicator.go@@ -42,14 +42,14 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_preturn nil}var dateKey string- if r.sink.GetName() == "backup" {- var crTime int64+ if r.sink.GetName() == "local_incremental" {+ var mTime int64if message.NewEntry != nil {- crTime = message.NewEntry.Attributes.Crtime+ mTime = message.NewEntry.Attributes.Mtime} else if message.OldEntry != nil {- crTime = message.OldEntry.Attributes.Crtime+ mTime = message.OldEntry.Attributes.Mtime}- dateKey = time.Unix(crTime, 0).Format("2006-01-02")+ dateKey = time.Unix(mTime, 0).Format("2006-01-02")}newKey := util.Join(r.sink.GetSinkToDirectory(), dateKey, key[len(r.source.Dir):])glog.V(3).Infof("replicate %s => %s", key, newKey)diff --git a/weed/replication/sink/backupsink/backup_sink.go b/weed/replication/sink/backupsink/backup_sink.godeleted file mode 100644index df0a778d15..0000000000--- a/weed/replication/sink/backupsink/backup_sink.go+++ /dev/null@@ -1,18 +0,0 @@-package backupsink--import (- "github.com/chrislusf/seaweedfs/weed/replication/sink"- "github.com/chrislusf/seaweedfs/weed/replication/sink/localsink"-)--type BackupSink struct {- localsink.LocalSink-}--func (backupsink *BackupSink) GetName() string {- return "backup"-}--func init() {- sink.Sinks = append(sink.Sinks, &BackupSink{})-}diff --git a/weed/replication/sink/localincrementalsink/local_incremental_sink.go b/weed/replication/sink/localincrementalsink/local_incremental_sink.gonew file mode 100644index 0000000000..97da3a5f75--- /dev/null+++ b/weed/replication/sink/localincrementalsink/local_incremental_sink.go@@ -0,0 +1,18 @@+package localincrementalsink++import (+ "github.com/chrislusf/seaweedfs/weed/replication/sink"+ "github.com/chrislusf/seaweedfs/weed/replication/sink/localsink"+)++type LocalIncSink struct {+ localsink.LocalSink+}++func (localincsink *LocalIncSink) GetName() string {+ return "local_incremental"+}++func init() {+ sink.Sinks = append(sink.Sinks, &LocalIncSink{})+}