-
Notifications
You must be signed in to change notification settings - Fork 741
sync
-- log tweaks
#2008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync
-- log tweaks
#2008
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,6 +145,8 @@ func (m *Manager) Start(ctx context.Context) error { | |
return ErrAlreadyStarted | ||
} | ||
|
||
m.config.Log.Info("starting sync", zap.Stringer("target root", m.config.TargetRoot)) | ||
|
||
// Add work item to fetch the entire key range. | ||
// Note that this will be the first work item to be processed. | ||
m.unprocessedWork.Insert(newWorkItem(ids.Empty, maybe.Nothing[[]byte](), maybe.Nothing[[]byte](), lowPriority)) | ||
|
@@ -539,14 +541,15 @@ func (m *Manager) Wait(ctx context.Context) error { | |
|
||
root, err := m.config.DB.GetMerkleRoot(ctx) | ||
if err != nil { | ||
m.config.Log.Info("completed with error", zap.Error(err)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like the caller should worry about logging this |
||
return err | ||
} | ||
|
||
if targetRootID := m.getTargetRoot(); targetRootID != root { | ||
// This should never happen. | ||
return fmt.Errorf("%w: expected %s, got %s", ErrFinishedWithUnexpectedRoot, targetRootID, root) | ||
} | ||
m.config.Log.Info("completed", zap.String("new root", root.String())) | ||
|
||
m.config.Log.Info("completed", zap.Stringer("root", root)) | ||
return nil | ||
} | ||
|
||
|
@@ -568,6 +571,7 @@ func (m *Manager) UpdateSyncTarget(syncTargetRoot ids.ID) error { | |
return nil | ||
} | ||
|
||
m.config.Log.Debug("updated sync target", zap.Stringer("target", syncTargetRoot)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for debugging |
||
m.config.TargetRoot = syncTargetRoot | ||
|
||
// move all completed ranges into the work heap with high priority | ||
|
@@ -600,7 +604,7 @@ func (m *Manager) setError(err error) { | |
m.errLock.Lock() | ||
defer m.errLock.Unlock() | ||
|
||
m.config.Log.Error("syncing failed", zap.Error(err)) | ||
m.config.Log.Error("sync errored", zap.Error(err)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
m.fatalError = err | ||
// Call in goroutine because we might be holding [m.workLock] | ||
// which [m.Close] will try to acquire. | ||
|
@@ -662,7 +666,7 @@ func (m *Manager) completeWorkItem(ctx context.Context, work *workItem, largestH | |
} | ||
|
||
// completed the range [work.start, lastKey], log and record in the completed work heap | ||
m.config.Log.Info("completed range", | ||
m.config.Log.Debug("completed range", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like the user doesn't need to see all these, so made it debug |
||
zap.Stringer("start", work.start), | ||
zap.Stringer("end", largestHandledKey), | ||
zap.Stringer("rootID", rootID), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will help for debugging/showing stuff to user