Skip to content

cli: avoid using background ctx in server start#73678

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
knz:20211110-start-ctx
Dec 13, 2021
Merged

cli: avoid using background ctx in server start#73678
craig[bot] merged 1 commit intocockroachdb:masterfrom
knz:20211110-start-ctx

Conversation

@knz
Copy link
Copy Markdown
Contributor

@knz knz commented Dec 10, 2021

Needed for #73306.
Informs #58938.

This change ensures that the entire server startup and shutdown logic
operates under a go context that is connected to the main config's
tracer and AmbientCtx (and its log tags, and server identifiers).

@knz knz requested review from a team and stevendanna December 10, 2021 13:56
@knz knz requested review from a team as code owners December 10, 2021 13:56
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@knz knz force-pushed the 20211110-start-ctx branch 2 times, most recently from 2ba1f47 to 17ef92b Compare December 10, 2021 14:34
Copy link
Copy Markdown
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm:

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


pkg/cli/start.go, line 708 at r5 (raw file):

	// We'll want to log any shutdown activity against a separate span.
	var shutdownSpan *tracing.Span

[nit] Is this line needed?

Copy link
Copy Markdown
Contributor

@cameronnunez cameronnunez left a comment

Choose a reason for hiding this comment

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

:lgtm:

@knz knz force-pushed the 20211110-start-ctx branch 2 times, most recently from 75941fe to 9f86eb8 Compare December 13, 2021 11:16
Copy link
Copy Markdown
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @RaduBerinde and @stevendanna)


pkg/cli/start.go, line 708 at r5 (raw file):

Previously, RaduBerinde wrote…

[nit] Is this line needed?

Nope, removed.

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Dec 13, 2021

TFYRs!

bors r=RaduBerinde,cameronnunez

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 13, 2021

Build failed:

This change ensures that the entire server startup and shutdown logic
operates under a go context that is connected to the main config's
tracer and AmbientCtx (and its log tags, and server identifiers).

Release note: None
@knz knz force-pushed the 20211110-start-ctx branch from 9f86eb8 to 359dedb Compare December 13, 2021 14:02
@knz
Copy link
Copy Markdown
Contributor Author

knz commented Dec 13, 2021

lint fail
bors r=RaduBerinde,cameronnunez

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 13, 2021

Build succeeded:

@craig craig bot merged commit 976cc79 into cockroachdb:master Dec 13, 2021
@knz knz deleted the 20211110-start-ctx branch December 13, 2021 15:13
craig bot pushed a commit that referenced this pull request Dec 14, 2021
72798: util: support 128 FastIntSet elements without allocation r=RaduBerinde a=RaduBerinde

#### util: support 128 FastIntSet elements without allocation

This commit increases the size of the "small set" bitmap from 64 bits
to 128 bits. The main goal is to avoid the slow path in optimizer
ColSets for more queries.

Fixes #72733.

Release note: None


73306: log,server: avoid global variables to log/trace server IDs r=RaduBerinde,cameronnunez a=knz

First commit from #73678.
Fixes  #58938. 
(still incomplete - needs all the other PRs connected to that issue)

Prior to this change, the server identifiers (cluster ID, node ID etc)
were stored in global variables in the `log` package.
This was problematic when a single process contains multiple servers,
e.g. in tests, `demo` and multi-tenant CockroachDB.

This change switches the mechanism to use identifiers stored in the
go context. The disadvantage is that the server IDs are not any
more logged at the beginning of each log file (since a given log file
could report data from multiple servers).

Release note (cli change): The server identifiers (cluster ID, node
ID, tenant ID, instance ID) are not any more duplicated at the start
of every new log file (during log file rotations). They are now only
logged when known during server start-up.
(The copy of the identifiers is still included in per-event envelopes
for the various `json` output logging formats.)

Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
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.

4 participants