mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
replicate: incremental sink only contains new and updated files
address da08402ba2
This commit is contained in:
parent
da08402ba2
commit
9a06c35da4
|
@ -356,7 +356,8 @@ enabled = false
|
||||||
directory = "/data"
|
directory = "/data"
|
||||||
|
|
||||||
[sink.local_incremental]
|
[sink.local_incremental]
|
||||||
# all replicated files are under creation time as yyyy-mm-dd directories
|
# all replicated files are under modified time as yyyy-mm-dd directories
|
||||||
|
# so each date directory contains all new and updated files.
|
||||||
enabled = false
|
enabled = false
|
||||||
directory = "/backup"
|
directory = "/backup"
|
||||||
|
|
||||||
|
|
|
@ -43,13 +43,13 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_p
|
||||||
}
|
}
|
||||||
var dateKey string
|
var dateKey string
|
||||||
if r.sink.GetName() == "local_incremental" {
|
if r.sink.GetName() == "local_incremental" {
|
||||||
var cTime int64
|
var mTime int64
|
||||||
if message.NewEntry != nil {
|
if message.NewEntry != nil {
|
||||||
cTime = message.NewEntry.Attributes.Crtime
|
mTime = message.NewEntry.Attributes.Mtime
|
||||||
} else if message.OldEntry != nil {
|
} else if message.OldEntry != nil {
|
||||||
cTime = message.OldEntry.Attributes.Crtime
|
mTime = message.OldEntry.Attributes.Mtime
|
||||||
}
|
}
|
||||||
dateKey = time.Unix(cTime, 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):])
|
newKey := util.Join(r.sink.GetSinkToDirectory(), dateKey, key[len(r.source.Dir):])
|
||||||
glog.V(3).Infof("replicate %s => %s", key, newKey)
|
glog.V(3).Infof("replicate %s => %s", key, newKey)
|
||||||
|
|
Loading…
Reference in a new issue