Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
83653: Refactoring app.spec.tsx from Enzyme to React Testing Library r=nathanstilwell a=nathanstilwell



84603: vendor: bump Pebble to 6b9be031039a r=nicktrav a=jbowens

```
6b9be031 internal/metamorphic: add block-property filter coverage
96254cc0 db: don't filter range deletions based on point-key block filters
13cc5cde db: refactor levelIter/mergingIter boundary interface
44e97f43 sstable: fix additional bounds check bugs
e9467bc8 db: export ErrCorruption
9f3691a7 db: remove compaction/flush pacing
b821342a db: remove compaction.atomicBytesIterated
d3484a60 Revert "github: add action runner for automating issue labeling"
```

Close #83376.

Release note: None

84632: ccl/sqlproxyccl: increase cluster name parsing length limit r=JeffSwenson a=jaylim-crl

Previously, cluster names as part of proxy connection strings were restricted
to 6 and 20 alphanumeric characters due to CockroachCloud's limit. There are
plans to increase the length limit on the CockroachCloud side, so this length
limit here has to be lifted.

This commit increases the cluster name length limit from 20 characters to
100 characters. Note that the limit for cluster names within CockroachCloud
is likely smaller than 100 characters. We don't do an exact match here for
more flexibility on CockroachCloud's end.

The limit was originally added to avoid sqlproxy from parsing long strings,
which may be unreasonable. Given that 100 characters are not a lot when it
comes to parsing, this change is acceptable.

Release note: None

Release justification: sqlproxyccl only change.

Co-authored-by: Nathan Stilwell <[email protected]>
Co-authored-by: Jackson Owens <[email protected]>
Co-authored-by: Jay <[email protected]>
  • Loading branch information
4 people committed Jul 19, 2022
4 parents da0a1b8 + d60a20f + febfb46 + 9b871d3 commit 6e9f5a9
Show file tree
Hide file tree
Showing 13 changed files with 227 additions and 301 deletions.
6 changes: 3 additions & 3 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1431,10 +1431,10 @@ def go_deps():
patches = [
"@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch",
],
sha256 = "1d37b28ca579f0d052ae51133945a47626dec63ceef0f07262aaedb033da1d25",
strip_prefix = "github.com/cockroachdb/[email protected]20220706210916-d68c152233af",
sha256 = "ba44b4818846bee833b98b11e22efa4c04efed9533ba16e8e7013a52a5cbc1ab",
strip_prefix = "github.com/cockroachdb/[email protected]20220718171027-6b9be031039a",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20220706210916-d68c152233af.zip",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20220718171027-6b9be031039a.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/go-test-teamcity/com_github_cockroachdb_go_test_teamcity-v0.0.0-20191211140407-cff980ad0a55.zip": "bac30148e525b79d004da84d16453ddd2d5cd20528e9187f1d7dac708335674b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.13.0.zip": "b3d43d8f95edf65f73a5348f29e1159823cac64b148f8d3bb48340bf55d70872",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20211118104740-dabe8e521a4f.zip": "1972c3f171f118add3fd9e64bcea6cbb9959a3b7fa0ada308e8a7310813fea74",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20220706210916-d68c152233af.zip": "1d37b28ca579f0d052ae51133945a47626dec63ceef0f07262aaedb033da1d25",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20220718171027-6b9be031039a.zip": "ba44b4818846bee833b98b11e22efa4c04efed9533ba16e8e7013a52a5cbc1ab",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/redact/com_github_cockroachdb_redact-v1.1.3.zip": "7778b1e4485e4f17f35e5e592d87eb99c29e173ac9507801d000ad76dd0c261e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/returncheck/com_github_cockroachdb_returncheck-v0.0.0-20200612231554-92cdbca611dd.zip": "ce92ba4352deec995b1f2eecf16eba7f5d51f5aa245a1c362dfe24c83d31f82b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/sentry-go/com_github_cockroachdb_sentry_go-v0.6.1-cockroachdb.2.zip": "fbb2207d02aecfdd411b1357efe1192dbb827959e36b7cab7491731ac55935c9",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require (
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
github.com/cockroachdb/gostdlib v1.13.0
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f
github.com/cockroachdb/pebble v0.0.0-20220706210916-d68c152233af
github.com/cockroachdb/pebble v0.0.0-20220718171027-6b9be031039a
github.com/cockroachdb/redact v1.1.3
github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd
github.com/cockroachdb/stress v0.0.0-20220310203902-58fb4627376e
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ github.com/cockroachdb/gostdlib v1.13.0/go.mod h1:eXX95p9QDrYwJfJ6AgeN9QnRa/lqqi
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI=
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f h1:6jduT9Hfc0njg5jJ1DdKCFPdMBrp/mdZfCpa5h+WM74=
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/pebble v0.0.0-20220706210916-d68c152233af h1:N+92y/jD6W4An7/SHHscbSpBru3dg5AB5xQ+XwG6o9Y=
github.com/cockroachdb/pebble v0.0.0-20220706210916-d68c152233af/go.mod h1:pr479tNxFRmcfDyklTqoRMDDVmRlEbL+d7a7rhKnrI4=
github.com/cockroachdb/pebble v0.0.0-20220718171027-6b9be031039a h1:zZ4qaemk1HqFFlQsYBFW88JljJirycMZq2tiG3UP3AE=
github.com/cockroachdb/pebble v0.0.0-20220718171027-6b9be031039a/go.mod h1:pr479tNxFRmcfDyklTqoRMDDVmRlEbL+d7a7rhKnrI4=
github.com/cockroachdb/redact v1.0.8/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
Expand Down
12 changes: 8 additions & 4 deletions pkg/ccl/sqlproxyccl/proxy_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ var (
// See "options" in https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS.
clusterIdentifierLongOptionRE = regexp.MustCompile(`(?:-c\s*|--)cluster=([\S]*)`)

// clusterNameRegex restricts cluster names to have between 6 and 20
// alphanumeric characters, with dashes allowed within the name (but not as a
// starting or ending character).
clusterNameRegex = regexp.MustCompile("^[a-z0-9][a-z0-9-]{4,18}[a-z0-9]$")
// clusterNameRegex restricts cluster names to have between 6 and 100
// alphanumeric characters, with dashes allowed within the name (but not as
// a starting or ending character).
//
// Note that the limit for cluster names within CockroachCloud is likely
// smaller than 100 characters. We don't perform an exact match here for
// more flexibility.
clusterNameRegex = regexp.MustCompile("^[a-z0-9][a-z0-9-]{4,98}[a-z0-9]$")
)

const (
Expand Down
21 changes: 14 additions & 7 deletions pkg/ccl/sqlproxyccl/proxy_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ func TestClusterNameAndTenantFromParams(t *testing.T) {
{
name: "invalid cluster identifier in database param",
params: map[string]string{
// Cluster names need to be between 6 to 20 alphanumeric characters.
// Cluster names need to be between 6 to 100 alphanumeric characters.
"database": "short-0.defaultdb",
},
expectedError: "invalid cluster identifier 'short-0'",
Expand All @@ -1491,11 +1491,18 @@ func TestClusterNameAndTenantFromParams(t *testing.T) {
{
name: "invalid cluster identifier in options param",
params: map[string]string{
// Cluster names need to be between 6 to 20 alphanumeric characters.
"options": "--cluster=cockroachlabsdotcomfoobarbaz-0",
// Cluster names need to be between 6 to 100 alphanumeric characters.
"options": fmt.Sprintf("--cluster=%s-0", strings.Repeat("a", 101)),
},
expectedError: "invalid cluster identifier 'cockroachlabsdotcomfoobarbaz-0'",
expectedHint: "Is 'cockroachlabsdotcomfoobarbaz' a valid cluster name?\n--\n" + clusterNameFormHint,
expectedError: fmt.Sprintf(
"invalid cluster identifier '%s-0'",
strings.Repeat("a", 101),
),
expectedHint: fmt.Sprintf(
"Is '%s' a valid cluster name?\n--\n%s",
strings.Repeat("a", 101),
clusterNameFormHint,
),
},
{
name: "invalid database param (1)",
Expand Down Expand Up @@ -1576,10 +1583,10 @@ func TestClusterNameAndTenantFromParams(t *testing.T) {
{
name: "cluster identifier in database param",
params: map[string]string{
"database": "happy-koala-7.defaultdb",
"database": fmt.Sprintf("%s-7.defaultdb", strings.Repeat("a", 100)),
"foo": "bar",
},
expectedClusterName: "happy-koala",
expectedClusterName: strings.Repeat("a", 100),
expectedTenantID: 7,
expectedParams: map[string]string{"database": "defaultdb", "foo": "bar"},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/db-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cypress:run": "yarn cypress run --browser chrome",
"cypress:run-visual-regression": "yarn cypress run --browser chrome --spec 'cypress/integration/**/*.visual.spec.ts'",
"cypress:update-snapshots": "yarn cypress run --env updateSnapshots=true --spec 'cypress/integration/**/*.visual.spec.ts'",
"test": "DEBUG_PRINT_LIMIT=100000 jest"
"test": "DEBUG_PRINT_LIMIT=1000000 jest"
},
"dependencies": {
"@babel/runtime": "7.12.13",
Expand Down
Loading

0 comments on commit 6e9f5a9

Please sign in to comment.