Skip to content

Conversation

@andreimatei
Copy link
Contributor

This patch propagates the SpanContext of the proposer to all the
replicas, which then decode it and create a "follows from" child span
for the application. The local replica does not use this, since it
already had direct access to the proposer's ctx and span.
Now tracing utilities will show us all the command applications for a
proposal tied to each other and we'll profit.

Release note: None

@andreimatei andreimatei requested a review from nvb August 7, 2019 23:08
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@andreimatei
Copy link
Contributor Author

cc @spencerkimball

Copy link
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

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

:lgtm: though I'm still a little confused why we're favoring the tracing of entry application over the tracing of entry sequencing in the Raft log. I would expect that appending to the Raft log would be the more interesting place to inject tracing on followers because it's synchronous with the client write.

I guess it's a little harder to pull out tracing spans at that stage because we don't decode the Raft command. Still, I'm curious whether there are any plans to do something like that?

Reviewed 5 of 5 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei)


pkg/storage/replica_application_decoder.go, line 139 at r1 (raw file):

	for it.init(&d.cmdBuf); it.Valid(); it.Next() {
		cmd := it.cur()
		parentCtx := ctx

Get rid of this variable.


pkg/storage/replica_application_decoder.go, line 142 at r1 (raw file):

		if cmd.IsLocal() {
			parentCtx = cmd.proposal.ctx
			cmd.ctx, cmd.sp = tracing.ForkCtxSpan(parentCtx, "raft application")

Pull "raft application" into const opName = "raft application"

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

bors r+

I guess it's a little harder to pull out tracing spans at that stage because we don't decode the Raft command. Still, I'm curious whether there are any plans to do something like that?

Now there is :P
Once this merges, I'll file an issue for what you want.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)


pkg/storage/replica_application_decoder.go, line 139 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Get rid of this variable.

done


pkg/storage/replica_application_decoder.go, line 142 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Pull "raft application" into const opName = "raft application"

done

@craig
Copy link
Contributor

craig bot commented Aug 12, 2019

Build failed

@andreimatei andreimatei force-pushed the pr/39425 branch 2 times, most recently from bd5451a to 85dda1b Compare October 9, 2019 21:06
Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

hey @nvanbenschoten and @ajwerner , check out the increase in proposal size showed by TestProposalOverhead. We all still cool on this? (I am)

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)

@nvb
Copy link
Contributor

nvb commented Oct 9, 2019

We all still cool on this? (I am)

50 bytes of overhead to 133 bytes per Raft entry is a major regression. We need a lot to justify that kind of change. I thought this was only going to hurt when tracing is enabled.

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

I thought this was only going to hurt when tracing is enabled.

yeah now that I think about it, that's the intention. Maybe getTraceData() needs to handle the noop span... I'll see.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

note to self: TestProposalOverhead fails because tracing is enabled for its purposes because nobody sets trace.debug.enable for the test's testContext.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

note to self: let's default trace.debug.enable to false and stop this nonsense

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)

This patch propagates the SpanContext of the proposer to all the
replicas, which then decode it and create a "follows from" child span
for the application. The local replica does not use this, since it
already had direct access to the proposer's ctx and span.
Now tracing utilities will show us all the command applications for a
proposal tied to each other and we'll profit.

Release note: None
Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

Now trace.debug.enable defaults to false and the test correctly shows no overhead when tracing is off.

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)

@andreimatei andreimatei merged commit 9b36103 into cockroachdb:master Oct 22, 2019
@andreimatei andreimatei deleted the pr/39425 branch October 22, 2019 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants