From b559f33ef4a0f1c5f0b2a2088e4bd9579cd03e91 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Wed, 22 May 2024 14:15:56 +0530 Subject: [PATCH 1/2] set some logs level to debug --- zboxcore/sdk/commitworker.go | 18 +++++++++--------- zboxcore/sdk/common.go | 1 - zboxcore/sdk/downloadworker.go | 4 ++-- zboxcore/sdk/multi_operation_worker.go | 18 +++++++++--------- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/zboxcore/sdk/commitworker.go b/zboxcore/sdk/commitworker.go index 9e2f6aa3f..7fb8eeea8 100644 --- a/zboxcore/sdk/commitworker.go +++ b/zboxcore/sdk/commitworker.go @@ -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 } @@ -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) @@ -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() } @@ -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 @@ -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 @@ -315,7 +315,7 @@ 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 @@ -323,7 +323,7 @@ func (req *CommitRequest) commitBlobber( } 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 diff --git a/zboxcore/sdk/common.go b/zboxcore/sdk/common.go index cc879facc..9818c4e2c 100644 --- a/zboxcore/sdk/common.go +++ b/zboxcore/sdk/common.go @@ -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) diff --git a/zboxcore/sdk/downloadworker.go b/zboxcore/sdk/downloadworker.go index 159e4ef51..eb9955056 100644 --- a/zboxcore/sdk/downloadworker.go +++ b/zboxcore/sdk/downloadworker.go @@ -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) @@ -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(), diff --git a/zboxcore/sdk/multi_operation_worker.go b/zboxcore/sdk/multi_operation_worker.go index 21c9b16fa..12f7fc724 100644 --- a/zboxcore/sdk/multi_operation_worker.go +++ b/zboxcore/sdk/multi_operation_worker.go @@ -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 } @@ -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 @@ -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 { @@ -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 { @@ -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) @@ -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)) } @@ -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) } } From b9f9ea5b223bfd04e8bc3c0c1c3c9084a469edff Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Wed, 22 May 2024 15:04:49 +0530 Subject: [PATCH 2/2] set log level to debug for file and delete worker --- zboxcore/sdk/allocation.go | 2 +- zboxcore/sdk/deleteworker.go | 4 ++-- zboxcore/sdk/filerefsworker.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zboxcore/sdk/allocation.go b/zboxcore/sdk/allocation.go index dcb833cba..847898029 100644 --- a/zboxcore/sdk/allocation.go +++ b/zboxcore/sdk/allocation.go @@ -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 diff --git a/zboxcore/sdk/deleteworker.go b/zboxcore/sdk/deleteworker.go index b52cdf773..ede5a4892 100644 --- a/zboxcore/sdk/deleteworker.go +++ b/zboxcore/sdk/deleteworker.go @@ -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 } @@ -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 } diff --git a/zboxcore/sdk/filerefsworker.go b/zboxcore/sdk/filerefsworker.go index 4aabd0683..e9eeba05d 100644 --- a/zboxcore/sdk/filerefsworker.go +++ b/zboxcore/sdk/filerefsworker.go @@ -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()