Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
69961: colexec: adjust the eager cancellation in parallel unordered sync a bit r=yuzefovich a=yuzefovich

This commit adjusts the logic for swallowing errors in the parallel
unordered synchronizer because of the eager cancellation when the
synchronizer transitions into the draining state to swallow all errors
coming from an input if the input's context has been canceled by the
synchronizer.

Fixes: #69419.

Release note: None

Release justification: update to the new functionality.

69985: ui: increment cluster-ui version to 22.1 r=koorosh a=koorosh

After the release branch for 21.2 version is cut,
the version of `cluster-ui` NPM package is changed
to next major version 22.1.x on master branch

Resolves: #69784

Release note: none

69986: log: fix lack of logging tags being improperly represented in the docs r=taroface a=cameronnunez

Release note: none

Co-authored-by: Yahor Yuzefovich <[email protected]>
Co-authored-by: Andrii Vorobiov <[email protected]>
Co-authored-by: Cameron Nunez <[email protected]>
  • Loading branch information
4 people committed Sep 9, 2021
4 parents db49ac0 + 367730e + abbf803 + a04263c commit 955f398
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 40 deletions.
12 changes: 6 additions & 6 deletions docs/generated/logformats.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ reliably that no counter was present.
Example single-line unstructured entry:

~~~
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [] 23 started with engine type ‹2›
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [-] 23 started with engine type ‹2›
~~~

Example multi-line unstructured entry:
Expand All @@ -268,19 +268,19 @@ I210116 21:49:17.083093 14 1@cli/start.go:690 ⋮ [-] 40 +CockroachDB node start
Example structured entry:

~~~
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [] 32 ={"Timestamp":1610833757080706620,"EventType":"node_restart"}
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [-] 32 ={"Timestamp":1610833757080706620,"EventType":"node_restart"}
~~~

Example long entries broken up into multiple lines:

~~~
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [] 23 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa....
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [] 23 |aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [-] 23 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa....
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [-] 23 |aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
~~~

~~~
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [] 32 ={"Timestamp":1610833757080706620,"EventTy...
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [] 32 |pe":"node_restart"}
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [-] 32 ={"Timestamp":1610833757080706620,"EventTy...
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [-] 32 |pe":"node_restart"}
~~~

### Backward-compatibility notes
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/colexec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ go_library(
"//pkg/sql/sqltelemetry", # keep
"//pkg/sql/types",
"//pkg/util",
"//pkg/util/cancelchecker",
"//pkg/util/duration", # keep
"//pkg/util/encoding", # keep
"//pkg/util/humanizeutil",
Expand Down
36 changes: 10 additions & 26 deletions pkg/sql/colexec/parallel_unordered_synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/colexecop"
"github.com/cockroachdb/cockroach/pkg/sql/execinfra"
"github.com/cockroachdb/cockroach/pkg/sql/execinfrapb"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/cancelchecker"
"github.com/cockroachdb/cockroach/pkg/util/tracing"
"github.com/cockroachdb/errors"
)
Expand Down Expand Up @@ -249,30 +247,16 @@ func (s *ParallelUnorderedSynchronizer) init() {
switch state {
case parallelUnorderedSynchronizerStateRunning:
if err := colexecerror.CatchVectorizedRuntimeError(s.nextBatch[inputIdx]); err != nil {
if s.Ctx.Err() == nil && s.cancelLocalInput[inputIdx] != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, cancelchecker.QueryCanceledError) {
// The input context has been canceled, yet the
// main context of the synchronizer has not.
// This indicates that the synchronizer has
// transitioned into draining state and wanted
// this goroutine to stop whatever it was doing.
// Therefore, we swallow the error and proceed
// to draining.
//
// Note that we need the second part of the
// conditional in case the context cancellation
// was observed by the CancelChecker and was
// propagated as a query canceled error.
if util.CrdbTestBuild {
if s.getState() != parallelUnorderedSynchronizerStateDraining {
colexecerror.InternalError(errors.AssertionFailedf(
"unexpectedly the input context is canceled, the main " +
"context is not, and not in the draining state",
))
}
}
continue
}
if s.getState() == parallelUnorderedSynchronizerStateDraining && s.Ctx.Err() == nil && s.cancelLocalInput[inputIdx] != nil {
// The synchronizer has just transitioned into the
// draining state and eagerly canceled work of this
// input. That cancellation is likely to manifest
// itself as the context.Canceled error, but it
// could be another error too; in any case, we will
// swallow the error because the user of the
// synchronizer is only interested in the metadata
// at this point.
continue
}
sendErr(err)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cockroachlabs/cluster-ui",
"version": "21.2.0-prerelease-4",
"version": "22.1.0-prerelease-1",
"description": "Cluster UI is a library of large features shared between CockroachDB and CockroachCloud",
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions pkg/util/log/format_crdb_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ reliably that no counter was present.
Example single-line unstructured entry:
~~~
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [] 23 started with engine type ‹2›
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [-] 23 started with engine type ‹2›
~~~
Example multi-line unstructured entry:
Expand All @@ -128,19 +128,19 @@ I210116 21:49:17.083093 14 1@cli/start.go:690 ⋮ [-] 40 +CockroachDB node start
Example structured entry:
~~~
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [] 32 ={"Timestamp":1610833757080706620,"EventType":"node_restart"}
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [-] 32 ={"Timestamp":1610833757080706620,"EventType":"node_restart"}
~~~
Example long entries broken up into multiple lines:
~~~
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [] 23 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa....
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [] 23 |aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [-] 23 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa....
I210116 21:49:17.073282 14 server/node.go:464 ⋮ [-] 23 |aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
~~~
~~~
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [] 32 ={"Timestamp":1610833757080706620,"EventTy...
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [] 32 |pe":"node_restart"}
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [-] 32 ={"Timestamp":1610833757080706620,"EventTy...
I210116 21:49:17.080713 14 1@util/log/event_log.go:32 ⋮ [-] 32 |pe":"node_restart"}
~~~
### Backward-compatibility notes
Expand Down

0 comments on commit 955f398

Please sign in to comment.