From 2564cbb60572d9b1a7e9f85732fa49509ff23a37 Mon Sep 17 00:00:00 2001 From: Nir Ozery Date: Fri, 18 Oct 2024 17:32:34 -0400 Subject: [PATCH 1/2] Fix: Copy object mtime --- pkg/catalog/catalog.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/catalog/catalog.go b/pkg/catalog/catalog.go index 69fa1a1c452..b3e917d23f5 100644 --- a/pkg/catalog/catalog.go +++ b/pkg/catalog/catalog.go @@ -2715,7 +2715,6 @@ func (c *Catalog) CopyEntry(ctx context.Context, srcRepository, srcRef, srcPath, // copy data to a new physical address dstEntry := *srcEntry - dstEntry.CreationDate = time.Now() dstEntry.Path = destPath dstEntry.AddressType = AddressTypeRelative dstEntry.PhysicalAddress = c.PathProvider.NewPath() @@ -2741,6 +2740,9 @@ func (c *Catalog) CopyEntry(ctx context.Context, srcRepository, srcRef, srcPath, return nil, err } + // Update creation date only after actual copy!!! + dstEntry.CreationDate = time.Now() + // create entry for the final copy err = c.CreateEntry(ctx, destRepository, destBranch, dstEntry, opts...) if err != nil { From 812dcb158ad9ab11307a17b9904b232254b9c335 Mon Sep 17 00:00:00 2001 From: Nir Ozery Date: Mon, 21 Oct 2024 19:31:44 -0400 Subject: [PATCH 2/2] CR Fixes --- pkg/api/controller.go | 2 +- pkg/catalog/catalog.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/api/controller.go b/pkg/api/controller.go index ad8267d50ac..c39b304e07a 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -352,7 +352,6 @@ func (c *Controller) CompletePresignMultipartUpload(w http.ResponseWriter, r *ht return } - writeTime := time.Now() physicalAddress, addressType := normalizePhysicalAddress(repo.StorageNamespace, body.PhysicalAddress) if addressType != catalog.AddressTypeRelative { writeError(w, r, http.StatusBadRequest, "physical address must be relative to the storage namespace") @@ -383,6 +382,7 @@ func (c *Controller) CompletePresignMultipartUpload(w http.ResponseWriter, r *ht return } + writeTime := time.Now() checksum := httputil.StripQuotesAndSpaces(mpuResp.ETag) entryBuilder := catalog.NewDBEntryBuilder(). CommonLevel(false). diff --git a/pkg/catalog/catalog.go b/pkg/catalog/catalog.go index b3e917d23f5..0146397eea1 100644 --- a/pkg/catalog/catalog.go +++ b/pkg/catalog/catalog.go @@ -2741,6 +2741,8 @@ func (c *Catalog) CopyEntry(ctx context.Context, srcRepository, srcRef, srcPath, } // Update creation date only after actual copy!!! + // The actual file upload can take a while and depend on many factors so we would like + // The mtime (creationDate) in lakeFS to be as close as possible to the mtime in the underlying storage dstEntry.CreationDate = time.Now() // create entry for the final copy