Skip to content

Commit

Permalink
Merge pull request #1500 from 0chain/fix/log-level
Browse files Browse the repository at this point in the history
set some logs level to debug
  • Loading branch information
dabasov authored May 22, 2024
2 parents 9cf4952 + b9f9ea5 commit 325bdb4
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion zboxcore/sdk/allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ func (a *Allocation) processReadMarker(drs []*DownloadRequest) {
a.downloadChan <- dr
}(dr)
}
l.Logger.Info("[processReadMarker]", zap.String("allocation_id", a.ID),
l.Logger.Debug("[processReadMarker]", zap.String("allocation_id", a.ID),
zap.Int("num of download requests", len(drs)),
zap.Duration("processDownloadRequest", elapsedProcessDownloadRequest))
return
Expand Down
18 changes: 9 additions & 9 deletions zboxcore/sdk/commitworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ func startCommitWorker(blobberChan chan *CommitRequest, blobberID string) {
func (commitreq *CommitRequest) processCommit() {
defer commitreq.wg.Done()
start := time.Now()
l.Logger.Info("received a commit request")
l.Logger.Debug("received a commit request")
paths := make([]string, 0)
for _, change := range commitreq.changes {
paths = append(paths, change.GetAffectedPath()...)
}
if len(paths) == 0 {
l.Logger.Info("Nothing to commit")
l.Logger.Debug("Nothing to commit")
commitreq.result = SuccessCommitResult()
return
}
Expand Down Expand Up @@ -170,7 +170,7 @@ func (commitreq *CommitRequest) processCommit() {
rootRef.CalculateHash()
prevAllocationRoot := rootRef.Hash
if prevAllocationRoot != lR.LatestWM.AllocationRoot {
l.Logger.Info("Allocation root from latest writemarker mismatch. Expected: " + prevAllocationRoot + " got: " + lR.LatestWM.AllocationRoot)
l.Logger.Error("Allocation root from latest writemarker mismatch. Expected: " + prevAllocationRoot + " got: " + lR.LatestWM.AllocationRoot)
errMsg := fmt.Sprintf(
"calculated allocation root mismatch from blobber %s. Expected: %s, Got: %s",
commitreq.blobber.Baseurl, prevAllocationRoot, lR.LatestWM.AllocationRoot)
Expand Down Expand Up @@ -210,7 +210,7 @@ func (commitreq *CommitRequest) processCommit() {
commitreq.result = ErrorCommitResult(err.Error())
return
}
l.Logger.Info("[commitBlobber]", time.Since(start).Milliseconds())
l.Logger.Debug("[commitBlobber]", time.Since(start).Milliseconds())
commitreq.result = SuccessCommitResult()
}

Expand Down Expand Up @@ -255,7 +255,7 @@ func (req *CommitRequest) commitBlobber(
return err
}

l.Logger.Info("Committing to blobber." + req.blobber.Baseurl)
l.Logger.Debug("Committing to blobber." + req.blobber.Baseurl)
var (
resp *http.Response
shouldContinue bool
Expand Down Expand Up @@ -294,12 +294,12 @@ func (req *CommitRequest) commitBlobber(
return
}
if resp.StatusCode == http.StatusOK {
logger.Logger.Info(req.blobber.Baseurl, " committed")
logger.Logger.Debug(req.blobber.Baseurl, " committed")
return
}

if resp.StatusCode == http.StatusTooManyRequests {
logger.Logger.Info(req.blobber.Baseurl,
logger.Logger.Debug(req.blobber.Baseurl,
" got too many request error. Retrying")

var r int
Expand All @@ -315,15 +315,15 @@ func (req *CommitRequest) commitBlobber(
}

if strings.Contains(string(respBody), "pending_markers:") {
logger.Logger.Info("Commit pending for blobber ",
logger.Logger.Debug("Commit pending for blobber ",
req.blobber.Baseurl, " Retrying")
time.Sleep(5 * time.Second)
shouldContinue = true
return
}

if strings.Contains(string(respBody), "chain_length_exceeded") {
l.Logger.Info("Chain length exceeded for blobber ",
l.Logger.Error("Chain length exceeded for blobber ",
req.blobber.Baseurl, " Retrying")
time.Sleep(5 * time.Second)
shouldContinue = true
Expand Down
1 change: 0 additions & 1 deletion zboxcore/sdk/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func getObjectTreeFromBlobber(ctx context.Context, allocationID, allocationTx st
}
return errors.New(strconv.Itoa(resp.StatusCode), fmt.Sprintf("Object tree error response: Body: %s ", string(resp_body)))
} else {
l.Logger.Info("Object tree:", string(resp_body))
err = json.Unmarshal(resp_body, &lR)
if err != nil {
l.Logger.Error("Object tree json decode error: ", err)
Expand Down
4 changes: 2 additions & 2 deletions zboxcore/sdk/deleteworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (req *DeleteRequest) deleteBlobberFile(

if resp.StatusCode == http.StatusOK {
req.consensus.Done()
l.Logger.Info(blobber.Baseurl, " "+req.remotefilepath, " deleted.")
l.Logger.Debug(blobber.Baseurl, " "+req.remotefilepath, " deleted.")
return
}

Expand Down Expand Up @@ -362,7 +362,7 @@ func (dop *DeleteOperation) Process(allocObj *Allocation, connectionID string) (
fmt.Sprintf("Delete failed. Required consensus %d, got %d",
deleteReq.consensus.consensusThresh, deleteReq.consensus.consensus))
}
l.Logger.Info("Delete Process Ended ")
l.Logger.Debug("Delete Process Ended ")
return objectTreeRefs, deleteReq.deleteMask, nil
}

Expand Down
4 changes: 2 additions & 2 deletions zboxcore/sdk/downloadworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func (req *DownloadRequest) processDownload() {
var pos uint64
req.bufferMap = make(map[int]zboxutil.DownloadBuffer)
defer func() {
l.Logger.Info("Clearing download buffers: ", len(req.bufferMap))
l.Logger.Debug("Clearing download buffers: ", len(req.bufferMap))
for ind, rb := range req.bufferMap {
rb.ClearBuffer()
delete(req.bufferMap, ind)
Expand Down Expand Up @@ -759,7 +759,7 @@ func (req *DownloadRequest) processDownload() {
wg.Wait()
// req.fileHandler.Sync() //nolint
elapsedGetBlocksAndWrite := time.Since(now) - elapsedInitEC - elapsedInitEncryption
l.Logger.Info(fmt.Sprintf("[processDownload] Timings:\n allocation_id: %s,\n remotefilepath: %s,\n initEC: %d ms,\n initEncryption: %d ms,\n getBlocks and writes: %d ms",
l.Logger.Debug(fmt.Sprintf("[processDownload] Timings:\n allocation_id: %s,\n remotefilepath: %s,\n initEC: %d ms,\n initEncryption: %d ms,\n getBlocks and writes: %d ms",
req.allocationID,
req.remotefilepath,
elapsedInitEC.Milliseconds(),
Expand Down
2 changes: 1 addition & 1 deletion zboxcore/sdk/filerefsworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (o *ObjectTreeRequest) GetRefs() (*ObjectTreeResult, error) {
oTreeResponses := make([]oTreeResponse, totalBlobbersCount)
o.wg.Add(totalBlobbersCount)
for i, blob := range o.blobbers {
l.Logger.Info(fmt.Sprintf("Getting file refs for path %v from blobber %v", o.remotefilepath, blob.Baseurl))
l.Logger.Debug(fmt.Sprintf("Getting file refs for path %v from blobber %v", o.remotefilepath, blob.Baseurl))
go o.getFileRefs(&oTreeResponses[i], blob.Baseurl)
}
o.wg.Wait()
Expand Down
18 changes: 9 additions & 9 deletions zboxcore/sdk/multi_operation_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (mo *MultiOperation) createConnectionObj(blobberIdx int) (err error) {
latestRespMsg = string(respBody)
latestStatusCode = resp.StatusCode
if resp.StatusCode == http.StatusOK {
l.Logger.Info(blobber.Baseurl, " connection obj created.")
l.Logger.Debug(blobber.Baseurl, " connection obj created.")
return
}

Expand Down Expand Up @@ -159,7 +159,7 @@ func (mo *MultiOperation) createConnectionObj(blobberIdx int) (err error) {
}

func (mo *MultiOperation) Process() error {
l.Logger.Info("MultiOperation Process start")
l.Logger.Debug("MultiOperation Process start")
wg := &sync.WaitGroup{}
mo.changes = make([][]allocationchange.AllocationChange, len(mo.operations))
ctx := mo.ctx
Expand Down Expand Up @@ -222,7 +222,7 @@ func (mo *MultiOperation) Process() error {
return fmt.Errorf("Operation failed: %s", err.Error())
}

l.Logger.Info("Trying to lock write marker.....")
l.Logger.Debug("Trying to lock write marker.....")
if singleClientMode {
mo.allocationObj.commitMutex.Lock()
} else {
Expand All @@ -232,7 +232,7 @@ func (mo *MultiOperation) Process() error {
return fmt.Errorf("Operation failed: %s", err.Error())
}
}
logger.Logger.Info("[writemarkerLocked]", time.Since(start).Milliseconds())
logger.Logger.Debug("[writemarkerLocked]", time.Since(start).Milliseconds())
start = time.Now()
status := Commit
if !mo.isRepair && !mo.allocationObj.checkStatus {
Expand Down Expand Up @@ -289,7 +289,7 @@ func (mo *MultiOperation) Process() error {
}
return ErrRetryOperation
}
logger.Logger.Info("[checkAllocStatus]", time.Since(start).Milliseconds())
logger.Logger.Debug("[checkAllocStatus]", time.Since(start).Milliseconds())
mo.Consensus.Reset()
activeBlobbers := mo.operationMask.CountOnes()
commitReqs := make([]*CommitRequest, activeBlobbers)
Expand All @@ -312,18 +312,18 @@ func (mo *MultiOperation) Process() error {

commitReq.changes = append(commitReq.changes, mo.changes[pos]...)
commitReqs[counter] = commitReq
l.Logger.Info("Commit request sending to blobber ", commitReq.blobber.Baseurl)
l.Logger.Debug("Commit request sending to blobber ", commitReq.blobber.Baseurl)
go AddCommitRequest(commitReq)
counter++
}
wg.Wait()
logger.Logger.Info("[commitRequests]", time.Since(start).Milliseconds())
logger.Logger.Debug("[commitRequests]", time.Since(start).Milliseconds())
rollbackMask := zboxutil.NewUint128(0)
errSlice := make([]error, len(commitReqs))
for idx, commitReq := range commitReqs {
if commitReq.result != nil {
if commitReq.result.Success {
l.Logger.Info("Commit success", commitReq.blobber.Baseurl)
l.Logger.Debug("Commit success", commitReq.blobber.Baseurl)
if !mo.isRepair {
rollbackMask = rollbackMask.Or(zboxutil.NewUint128(1).Lsh(commitReq.blobberInd))
}
Expand All @@ -333,7 +333,7 @@ func (mo *MultiOperation) Process() error {
l.Logger.Error("Commit failed", commitReq.blobber.Baseurl, commitReq.result.ErrorMessage)
}
} else {
l.Logger.Info("Commit result not set", commitReq.blobber.Baseurl)
l.Logger.Debug("Commit result not set", commitReq.blobber.Baseurl)
}
}

Expand Down

0 comments on commit 325bdb4

Please sign in to comment.