Skip to content
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

Merged
merged 2 commits into from
Sep 12, 2023
Merged

sync -- log tweaks #2008

merged 2 commits into from
Sep 12, 2023

Conversation

danlaine
Copy link

Why this should be merged

See comments

How this works

n/a

How this was tested

n/a

@danlaine danlaine self-assigned this Sep 12, 2023
@@ -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))
Copy link
Author

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

@@ -539,14 +541,13 @@ 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))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the caller should worry about logging this

@@ -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))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syncing --> sync for parallelism

@@ -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",
Copy link
Author

Choose a reason for hiding this comment

The 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

@@ -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))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for debugging

@danlaine danlaine marked this pull request as ready for review September 12, 2023 19:12
@danlaine danlaine merged commit e5f676a into dev Sep 12, 2023
@danlaine danlaine deleted the sync-log-nit branch September 12, 2023 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants