Skip to content

server: use a shared ID container + guarantee log tag#73159

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
knz:20211125-shared-container
Dec 8, 2021
Merged

server: use a shared ID container + guarantee log tag#73159
craig[bot] merged 3 commits intocockroachdb:masterfrom
knz:20211125-shared-container

Conversation

@knz
Copy link
Copy Markdown
Contributor

@knz knz commented Nov 25, 2021

All commits but the last from #73158 and prior PRs.
(Reviewers: focus on the last commit)

Uses the infra set up in #73156, as recommended by Radu in this comment.

Informs #58938.
Fixes #72815.
Supersedes #72702.

Prior to this commit, certain components were initialized from the
base server config (BaseConfig).AmbientContext before the node ID /
SQL instance ID container was attached to it via AddLogTag.

This commit fixes that by instantiating the node ID / SQL instance ID
container once in the BaseConfig, together with the
AmbientContext, and binding them together before the config is used
as input to initialize other components.

@knz knz requested review from a team, RaduBerinde and rimadeodhar November 25, 2021 14:47
@knz knz requested a review from a team as a code owner November 25, 2021 14:47
@knz knz requested a review from a team November 25, 2021 14:47
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@postamar postamar removed the request for review from a team November 25, 2021 14:48
@knz knz force-pushed the 20211125-shared-container branch 2 times, most recently from 62a07da to 907857c Compare November 25, 2021 15:17
@knz knz force-pushed the 20211125-shared-container branch from 907857c to df3eed7 Compare November 25, 2021 15:31
@tbg tbg removed the request for review from a team November 26, 2021 16:27
@knz knz force-pushed the 20211125-shared-container branch from df3eed7 to 42cf0c3 Compare November 29, 2021 11:56
Copy link
Copy Markdown
Collaborator

@rimadeodhar rimadeodhar left a comment

Choose a reason for hiding this comment

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

This change :lgtm:.

Reviewed 3 of 8 files at r1, 7 of 7 files at r4, 2 of 2 files at r5, 3 of 3 files at r6, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)

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! 2 of 0 LGTMs obtained (waiting on @knz)


pkg/server/config.go, line 179 at r6 (raw file):

	baseCfg := BaseConfig{
		Tracer:            tr,
		IDContainer:       &c,

[nit] can just do &base.NodeIDContainer{} since we're not using c

@knz knz force-pushed the 20211125-shared-container branch from 42cf0c3 to d68a26f Compare December 8, 2021 12:54
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 @rimadeodhar)


pkg/server/config.go, line 179 at r6 (raw file):

Previously, RaduBerinde wrote…

[nit] can just do &base.NodeIDContainer{} since we're not using c

Done.

@knz knz force-pushed the 20211125-shared-container branch from d68a26f to 6168592 Compare December 8, 2021 12:56
knz added 3 commits December 8, 2021 14:11
This commit ensures that the same data structure can store both SQL
instance IDs and Node IDs. The decision is made upon instantiation of
the container which of the two types of IDs the container stores.

This simplifies the code and paves the road to using a single
container in servers for the purpose of identifying the server
instance in traces and logs.

This also revisits the change in  cockroachdb#72607 by switching the
tracing/logging prefix `sqli` to `nsql` for SQL instance servers.

Release note: None
Prior to this commit, certain components were initialized from the
base server config `(BaseConfig).AmbientContext` before the node ID /
SQL instance ID container was attached to it via `AddLogTag`.

This commit fixes that by instantiating the node ID / SQL instance ID
container once in the `BaseConfig`, together with the
`AmbientContext`, and binding them together before the config is used
as input to initialize other components.

Release note: None
@knz knz force-pushed the 20211125-shared-container branch from 6168592 to 17ba7e9 Compare December 8, 2021 13:13
@craig craig bot merged commit 17ba7e9 into cockroachdb:master Dec 8, 2021
@knz knz deleted the 20211125-shared-container branch December 8, 2021 16:30
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.

server: AmbientContext is copied around with insufficient initial tags

4 participants