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

release-22.2: merge tag v22.2.16 into release-22.2 #113917

Merged
merged 7 commits into from
Nov 7, 2023

Conversation

michae2
Copy link
Collaborator

@michae2 michae2 commented Nov 7, 2023

v22.2.16 was tagged from a sub-branch off of release-22.2; this merges it back into the release branch so it appears in the linage of subsequent commits.

Epic: none
Release note: none
Release justification: none

DrewKimball and others added 7 commits April 6, 2023 00:49
It is possible for some functional-dependency information to be visible
to a child operator but invisible to its parent. This could previously
cause panics when a child provided an ordering that could be proven to
satisfy the required ordering with the child FDs, but not with the
parent's FDs.

This patch adds a step to the logic that builds provided orderings that
ensures a provided ordering can be proven to respect the required ordering
without needing additional FD information. This ensures that a parent never
needs to know its child's FDs in order to prove that the provided ordering
is correct. The extra step is a no-op in the common case when the provided
ordering can already be proven to respect the required ordering.

Informs cockroachdb#85393
Informs cockroachdb#87806
Fixes cockroachdb#96288

Release note (bug fix): Fixed a rare internal error in the optimizer that has
existed since before version 22.1, which could occur while enforcing orderings
between SQL operators.
Previously, we had the following bug in how the streamer was used under
the following conditions:
- we're looking up into a table with at least 3 column families
- not all column families are needed, so we end up creating
"family-specific" spans (either Gets or Scans - the latter is possible
when multiple contiguous families are needed)
- the streamer is used with OutOfOrder mode (which is the case for index
joins when `MaintainOrdering` is `false` and for lookup joins when
`MaintainLookupOrdering` is `false`)
- the index we're looking up into is split across multiple ranges.

In such a scenario we could end up with KVs from different SQL rows
being intertwined because the streamer could execute a separate
BatchRequest for those rows, and in case `TargetBytes` limit estimate
was insufficient, we'd end up creating "resume" batches, at which point
the "results" stream would be incorrect. Later, at the SQL fetcher level
this could either manifest as an internal "non-nullable column with no
value" error or with silent incorrect output (we'd create multiple
output SQL rows from a true single one).

This problem is now fixed by asking the streamer to maintain the
ordering of the requests whenever we have `SplitFamilyIDs` with more
than one family, meaning that we might end up creating family-specific
spans.

Note that the non-streamer code path doesn't suffer from this problem
because there we only parallelize BatchRequests when neither `TargetBytes`
nor `MaxSpanRequestKeys` limits are set, which is the requirement for
having "resume" batches.

Release note (bug fix): CockroachDB previously could incorrectly
evaluate lookup and index joins into tables with at least 3 column
families in some cases (either "non-nullable column with no value"
internal error would occur or the query would return incorrect results),
and this is now fixed. The bug was introduced in 22.2.
This commit adds `streamer_always_maintain_ordering` session variable
that - when set to `true` - forces all current usages of the streamer in
SQL layer (lookup and index joins) to ask it to maintain the ordering,
even if this is not stricly necessary by the query. This variable is
introduced as a possible workaround in case we find more scenarios where
we currently are incorrectly using the OutOfOrder mode of the streamer.

Release note: None
This patch adds a new session setting, `optimizer_use_provided_ordering_fix`,
which toggles whether to use the `finalizeProvided` function introduced in
required ordering. This setting is on by default, and will be used when
backporting cockroachdb#100776.

Informs cockroachdb#113072

Release note: None
…ort-staging-v22.2.16-113109

staging-v22.2.16: release-22.2: sql: fix usage of streamer with multiple column families (cockroachdb#113694)

Co-Authored-By: Yahor Yuzefovich <[email protected]>
Epic: none
Release note: none
Release justification: none
Copy link

blathers-crl bot commented Nov 7, 2023

Thanks for opening a backport.

Please check the backport criteria before merging:

  • Backports should only be created for serious
    issues
    or test-only changes.
  • Backports should not break backwards-compatibility.
  • Backports should change as little code as possible.
  • Backports should not change on-disk formats or node communication protocols.
  • Backports should not add new functionality (except as defined
    here).
  • Backports must not add, edit, or otherwise modify cluster versions; or add version gates.
  • All backports must be reviewed by the owning areas TL and one additional
    TL. For more information as to how that review should be conducted, please consult the backport
    policy
    .
If your backport adds new functionality, please ensure that the following additional criteria are satisfied:
  • There is a high priority need for the functionality that cannot wait until the next release and is difficult to address in another way.
  • The new functionality is additive-only and only runs for clusters which have specifically “opted in” to it (e.g. by a cluster setting).
  • New code is protected by a conditional check that is trivial to verify and ensures that it only runs for opt-in clusters. State changes must be further protected such that nodes running old binaries will not be negatively impacted by the new state (with a mixed version test added).
  • The PM and TL on the team that owns the changed code have signed off that the change obeys the above rules.
  • Your backport must be accompanied by a post to the appropriate Slack
    channel (#db-backports-point-releases or #db-backports-XX-X-release) for awareness and discussion.

Also, please add a brief release justification to the body of your PR to justify this
backport.

@blathers-crl blathers-crl bot added the backport Label PR's that are backports to older release branches label Nov 7, 2023
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@michae2 michae2 requested review from rail and celiala November 7, 2023 04:55
@michae2
Copy link
Collaborator Author

michae2 commented Nov 7, 2023

I'm not totally sure this is necessary, but I stole a step from the 23.1+ phase 3 runbook and did this anyway for 22.2. It seemed weird not to.

@rail rail merged commit 99c9640 into cockroachdb:release-22.2 Nov 7, 2023
2 checks passed
@michae2 michae2 deleted the release-22.2-merge-v22.2.16 branch November 7, 2023 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Label PR's that are backports to older release branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants