From ddc83b777fea45a2e0dd15e62db8659ccdfdf440 Mon Sep 17 00:00:00 2001 From: harsh4723 Date: Fri, 20 Sep 2024 20:26:20 +0530 Subject: [PATCH] refactor: remove prints --- cmd/bucket-listobjects-handlers.go | 14 +++---- cmd/disk-cache-backend.go | 9 ++--- cmd/disk-cache.go | 65 +++++++----------------------- cmd/gateway/zcn/gateway-zcn.go | 2 - cmd/object-handlers.go | 13 +----- 5 files changed, 24 insertions(+), 79 deletions(-) diff --git a/cmd/bucket-listobjects-handlers.go b/cmd/bucket-listobjects-handlers.go index f38217e3a..753b11d56 100644 --- a/cmd/bucket-listobjects-handlers.go +++ b/cmd/bucket-listobjects-handlers.go @@ -19,7 +19,7 @@ package cmd import ( "context" - "fmt" + "log" "net/http" "sort" "strconv" @@ -283,11 +283,10 @@ func (api objectAPIHandlers) ListObjectsV2MHandler(w http.ResponseWriter, r *htt // NOTE: It is recommended that this API to be used for application development. // MinIO continues to support ListObjectsV1 for supporting legacy tools. func (api objectAPIHandlers) ListObjectsV2Handler(w http.ResponseWriter, r *http.Request) { - fmt.Println("ListObjectsV2Handler") st := time.Now() defer func() { elapsed := time.Since(st).Milliseconds() - fmt.Printf("ListObjectsV2Handler took %d ms\n", elapsed) + log.Printf("ListObjectsV2Handler took %d ms\n", elapsed) }() ctx := newContext(r, w, "ListObjectsV2") @@ -352,7 +351,7 @@ func (api objectAPIHandlers) ListObjectsV2Handler(w http.ResponseWriter, r *http stc := time.Now() listObjectsV2InfoCache, errC = listObjectsV2Cache(ctx, bucket, prefix, token, delimiter, maxKeys, fetchOwner, startAfter) elap := time.Since(stc) - fmt.Println("List object cache time", elap) + log.Println("List object cache time", elap) }() wg.Wait() } @@ -371,8 +370,6 @@ func (api objectAPIHandlers) ListObjectsV2Handler(w http.ResponseWriter, r *http listObjectsV2Info.IsTruncated = true } - fmt.Printf("Final listObjectsV2InfoCache %+v\n", listObjectsV2InfoCache) - fmt.Printf("Final listObjectsV2Info %+v\n", listObjectsV2Info) concurrentDecryptETag(ctx, listObjectsV2Info.Objects) response := generateListObjectsV2Response(bucket, prefix, token, listObjectsV2Info.NextContinuationToken, startAfter, @@ -427,11 +424,10 @@ func proxyRequestByNodeIndex(ctx context.Context, w http.ResponseWriter, r *http // of the objects in a bucket. You can use the request parameters as selection // criteria to return a subset of the objects in a bucket. func (api objectAPIHandlers) ListObjectsV1Handler(w http.ResponseWriter, r *http.Request) { - fmt.Println("ListObjectsV1Handler") st := time.Now() defer func() { elapsed := time.Since(st).Milliseconds() - fmt.Printf("ListObjectsV1Handler took %d ms\n", elapsed) + log.Printf("ListObjectsV1Handler took %d ms\n", elapsed) }() ctx := newContext(r, w, "ListObjectsV1") @@ -489,7 +485,7 @@ func (api objectAPIHandlers) ListObjectsV1Handler(w http.ResponseWriter, r *http stc := time.Now() listObjectsInfoCache, errC = listObjectsCache(ctx, bucket, prefix, marker, delimiter, maxKeys) elap := time.Since(stc) - fmt.Println("ListV1 object cache time", elap) + log.Println("ListV1 object cache time", elap) }() wg.Wait() diff --git a/cmd/disk-cache-backend.go b/cmd/disk-cache-backend.go index 332cc5dbc..ef174b99b 100644 --- a/cmd/disk-cache-backend.go +++ b/cmd/disk-cache-backend.go @@ -27,6 +27,7 @@ import ( "fmt" "io" "io/ioutil" + "log" "net/http" "os" "path" @@ -220,7 +221,7 @@ func newDiskCache(ctx context.Context, dir string, config cache.Config) (*diskCa if cache.commitWriteback { go func() { tickInterval := time.Duration(config.WriteBackInterval) * time.Second - fmt.Println("write back time interval", tickInterval) + log.Println("write back time interval", tickInterval) ticker := time.NewTicker(tickInterval) defer ticker.Stop() defer close(cache.retryWritebackCh) @@ -1083,7 +1084,6 @@ func (c *diskCache) bitrotReadFromCache(ctx context.Context, filePath string, of // Get returns ObjectInfo and reader for object from disk cache func (c *diskCache) Get(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, opts ObjectOptions) (gr *GetObjectReader, numHits int, err error) { cacheObjPath := getCacheSHADir(c.dir, bucket, object) - fmt.Println("cacheObjPath getCacheSHADir", cacheObjPath) cLock := c.NewNSLockFn(cacheObjPath) lkctx, err := cLock.GetRLock(ctx, globalOperationTimeout) if err != nil { @@ -1184,7 +1184,6 @@ func (c *diskCache) Get(ctx context.Context, bucket, object string, rs *HTTPRang go func() { if writebackInProgress(objInfo.UserDefined) { cacheObjPath = getCacheWriteBackSHADir(c.dir, bucket, object) - fmt.Println("cacheObjPath getCacheSHADir", cacheObjPath) } filePath := pathJoin(cacheObjPath, cacheFile) err := c.bitrotReadFromCache(ctx, filePath, startOffset, length, pw) @@ -1242,7 +1241,7 @@ func (c *diskCache) Exists(ctx context.Context, bucket, object string) bool { // queues writeback upload failures on server startup func (c *diskCache) scanCacheWritebackFailures(ctx context.Context) { - fmt.Println("scan cache write back failures") + log.Println("scan cache write back failures") //defer close(c.retryWritebackCh) // don't close the channel filterFn := func(name string, typ os.FileMode) error { if name == minioMetaBucket { @@ -1250,7 +1249,6 @@ func (c *diskCache) scanCacheWritebackFailures(ctx context.Context) { return nil } cacheDir := pathJoin(c.dir, name) - fmt.Println("cachedir to be uploaded in backend", cacheDir) meta, _, _, err := c.statCachedMeta(ctx, cacheDir) if err != nil { return nil @@ -1258,7 +1256,6 @@ func (c *diskCache) scanCacheWritebackFailures(ctx context.Context) { objInfo := meta.ToObjectInfo() status, ok := objInfo.UserDefined[writeBackStatusHeader] - fmt.Println("status of file", status) if !ok || status == CommitComplete.String() { return nil } diff --git a/cmd/disk-cache.go b/cmd/disk-cache.go index fb02938c1..cf4d5e5a6 100644 --- a/cmd/disk-cache.go +++ b/cmd/disk-cache.go @@ -22,6 +22,7 @@ import ( "errors" "fmt" "io" + "log" "net/http" "os" "strconv" @@ -176,7 +177,6 @@ func (c *cacheObjects) updateMetadataIfChanged(ctx context.Context, dcache *disk // DeleteObject clears cache entry if backend delete operation succeeds func (c *cacheObjects) DeleteObject(ctx context.Context, bucket, object string, opts ObjectOptions) (objInfo ObjectInfo, err error) { - fmt.Println("start DeleteObject for cache", object) // delete from backend and then delete from cache always objInfoB, errB := c.InnerDeleteObjectFn(ctx, bucket, object, opts) @@ -195,7 +195,6 @@ func (c *cacheObjects) DeleteObject(ctx context.Context, bucket, object string, // DeleteObjects batch deletes objects in slice, and clears any cached entries func (c *cacheObjects) DeleteObjects(ctx context.Context, bucket string, objects []ObjectToDelete, opts ObjectOptions) ([]DeletedObject, []error) { - fmt.Println("Harsh DeleteObjects batch") errs := make([]error, len(objects)) objInfos := make([]ObjectInfo, len(objects)) for idx, object := range objects { @@ -247,9 +246,7 @@ func (c *cacheObjects) incCacheStats(size int64) { } func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, lockType LockType, opts ObjectOptions) (gr *GetObjectReader, err error) { - fmt.Println("disk cache GetObjectNInfo") if c.isCacheExclude(bucket, object) || c.skipCache() { - fmt.Println("disk cache isCacheExclude") return c.InnerGetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) } var cc *cacheControl @@ -257,12 +254,10 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string // fetch diskCache if object is currently cached or nearest available cache drive dcache, err := c.getCacheToLoc(ctx, bucket, object) if err != nil { - fmt.Println("disk cache GetObjectNInfo err1 ", err) return c.InnerGetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) } cacheReader, numCacheHits, cacheErr := dcache.Get(ctx, bucket, object, rs, h, opts) - fmt.Println("disk cache GetObjectNInfo cache err", cacheErr) if cacheErr == nil { cacheObjSize = cacheReader.ObjInfo.Size if rs != nil { @@ -283,35 +278,25 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string c.cacheStats.incHit() c.cacheStats.incBytesServed(bytesServed) c.incHitsToMeta(ctx, dcache, bucket, object, cacheReader.ObjInfo.Size, cacheReader.ObjInfo.ETag, rs) - fmt.Println("disk cache return cacheReader") return cacheReader, nil } if cc != nil && cc.noStore { cacheReader.Close() c.cacheStats.incMiss() - fmt.Println("disk cache ObjectNInfo cc.noStore") bReader, err := c.InnerGetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) bReader.ObjInfo.CacheLookupStatus = CacheHit bReader.ObjInfo.CacheStatus = CacheMiss - fmt.Println("disk cache return bReader") return bReader, err } // serve cached content without ETag verification if writeback commit is not yet complete - fmt.Println("writebackInProgress", writebackInProgress(cacheReader.ObjInfo.UserDefined)) - - fmt.Println("disk cache return cacheReader2") return cacheReader, nil } - fmt.Println("disk cache GetObjectNInfo after cache", cacheErr) - objInfo, err := c.InnerGetObjectInfoFn(ctx, bucket, object, opts) if backendDownError(err) && cacheErr == nil { c.incCacheStats(cacheObjSize) - fmt.Println("disk cache return cacheReader3") return cacheReader, nil } else if err != nil { - fmt.Println("disk cache return bReader err", err) if cacheErr == nil { cacheReader.Close() } @@ -331,7 +316,6 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string cacheReader.Close() } c.cacheStats.incMiss() - fmt.Println("disk cache ObjectNInfo !objInfo.IsCacheable") return c.InnerGetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) } // skip cache for objects with locks @@ -342,7 +326,6 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string cacheReader.Close() } c.cacheStats.incMiss() - fmt.Println("disk cache ObjectNInfo cache lock") return c.InnerGetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) } if cacheErr == nil { @@ -351,7 +334,6 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string // Update metadata in case server-side copy might have changed object metadata c.updateMetadataIfChanged(ctx, dcache, bucket, object, objInfo, cacheReader.ObjInfo, rs) c.incCacheStats(cacheObjSize) - fmt.Println("disk cache cacheReader4") return cacheReader, nil } cacheReader.Close() @@ -360,7 +342,6 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string } // Reaching here implies cache miss - fmt.Println("disk cache GetObjectNInfo cache misss") c.cacheStats.incMiss() bkReader, bkErr := c.InnerGetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) @@ -434,7 +415,6 @@ func (c *cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string // Returns ObjectInfo from cache if available. func (c *cacheObjects) GetObjectInfo(ctx context.Context, bucket, object string, opts ObjectOptions) (ObjectInfo, error) { - fmt.Println("disk cache ObjectInfo") getObjectInfoFn := c.InnerGetObjectInfoFn if c.isCacheExclude(bucket, object) || c.skipCache() { @@ -444,7 +424,6 @@ func (c *cacheObjects) GetObjectInfo(ctx context.Context, bucket, object string, // fetch diskCache if object is currently cached or nearest available cache drive dcache, err := c.getCacheToLoc(ctx, bucket, object) if err != nil { - fmt.Println("err dcache not avialable", err) return getObjectInfoFn(ctx, bucket, object, opts) } var cc *cacheControl @@ -458,8 +437,6 @@ func (c *cacheObjects) GetObjectInfo(ctx context.Context, bucket, object string, return cachedObjInfo, nil } // serve cache metadata without ETag verification if writeback commit is not yet complete - fmt.Println("writebackInProgress stat", writebackInProgress(cachedObjInfo.UserDefined)) - return cachedObjInfo, nil } @@ -523,7 +500,7 @@ func (c *cacheObjects) CopyObject(ctx context.Context, srcBucket, srcObject, dst // ListObjects from disk cache func (c *cacheObjects) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (result ListObjectsInfo, err error) { - fmt.Printf("prefix %s marker %s delim %s maxkey %d \n", prefix, marker, delimiter, maxKeys) + log.Printf("listobject cache prefix %s marker %s delim %s maxkey %d \n", prefix, marker, delimiter, maxKeys) objInfos := []ObjectInfo{} prefixes := map[string]bool{} @@ -538,7 +515,6 @@ func (c *cacheObjects) ListObjects(ctx context.Context, bucket, prefix, marker, return ListObjectsInfo{}, nil } if delimiter == "" { - fmt.Println("delimiter is empty") delimiter = SlashSeparator } if delimiter == SlashSeparator && prefix == SlashSeparator { @@ -599,7 +575,7 @@ func (c *cacheObjects) ListObjects(ctx context.Context, bucket, prefix, marker, func (c *cacheObjects) prefixSearch(rootprefix string, leafFilter art.Callback) { defer func() { if r := recover(); r != nil { - fmt.Printf("Recovered from panic from list tree listobj: %v", r) + log.Println("recovered from panic from list tree listobj") } }() c.listTree.ForEachPrefix([]byte(rootprefix), leafFilter) @@ -821,7 +797,7 @@ func (c *cacheObjects) migrateCacheFromV1toV2(ctx context.Context) { // PutObject - caches the uploaded object for single Put operations func (c *cacheObjects) PutObject(ctx context.Context, bucket, object string, r *PutObjReader, opts ObjectOptions) (objInfo ObjectInfo, err error) { - fmt.Println("Object to be cached", object) + log.Println("put object to be cached", object) putObjectFn := c.InnerPutObjectFn dcache, err := c.getCacheToLoc(ctx, bucket, object) if err != nil { @@ -833,21 +809,20 @@ func (c *cacheObjects) PutObject(ctx context.Context, bucket, object string, r * return putObjectFn(ctx, bucket, object, r, opts) } - fmt.Println("size of file", size) - fmt.Println("limit size of file", c.maxCacheFileSize) // skip cache if file size is too large if size > c.maxCacheFileSize { + log.Printf("skipping cache as file size is large than %d \n", c.maxCacheFileSize) return putObjectFn(ctx, bucket, object, r, opts) } // fetch from backend if there is no space on cache drive if !dcache.diskSpaceAvailable(size) { - fmt.Println("upload backend if there is no space on cache drive") + log.Println("uploading to backend no space on cache drive") return putObjectFn(ctx, bucket, object, r, opts) } if opts.ServerSideEncryption != nil { - fmt.Println("upload backend if ServerSideEncryption") + log.Println("uploading to backend if server side encryption") dcache.Delete(ctx, bucket, object) return putObjectFn(ctx, bucket, object, r, opts) } @@ -857,7 +832,7 @@ func (c *cacheObjects) PutObject(ctx context.Context, bucket, object string, r * legalHold := objectlock.GetObjectLegalHoldMeta(opts.UserDefined) if objRetention.Mode.Valid() || legalHold.Status.Valid() { dcache.Delete(ctx, bucket, object) - fmt.Println("upload backend if objects with locks") + log.Println("uploadng backend because objects have locks") return putObjectFn(ctx, bucket, object, r, opts) } @@ -865,11 +840,11 @@ func (c *cacheObjects) PutObject(ctx context.Context, bucket, object string, r * // directive set to exclude if c.isCacheExclude(bucket, object) { dcache.Delete(ctx, bucket, object) - fmt.Println("upload backend if cache exclude") + log.Println("uploading backend as cache exclude") return putObjectFn(ctx, bucket, object, r, opts) } if c.commitWriteback { - fmt.Println("uploading to cache writeback") + log.Println("uploading to cache writeback", object) oi, err := dcache.Put(ctx, bucket, object, r, r.Size(), nil, opts, false, true) if err != nil { return ObjectInfo{}, err @@ -956,7 +931,7 @@ func (c *cacheObjects) PutObject(ctx context.Context, bucket, object string, r * // upload cached object to backend in async commit mode. func (c *cacheObjects) uploadObject(ctx context.Context, oi ObjectInfo) { - fmt.Println("uploadObject in backend in async commit mode.") + log.Printf("uploading object %s in backend in async commit mode", oi.Name) dcache, err := c.getCacheToLoc(ctx, oi.Bucket, oi.Name) if err != nil { // disk cache could not be located. @@ -984,14 +959,11 @@ func (c *cacheObjects) uploadObject(ctx context.Context, oi ObjectInfo) { opts.UserDefined = make(map[string]string) opts.UserDefined[xhttp.ContentMD5] = oi.UserDefined["content-md5"] objInfo, err := c.InnerPutObjectFn(ctx, oi.Bucket, oi.Name, NewPutObjReader(hashReader), opts) - fmt.Println("Obj uploading to backend") wbCommitStatus := CommitComplete size := objInfo.Size if err != nil { - fmt.Println("Obj uploading to backend err", err) wbCommitStatus = CommitFailed } - fmt.Println("Obj uploading to backend status", wbCommitStatus) meta := cloneMSS(cReader.ObjInfo.UserDefined) retryCnt := 0 if wbCommitStatus == CommitFailed { @@ -1016,11 +988,10 @@ func (c *cacheObjects) uploadObject(ctx context.Context, oi ObjectInfo) { func (c *cacheObjects) deleteFromListTree(key string) { defer func() { if r := recover(); r != nil { - fmt.Printf("Recovered from panic from list tree delete: %v", r) + log.Println("Recovered from panic from list tree delete") } }() - _, ldeleted := c.listTree.Delete([]byte(key)) - fmt.Printf("deleted %s status %v \n", key, ldeleted) + c.listTree.Delete([]byte(key)) } func (c *cacheObjects) queueWritebackRetry(oi ObjectInfo) { @@ -1103,7 +1074,6 @@ func newServerCacheObjects(ctx context.Context, config cache.Config) (CacheObjec } return cacheDiskStats } - fmt.Println("Cache migrating", migrateSw) if migrateSw { go c.migrateCacheFromV1toV2(ctx) } @@ -1167,17 +1137,15 @@ func (c *cacheObjects) uploadToBackendFromCh() { } func (c *cacheObjects) recreateListTreeOnStartUp() { + log.Println("recreating list tree on startup") for _, dcache := range c.cache { if dcache != nil { - fmt.Println("recreateListTreeOnStartUp cache dir", dcache.dir) - filterFn := func(name string, typ os.FileMode) error { if name == minioMetaBucket { // Proceed to next file. return nil } cacheDir := pathJoin(dcache.dir, name) - fmt.Println("cachedir to be uploaded in backend", cacheDir) meta, _, _, err := getCacheStat(cacheDir) if err != nil { return nil @@ -1185,17 +1153,14 @@ func (c *cacheObjects) recreateListTreeOnStartUp() { objInfo := meta.ToObjectInfo() status, ok := objInfo.UserDefined[writeBackStatusHeader] - fmt.Println("status of file", status) if !ok || status == CommitComplete.String() { return nil } - fmt.Println("Recreation, Object insterted in list tree", objInfo.Bucket+"/"+objInfo.Name) c.listTree.Insert([]byte(objInfo.Bucket+"/"+objInfo.Name), objInfo) return nil } if err := readDirFn(dcache.dir, filterFn); err != nil { - fmt.Printf("Error reading dir %s", dcache.dir) return } } @@ -1204,9 +1169,7 @@ func (c *cacheObjects) recreateListTreeOnStartUp() { // queues any pending or failed async commits when server restarts func (c *cacheObjects) queuePendingWriteback(ctx context.Context) { - fmt.Println("Harsh queuePendingWriteback") for _, dcache := range c.cache { - fmt.Println("queuePendingWriteback cache", dcache.dir) if dcache != nil { go func(d *diskCache) { for { diff --git a/cmd/gateway/zcn/gateway-zcn.go b/cmd/gateway/zcn/gateway-zcn.go index 2863edd6b..d0ce8991b 100644 --- a/cmd/gateway/zcn/gateway-zcn.go +++ b/cmd/gateway/zcn/gateway-zcn.go @@ -311,7 +311,6 @@ func (zob *zcnObjects) GetBucketInfo(ctx context.Context, bucket string) (bi min // GetObjectInfo Get file meta data and respond it as minio.ObjectInfo func (zob *zcnObjects) GetObjectInfo(ctx context.Context, bucket, object string, opts minio.ObjectOptions) (objInfo minio.ObjectInfo, err error) { - fmt.Println("GetObjectInfo from blobber") var remotePath string if bucket == rootBucketName { remotePath = filepath.Join(rootPath, object) @@ -357,7 +356,6 @@ func (zob *zcnObjects) GetObjectInfo(ctx context.Context, bucket, object string, // GetObjectNInfo Provides reader with read cursor placed at offset upto some length func (zob *zcnObjects) GetObjectNInfo(ctx context.Context, bucket, object string, rs *minio.HTTPRangeSpec, h http.Header, lockType minio.LockType, opts minio.ObjectOptions) (gr *minio.GetObjectReader, err error) { - fmt.Println("GetObjectNInfo from blobber") var remotePath string if bucket == rootBucketName { remotePath = filepath.Join(rootPath, object) diff --git a/cmd/object-handlers.go b/cmd/object-handlers.go index b7a8b09db..b1b4fe09f 100644 --- a/cmd/object-handlers.go +++ b/cmd/object-handlers.go @@ -354,7 +354,6 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj }) { getObjectInfo := objectAPI.GetObjectInfo if api.CacheAPI() != nil { - fmt.Println("Get ObjectInfo from cache") getObjectInfo = api.CacheAPI().GetObjectInfo } @@ -370,7 +369,6 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj getObjectNInfo := objectAPI.GetObjectNInfo if api.CacheAPI() != nil { - fmt.Println("Get ObjectNNNInfo from cache") getObjectNInfo = api.CacheAPI().GetObjectNInfo } @@ -554,11 +552,10 @@ func (api objectAPIHandlers) getObjectHandler(ctx context.Context, objectAPI Obj // This implementation of the GET operation retrieves object. To use GET, // you must have READ access to the object. func (api objectAPIHandlers) GetObjectHandler(w http.ResponseWriter, r *http.Request) { - fmt.Println("GetObjectHandler") st := time.Now() defer func() { elapsed := time.Since(st).Milliseconds() - fmt.Printf("GetObjectHandler took %d ms\n", elapsed) + log.Printf("GetObjectHandler took %d ms\n", elapsed) }() ctx := newContext(r, w, "GetObject") @@ -1531,11 +1528,10 @@ func (api objectAPIHandlers) CopyObjectHandler(w http.ResponseWriter, r *http.Re // - X-Amz-Server-Side-Encryption-Customer-Key // - X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Request) { - fmt.Println("PutObjectHandler....") st := time.Now() defer func() { elapsed := time.Since(st).Milliseconds() - fmt.Printf("PutObjectHandler took %d ms\n", elapsed) + log.Printf("PutObjectHandler took %d ms\n", elapsed) }() ctx := newContext(r, w, "PutObject") defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) @@ -1734,7 +1730,6 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req } if api.CacheAPI() != nil { - fmt.Println("Put Object cache") putObject = api.CacheAPI().PutObject } @@ -1883,7 +1878,6 @@ func (api objectAPIHandlers) PutObjectHandler(w http.ResponseWriter, r *http.Req // This implementation of the PUT operation adds multiple objects to a bucket. func (api objectAPIHandlers) PutMultipleObjectsHandler(w http.ResponseWriter, r *http.Request) { - fmt.Println("Harsh PutMultipleObjects") ctx := newContext(r, w, "PutMultipleObjects") defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) @@ -2138,7 +2132,6 @@ func (api objectAPIHandlers) PutObjectExtractHandler(w http.ResponseWriter, r *h holdPerms := isPutActionAllowed(ctx, getRequestAuthType(r), bucket, object, r, iampolicy.PutObjectLegalHoldAction) if api.CacheAPI() != nil { - fmt.Println("Put Object cache 22") putObject = api.CacheAPI().PutObject } @@ -3457,7 +3450,6 @@ func (api objectAPIHandlers) CompleteMultipartUploadHandler(w http.ResponseWrite // DeleteObjectHandler - delete an object func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.Request) { - fmt.Println("DeleteObjectHandler") ctx := newContext(r, w, "DeleteObject") defer logger.AuditLog(ctx, w, r, mustGetClaimsFromToken(r)) @@ -3572,7 +3564,6 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http. // http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html objInfo, err := deleteObject(ctx, bucket, object, opts) if err != nil { - fmt.Println("DeleteObjectHandler err", err) switch err.(type) { case BucketNotFound: // When bucket doesn't exist specially handle it.