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

[dnm] *: cherry-pick 61777 onto 59992 #62349

Closed

Conversation

irfansharif
Copy link
Contributor

@irfansharif irfansharif commented Mar 22, 2021

sql: only create real spans when session tracing/sampling r=irfansharif a=irfansharif

This drastically reduces the memory overhead for tracing we're observing
in #59424. This commit does a few disparate things to make it happen:

  1. We now access the tracing span through txnState.Ctx exclusively. This
    gives us a single point to hijack, which we'll later do. By default
    txn's are initialized with a no-op span. If later on session tracing is
    enabled, we'll create a real (verbose) span and swap it out with the
    txn's no-op one. This gives us the same semantics as earlier, and on the
    plus side, we're not re-using the same tracing span when session tracing
    is toggled.
  2. Hard tracing methods to work with no-op spans. Specifically
    GetRecording and TraceID.
  3. Remove a crash vector through crdb_internal.trace_id. It was
    previously reaching into the first recording to retrieve a trace ID. But
    it's not guaranteed that recordings are non-empty. This could be used to
    induce panics in the server.

This PR will need to get backported to 21.1. Fixes #59424.

Release note: None

---

sql: only create real spans when session tracing/sampling r=irfansharif a=irfansharif

This drastically reduces the memory overhead for tracing we're observing
in cockroachdb#59424. This commit does a few disparate things to make it happen:

1. We now access the tracing span through txnState.Ctx exclusively. This
   gives us a single point to hijack, which we'll later do. By default
   txn's are initialized with a no-op span. If later on session tracing is
   enabled, we'll create a real (verbose) span and swap it out with the
   txn's no-op one. This gives us the same semantics as earlier, and on the
   plus side, we're not re-using the same tracing span when session tracing
   is toggled.
2. Hard tracing methods to work with no-op spans. Specifically
   GetRecording and TraceID.
3. Remove a crash vector through crdb_internal.trace_id. It was
   previously reaching into the first recording to retrieve a trace ID. But
   it's not guaranteed that recordings are non-empty. This could be used to
   induce panics in the server.

This PR will need to get backported to 21.1. Fixes cockroachdb#59424.

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@irfansharif irfansharif deleted the 210322.custom-cherrypick branch March 22, 2021 16:02
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.

roachtest: tpccbench/nodes=3/cpu=16 failed
2 participants