mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 08:03:34 +08:00
set creation time
This commit is contained in:
@@ -238,6 +238,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool, isFr
|
|||||||
|
|
||||||
func (f *Filer) UpdateEntry(ctx context.Context, oldEntry, entry *Entry) (err error) {
|
func (f *Filer) UpdateEntry(ctx context.Context, oldEntry, entry *Entry) (err error) {
|
||||||
if oldEntry != nil {
|
if oldEntry != nil {
|
||||||
|
entry.Attr.Crtime = oldEntry.Attr.Crtime
|
||||||
if oldEntry.IsDirectory() && !entry.IsDirectory() {
|
if oldEntry.IsDirectory() && !entry.IsDirectory() {
|
||||||
glog.Errorf("existing %s is a directory", entry.FullPath)
|
glog.Errorf("existing %s is a directory", entry.FullPath)
|
||||||
return fmt.Errorf("existing %s is a directory", entry.FullPath)
|
return fmt.Errorf("existing %s is a directory", entry.FullPath)
|
||||||
|
@@ -147,19 +147,12 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fix the crTime
|
|
||||||
existingEntry, err := fs.filer.FindEntry(ctx, util.FullPath(path))
|
|
||||||
crTime := time.Now()
|
|
||||||
if err == nil && existingEntry != nil {
|
|
||||||
crTime = existingEntry.Crtime
|
|
||||||
}
|
|
||||||
|
|
||||||
glog.V(4).Infoln("saving", path)
|
glog.V(4).Infoln("saving", path)
|
||||||
entry := &filer.Entry{
|
entry := &filer.Entry{
|
||||||
FullPath: util.FullPath(path),
|
FullPath: util.FullPath(path),
|
||||||
Attr: filer.Attr{
|
Attr: filer.Attr{
|
||||||
Mtime: time.Now(),
|
Mtime: time.Now(),
|
||||||
Crtime: crTime,
|
Crtime: time.Now(),
|
||||||
Mode: os.FileMode(mode),
|
Mode: os.FileMode(mode),
|
||||||
Uid: OS_UID,
|
Uid: OS_UID,
|
||||||
Gid: OS_GID,
|
Gid: OS_GID,
|
||||||
|
Reference in New Issue
Block a user