release-20.2: catalogkv: use in-memory descriptors to validate in GetAllDescriptors #57574
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 2/2 commits from #57542.
/cc @cockroachdb/release
In 20.2 we added logic to validate descriptors on the read path for getting
all descriptors and introduced a performance regression. In particular, we'd
now retrieve all databases and cross references for all tables. This stricter
validation has proven to be somewhat handy and has become utilized in some
tests to ensure that descriptors indeed are valid. Eliminating this validation
would thus be problematic. This is fortunately easy to resolve as we already
have all of the descriptors sitting in memory. With this change, we use them.
Fixes #57249.
In the previously added benchmark tracking the number of KV calls, the code
used to perform 32 reads and now perform 1 (the 32 mostly has to do with
resolving the system database when validating system tables).
Release note (bug fix): Fixed performance regression introduced in v20.2 to
reading virtual tables which introspect the schema.