-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
71140: sql: NFC-normalization on double-quoted identifiers r=rafiss a=e-mbrown Resolves: #55396 There was a lack of NFC-normalization on double-quoted identifiers. This allowed for ambiguous table/db/column names. This change adds normalization and prevents this case. Release note: None 71175: ui/cluster-ui: make app name a query search parameter in stmts page r=maryliag,matthewtodd a=xinhaoz Fixes: #70790 Previously, the selected app was derived from a route param on the statements page. All other filters are derived from query search parameters on the page. This commit makes the app name a query search parameter, as is the case in the transactions page. Release note: None 71405: vendor: bump Pebble to 59007c613a66 r=jbowens a=nicktrav ``` 59007c61 sstable: consolidate checksum types 17635b0a *: address staticcheck lints 11823273 *: address staticcheck lint check U1000 807abfe8 *: address staticcheck lint check S1039 d24dd342 all: remove some unused code 3bdca93a sstable: clarify comment on checksum input 926d23e9 pebble: remove comment related to batching from the table cache 0a6177ae db: tweak ErrClosed documentation ecc685b2 db: expose facility for retrieving batch count b2eb88a7 sstable: remove unused rawBlockIter err field ``` Release note: None. 71419: sqlliveness: session expiry callbacks must be async r=ajwerner,jaylim-crl a=dhartunian Previously, the sqlliveness session expiry callbacks were called in the heartbeatLoop thread which executed the renew/expiry logic. This could cause deadlock since session expiration is used to trigger a shutdown of the SQL instance via `stopper.Stop()`. The stopper would wait for all async tasks to quiesce, but the `heartbeatLoop` would continue, waiting for the callbacks to finish running. In addition, this task would hold a lock on `l.mu` while waiting for the callbacks to run causing other threads to wait if they needed to retrieve the session. This change invokes each callback in its own goroutine to prevent this deadlock. Resolves #71292 Release note: None Co-authored-by: e-mbrown <ebsonari@gmail.com> Co-authored-by: Xin Hao Zhang <xzhang@cockroachlabs.com> Co-authored-by: Nick Travers <travers@cockroachlabs.com> Co-authored-by: David Hartunian <davidh@cockroachlabs.com>
- Loading branch information
Showing
23 changed files
with
212 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2021 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package sql_test | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/base" | ||
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils" | ||
"github.com/cockroachdb/cockroach/pkg/util/leaktest" | ||
"github.com/cockroachdb/cockroach/pkg/util/log" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNFCNormalization(t *testing.T) { | ||
defer leaktest.AfterTest(t)() | ||
defer log.Scope(t).Close(t) | ||
s, db, _ := serverutils.StartServer(t, base.TestServerArgs{Insecure: true}) | ||
defer s.Stopper().Stop(context.Background()) | ||
defer db.Close() | ||
|
||
_, err := db.Exec("CREATE TABLE café (a INT)") | ||
require.NoError(t, err) | ||
|
||
_, err = db.Exec("CREATE TABLE Cafe\u0301 (a INT)") | ||
require.Errorf(t, err, "The tables should be considered duplicates when normalized") | ||
require.True(t, strings.Contains(err.Error(), "already exists")) | ||
|
||
_, err = db.Exec("CREATE TABLE cafe\u0301 (a INT)") | ||
require.Errorf(t, err, "The tables should be considered duplicates when normalized") | ||
require.True(t, strings.Contains(err.Error(), "already exists")) | ||
|
||
_, err = db.Exec("CREATE TABLE caf\u00E9 (a INT)") | ||
require.Errorf(t, err, "The tables should be considered duplicates when normalized") | ||
require.True(t, strings.Contains(err.Error(), "already exists")) | ||
|
||
_, err = db.Exec("CREATE TABLE \"caf\u00E9\" (a INT)") | ||
require.Errorf(t, err, "The tables should be considered duplicates when normalized") | ||
require.True(t, strings.Contains(err.Error(), "already exists")) | ||
|
||
_, err = db.Exec("CREATE TABLE \"cafe\u0301\" (a INT)") | ||
require.Errorf(t, err, "The tables should be considered duplicates when normalized") | ||
require.True(t, strings.Contains(err.Error(), "already exists")) | ||
|
||
_, err = db.Exec(`CREATE TABLE "Café" (a INT)`) | ||
require.NoError(t, err) | ||
//Ensure normal strings are not normalized like double quoted strings | ||
var b bool | ||
err = db.QueryRow("SELECT 'caf\u00E9' = 'cafe\u0301'").Scan(&b) | ||
require.NoError(t, err) | ||
require.False(t, b) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.