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

server: report the SQL instance ID as log tag sqli #72607

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

knz
Copy link
Contributor

@knz knz commented Nov 10, 2021

Informs #58938.

Prior to this patch, the SQL instance ID was not reported in log
messages, which made it hard to distinguish log messages coming from
different in-memory SQL instance servers (e.g. in tests).

This patch fixes it.

The patch also changes the log tag for SQL instances from just sql
to sqli, which is easier to search for and recognize.

Release note: None

@knz knz requested review from RaduBerinde, rimadeodhar and a team November 10, 2021 13:05
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
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.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz and @RaduBerinde)


pkg/base/node_id.go, line 242 at r1 (raw file):

func (s *SQLIDContainer) SafeValue() {}

func (s *SQLIDContainer) String() string {

Loved the comments here, made it much easier to understand.

Prior to this patch, the SQL instance ID was not reported in log
messages, which made it hard to distinguish log messages coming from
different in-memory SQL instance servers (e.g. in tests).

This patch fixes it.

The patch also changes the log tag for SQL instances from just `sql`
to `sqli`, which is easier to search for and recognize.

Release note: None
@knz knz force-pushed the 20211110-instance-log branch from 75257ac to bb8af18 Compare November 11, 2021 11:32
@knz
Copy link
Contributor Author

knz commented Nov 11, 2021

TFYR!

bors r=rimadeodhar

@craig
Copy link
Contributor

craig bot commented Nov 11, 2021

Build succeeded:

@craig craig bot merged commit 46dcf39 into cockroachdb:master Nov 11, 2021
@knz knz deleted the 20211110-instance-log branch November 11, 2021 12:38
craig bot pushed a commit that referenced this pull request Nov 11, 2021
72608: base: ensure that a SQL instance ID is not set to conflicting value r=rimadeodhar a=knz

Informs #58938.
First commit from #72607.

Prior to this patch, a SQL instance ID container could be
assigned successively different values. This would make it possible
for erroneous code to mistakenly initialize the instance ID twice,
without any evidence that something was amiss.

This patch fixes this by using the same prevention logic that we
already use for node IDs.


Co-authored-by: Raphael 'kena' Poss <[email protected]>
knz added a commit to knz/cockroach that referenced this pull request Nov 25, 2021
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
knz added a commit to knz/cockroach that referenced this pull request Nov 29, 2021
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
knz added a commit to knz/cockroach that referenced this pull request Dec 8, 2021
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
knz added a commit to knz/cockroach that referenced this pull request Dec 8, 2021
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
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