diff --git a/api/handler/multipart_upload.go b/api/handler/multipart_upload.go index 5e5706cfa..35f2b8f96 100644 --- a/api/handler/multipart_upload.go +++ b/api/handler/multipart_upload.go @@ -348,6 +348,13 @@ func (h *handler) UploadPartCopy(w http.ResponseWriter, r *http.Request) { return } + h.log.Debug("copy details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", reqInfo.BucketName), + zap.Stringer("cid", bktInfo.CID), + zap.String("object", reqInfo.ObjectName), + zap.Stringer("oid", info.ID)) + response := UploadPartCopyResponse{ ETag: info.HashSum, LastModified: info.Created.UTC().Format(time.RFC3339), diff --git a/api/handler/put.go b/api/handler/put.go index beb1a60a7..4baee1459 100644 --- a/api/handler/put.go +++ b/api/handler/put.go @@ -730,6 +730,9 @@ func (h *handler) CreateBucketHandler(w http.ResponseWriter, r *http.Request) { return } + h.log.Debug("target details", zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", reqInfo.BucketName), zap.Stringer("cid", bktInfo.CID)) + if p.ObjectLockEnabled { sp := &layer.PutSettingsParams{ BktInfo: bktInfo, diff --git a/api/handler/tagging.go b/api/handler/tagging.go index 6298ef17e..efb7f5c29 100644 --- a/api/handler/tagging.go +++ b/api/handler/tagging.go @@ -52,6 +52,13 @@ func (h *handler) PutObjectTaggingHandler(w http.ResponseWriter, r *http.Request return } + h.log.Debug("target details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", reqInfo.BucketName), + zap.Stringer("cid", bktInfo.CID), + zap.String("object", reqInfo.ObjectName), + zap.Stringer("oid", nodeVersion.OID)) + s := &SendNotificationParams{ Event: EventObjectTaggingPut, NotificationInfo: &data.NotificationInfo{ @@ -99,6 +106,13 @@ func (h *handler) GetObjectTaggingHandler(w http.ResponseWriter, r *http.Request return } + h.log.Debug("target details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", reqInfo.BucketName), + zap.Stringer("cid", bktInfo.CID), + zap.String("object", reqInfo.ObjectName), + zap.String("oid", versionID)) + if settings.VersioningEnabled() { w.Header().Set(api.AmzVersionID, versionID) } @@ -128,6 +142,13 @@ func (h *handler) DeleteObjectTaggingHandler(w http.ResponseWriter, r *http.Requ return } + h.log.Debug("target details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", reqInfo.BucketName), + zap.Stringer("cid", bktInfo.CID), + zap.String("object", reqInfo.ObjectName), + zap.Stringer("oid", nodeVersion.OID)) + s := &SendNotificationParams{ Event: EventObjectTaggingDelete, NotificationInfo: &data.NotificationInfo{ diff --git a/api/layer/layer.go b/api/layer/layer.go index 7f8b85857..4d7aee694 100644 --- a/api/layer/layer.go +++ b/api/layer/layer.go @@ -482,11 +482,27 @@ func (n *layer) GetObjectInfo(ctx context.Context, p *HeadObjectParams) (*data.O // GetExtendedObjectInfo returns meta information and corresponding info from the tree service about the object. func (n *layer) GetExtendedObjectInfo(ctx context.Context, p *HeadObjectParams) (*data.ExtendedObjectInfo, error) { + var objInfo *data.ExtendedObjectInfo + var err error + if len(p.VersionID) == 0 { - return n.headLastVersionIfNotDeleted(ctx, p.BktInfo, p.Object) + objInfo, err = n.headLastVersionIfNotDeleted(ctx, p.BktInfo, p.Object) + } else { + objInfo, err = n.headVersion(ctx, p.BktInfo, p) + } + if err != nil { + return nil, err } - return n.headVersion(ctx, p.BktInfo, p) + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("get object", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", p.BktInfo.Name), + zap.Stringer("cid", p.BktInfo.CID), + zap.String("object", objInfo.ObjectInfo.Name), + zap.Stringer("oid", objInfo.ObjectInfo.ID)) + + return objInfo, nil } // CopyObject from one bucket into another bucket. @@ -645,7 +661,12 @@ func (n *layer) CreateBucket(ctx context.Context, p *CreateBucketParams) (*data. func (n *layer) ResolveBucket(ctx context.Context, name string) (cid.ID, error) { var cnrID cid.ID if err := cnrID.DecodeString(name); err != nil { - return n.resolver.Resolve(ctx, name) + if cnrID, err = n.resolver.Resolve(ctx, name); err != nil { + return cid.ID{}, err + } + + reqInfo := api.GetReqInfo(ctx) + n.log.Info("resolve bucket", zap.String("reqId", reqInfo.RequestID), zap.String("bucket", name), zap.Stringer("cid", cnrID)) } return cnrID, nil diff --git a/api/layer/multipart_upload.go b/api/layer/multipart_upload.go index 925834479..4f1c6dece 100644 --- a/api/layer/multipart_upload.go +++ b/api/layer/multipart_upload.go @@ -11,6 +11,7 @@ import ( "strings" "time" + "github.com/TrueCloudLab/frostfs-s3-gw/api" "github.com/TrueCloudLab/frostfs-s3-gw/api/data" "github.com/TrueCloudLab/frostfs-s3-gw/api/errors" "github.com/TrueCloudLab/frostfs-s3-gw/api/layer/encryption" @@ -228,6 +229,13 @@ func (n *layer) uploadPart(ctx context.Context, multipartInfo *data.MultipartInf return nil, err } + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("upload part", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", bktInfo.Name), zap.Stringer("cid", bktInfo.CID), + zap.String("multipart upload", p.Info.UploadID), + zap.Int("part number", p.PartNumber), zap.String("object", p.Info.Key), zap.Stringer("oid", id)) + partInfo := &data.PartInfo{ Key: p.Info.Key, UploadID: p.Info.UploadID, @@ -535,6 +543,11 @@ func (n *layer) AbortMultipartUpload(ctx context.Context, p *UploadInfoParams) e } for _, info := range parts { + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("part details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", p.Bkt.Name), zap.Stringer("cid", p.Bkt.CID), + zap.String("object", info.Key), zap.Stringer("oid", info.OID)) if err = n.objectDelete(ctx, p.Bkt, info.OID); err != nil { n.log.Warn("couldn't delete part", zap.String("cid", p.Bkt.CID.EncodeToString()), zap.String("oid", info.OID.EncodeToString()), zap.Int("part number", info.Number), zap.Error(err)) @@ -562,6 +575,11 @@ func (n *layer) ListParts(ctx context.Context, p *ListPartsParams) (*ListPartsIn parts := make([]*Part, 0, len(partsInfo)) for _, partInfo := range partsInfo { + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("part details", + zap.String("reqId", reqInfo.RequestID), + zap.String("container", p.Info.Bkt.Name), zap.Stringer("cid", p.Info.Bkt.CID), + zap.String("object", partInfo.Key), zap.Stringer("oid", partInfo.OID)) parts = append(parts, &Part{ ETag: partInfo.ETag, LastModified: partInfo.Created.UTC().Format(time.RFC3339), @@ -609,10 +627,24 @@ func (n *layer) getUploadParts(ctx context.Context, p *UploadInfoParams) (*data. } res := make(map[int]*data.PartInfo, len(parts)) - for _, part := range parts { + partsNumbers := make([]int, len(parts)) + oids := make([]string, len(parts)) + for i, part := range parts { res[part.Number] = part + partsNumbers[i] = part.Number + oids[i] = part.OID.EncodeToString() } + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("part details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", p.Bkt.Name), + zap.Stringer("cid", p.Bkt.CID), + zap.String("object", p.Key), + zap.String("upload id", p.UploadID), + zap.Ints("part numbers", partsNumbers), + zap.Strings("oids", oids)) + return multipartInfo, res, nil } diff --git a/api/layer/object.go b/api/layer/object.go index 13a82f66e..5e5e7057e 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -248,6 +248,12 @@ func (n *layer) PutObject(ctx context.Context, p *PutObjectParams) (*data.Extend return nil, err } + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("put object", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", p.BktInfo.Name), zap.Stringer("cid", p.BktInfo.CID), + zap.String("object", p.Object), zap.Stringer("oid", id)) + newVersion.OID = id newVersion.ETag = hex.EncodeToString(hash) if newVersion.ID, err = n.treeService.AddVersion(ctx, p.BktInfo, newVersion); err != nil { diff --git a/api/layer/tagging.go b/api/layer/tagging.go index 973918c5b..7007fd88a 100644 --- a/api/layer/tagging.go +++ b/api/layer/tagging.go @@ -4,11 +4,13 @@ import ( "context" errorsStd "errors" + "github.com/TrueCloudLab/frostfs-s3-gw/api" "github.com/TrueCloudLab/frostfs-s3-gw/api/data" "github.com/TrueCloudLab/frostfs-s3-gw/api/errors" cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id" oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id" "github.com/TrueCloudLab/frostfs-sdk-go/user" + "go.uber.org/zap" ) type GetObjectTaggingParams struct { @@ -175,6 +177,14 @@ func (n *layer) getNodeVersion(ctx context.Context, objVersion *ObjectVersion) ( return nil, errors.GetAPIError(errors.ErrNoSuchKey) } + if err == nil && version != nil && !version.IsDeleteMarker() { + reqInfo := api.GetReqInfo(ctx) + n.log.Debug("target details", + zap.String("reqId", reqInfo.RequestID), + zap.String("bucket", objVersion.BktInfo.Name), zap.Stringer("cid", objVersion.BktInfo.CID), + zap.String("object", objVersion.ObjectName), zap.Stringer("oid", version.OID)) + } + return version, err }