Skip to content

Commit

Permalink
refactor: remove prints
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh4723 committed Sep 20, 2024
1 parent 18631a5 commit ddc83b7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 79 deletions.
14 changes: 5 additions & 9 deletions cmd/bucket-listobjects-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package cmd

import (
"context"
"fmt"
"log"
"net/http"
"sort"
"strconv"
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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()
}
Expand All @@ -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,
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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()
Expand Down
9 changes: 3 additions & 6 deletions cmd/disk-cache-backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"path"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1242,23 +1241,21 @@ 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 {
// Proceed to next file.
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
}

objInfo := meta.ToObjectInfo()
status, ok := objInfo.UserDefined[writeBackStatusHeader]
fmt.Println("status of file", status)
if !ok || status == CommitComplete.String() {
return nil
}
Expand Down
Loading

0 comments on commit ddc83b7

Please sign in to comment.