Skip to content

sql: fix namespace name resolution fallback code#43226

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
arulajmani:fix-namespace-fallback
Dec 17, 2019
Merged

sql: fix namespace name resolution fallback code#43226
craig[bot] merged 1 commit intocockroachdb:masterfrom
arulajmani:fix-namespace-fallback

Conversation

@arulajmani
Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani commented Dec 17, 2019

Previously, the fallback for name resolution was broken. If an entry
is not present in the new system.namespace, we should look it up
in the old system.namespace. This was not happening, as we would
only fallback to the old system.namespace if the entry was a table.
Thus, databases created before the new system.namespace table was
created were not being resolved at all. This PR fixes that.

Fixes #43141

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@arulajmani arulajmani force-pushed the fix-namespace-fallback branch from b52e1bc to a719d43 Compare December 17, 2019 03:45
Copy link
Copy Markdown
Member

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

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

Ah, makes sense. Is there any way you can add tests for this? It seems like a test that tries to resolve a database given a set of keys in the new state like our broken clusters were would fail in the old state and not after this fix.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis)

Copy link
Copy Markdown
Member

@jordanlewis jordanlewis 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

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

Previously, the fallback for name resolution was broken. If an entry
is not present in the new `system.namespace`, we should look it up
in the old `system.namespace`. This was not happening, as we would
only fallback to the old `system.namespace` if the entry was a table.
Thus, databases created before the new `system.namespace` table was
created were not being resolved at all. This PR fixes that.

Fixes cockroachdb#43141

Release note: None
@arulajmani arulajmani force-pushed the fix-namespace-fallback branch from a719d43 to 96e87e2 Compare December 17, 2019 06:15
Copy link
Copy Markdown
Collaborator Author

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

TFTR. Added a test that accesses a database/table created before the version upgrade sequence starts. Decided to explicitly create these two objects, instead of using if not exists to closely mirror the state we were in.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)

Copy link
Copy Markdown
Member

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

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

:lgtm: if you can confirm the test fails before the patch :)

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@arulajmani
Copy link
Copy Markdown
Collaborator Author

Test fails before the patch. Merging.

bors r+

craig bot pushed a commit that referenced this pull request Dec 17, 2019
43147: closedts: shorten target_duration from 30s to 3s r=ajwerner a=ajwerner

This PR dramatically shortens the closed timestamp target interval. With this
setting the experimental_follower_read_timestamp() will now be 4.8 seconds in
the past as opposed to the current 48 seconds in the past. This relatively
aggressive setting of 3s is intended to shake out issues.

This value has been verified to work on the `schemachange/mixed/tpcc` roachtest
introduced in #39096 and for vanilla TPC-C runs around where we have
established a baseline in the past using tpccbench. Specifically several runs
at 2300 warehouses on 3x c5d.4xlarge nodes which is right at the passing
boundary without the change were run only a very small difference in
efficiency or tail latency was observed.

It seems reasonable to attempt to live with this value on master for a while
and see what happens.

Fixes #37083.

Release note (enterprise change): Shorten the default closed timestamp target
interval from 30s to 3s leading to permit follower reads at 4.8 seconds in
the past rather than the previous 48 seconds.

43226: sql: fix namespace name resolution fallback code r=arulajmani a=arulajmani

Previously, the fallback for name resolution was broken. If an entry
is not present in the new `system.namespace`, we should look it up
in the old `system.namespace`. This was not happening, as we would
only fallback to the old `system.namespace` if the entry was a table.
Thus, databases created before the new `system.namespace` table was
created were not being resolved at all. This PR fixes that.

Fixes #43141

Release note: None

Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
Co-authored-by: arulajmani <arulajmani@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 17, 2019

Build succeeded

@craig craig bot merged commit 96e87e2 into cockroachdb:master Dec 17, 2019
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: acceptance/version-upgrade failed

3 participants