Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

chunk, pushsync: do not increment synced tags in pushsync #1880

Merged
merged 5 commits into from
Oct 23, 2019

Conversation

nonsense
Copy link
Contributor

This PR is updating the pushsync event loop to not increment tags for synced chunks on receive of receipts (as we are already doing that as part of the localstore mode set).

// set chunk status to synced, insert to db GC index
if err := p.store.Set(ctx, chunk.ModeSetSyncPush, syncedAddrs...); err != nil {
log.Error("pushsync: error setting chunks to synced", "err", err)
}

// delete from pushed items
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we now increment synced tags in the localstore, we can only check if the root span is to be closed after we have performed the set operations.

tag := item.tag
if tag != nil {
tag.Inc(chunk.StateSynced)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We no longer increment synced tags on receive of receipts, but we still close the spans for individual chunks as soon as we get a receipt.

Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 208 to 216
if found {
tag := item.tag
if tag != nil {
if tag.Done(chunk.StateSynced) {
p.logger.Debug("closing root span for tag", "taguid", tag.Uid, "tagname", tag.Name)
tag.FinishRootSpan()
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This Pyramid of Doom can be simplified:

if found && item.tag != nil && item.tag.Done(chunk.StateSynced) {
        tag := item.tag
	p.logger.Debug("closing root span for tag", "taguid", tag.Uid, "tagname", tag.Name)
	tag.FinishRootSpan()
}			

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix, thanks! I have to see why the tests are failing, not sure if they are flaky, or the change to upload.go does indeed have an effect.

@nonsense nonsense merged commit 1a64457 into master Oct 23, 2019
@acud acud added this to the 0.5.3 milestone Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants