Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
91695: docs issue generation: Run script over a specified period of time r=nickvigilante a=nickvigilante

The docs issue generation (DIG) script now runs nightly and uses a start and end time to calculate the PRs it needs to scan to determine if a docs issue must be created. This also utilizes GraphQL queries against GitHub's GraphQL API.

Release note: None

Fixes: #72910

92792: sql: Make USING EXTREMES predicates parsable r=michae2 a=faizaanmadhani

Previously the USING EXTREMES predicates
were constructed as strings which would
make them very difficult to parse. This PR
changes the way these predicates are
constructed so that they can later be parsed.

Release note (sql change): USING EXTREME predicates in the output of 
SHOW STATISTICS will have additional
parenthesis and type assertions.

Epic: CRDB-19449

93100: clisqlshell: correctly handle sending zero input for COPY r=rafiss a=otan

Resolves #93051

Release note (bug fix): Previously, empty COPY commands would not escape after an EOF character or error if encountering a `\.` with no input. This is now resolved.

93101: sql/schemachanger: reassign owned by and concurrent declarative schema changer drops can conflict r=fqazi a=fqazi

Informs: #87572

A number of bugs exist inside DROP OWNED / REASSIGNED OWNED BY inside the declarative schema changer:
1.  If a concurrent DROP operation for schema/database with a REASSIGNED OWNED BY could lead to the descriptors being dropped incorrectly by legacy schema changer jobs. This patch adds additional logic to ensure that only descriptors marked for drops are cleaned up.
2. The DROP OWNED BY support inside the declarative schema changer requires no privileges to be defined, unfortunately, this logic did not have proper error handling
3. When cleaning up back-references from schemas to the database, we skipped certain operations if the database was dropped, which is true after any cascaded DROP DATABASE statement phase. Which can lead to other issues depending on the stages executed.

93173: sql: fix bug when using glob which matches nothing r=ajwerner a=ajwerner

Logic in the 22.2 cycle for synthetic privileges erroneously assumed that if no physical tables matched, that it must mean that virtual tables matched. It also assumed that if the first entry in a pattern matched, it applied to all entries. Both of these assumptions were wrong. They lead to ugly panics.

Fixes: #92483

Release note (bug fix): Fixed a bug whereby glob patterns which matched no tables in `GRANT` or `REVOKE` statements would return an internal error with a confusing message as opposed to the appropriate "no objects matched" error.

Co-authored-by: Nick Vigilante <[email protected]>
Co-authored-by: Faizaan Madhani <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
Co-authored-by: Faizan Qazi <[email protected]>
Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
6 people committed Dec 7, 2022
6 parents 8248dce + d7560f7 + 495b4cb + 58f1e43 + 8bb30c7 + c8bc75b commit a9fcbd1
Show file tree
Hide file tree
Showing 15 changed files with 965 additions and 862 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ upsert descriptor #104
id: 104
modificationTime: {}
...
public:
id: 105
regionEnumId: 106
survivalGoal: REGION_FAILURE
- schemas:
- public:
- id: 105
- version: "1"
+ state: DROP
+ version: "2"
Expand Down
6 changes: 4 additions & 2 deletions pkg/cli/clisqlshell/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ func (c *cliState) doStartLine(nextState cliStateEnum) cliStateEnum {
c.atEOF = false
c.partialLines = c.partialLines[:0]
c.partialStmtsLen = 0
c.concatLines = ""

c.useContinuePrompt = false

Expand Down Expand Up @@ -1325,7 +1326,8 @@ func (c *cliState) doHandleCliCmd(loopState, nextState cliStateEnum) cliStateEnu

case `\.`:
if c.inCopy() {
c.concatLines += "\n" + `\.`
c.partialLines = append(c.partialLines, `\.`)
c.partialStmtsLen++
return cliRunStatement
}
return c.invalidSyntax(errState)
Expand Down Expand Up @@ -1755,7 +1757,7 @@ func (c *cliState) doPrepareStatementLine(
(c.inCopy() && (strings.HasSuffix(c.concatLines, "\n"+`\.`) || c.atEOF)) ||
// We're always at the end of a statement if EOF is reached in the
// single statement mode.
c.singleStatement && c.atEOF
(c.singleStatement && c.atEOF)
if c.atEOF {
// Definitely no more input expected.
if !endOfStmt {
Expand Down
16 changes: 16 additions & 0 deletions pkg/cli/interactive_tests/test_copy.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ eexpect "could not parse"

end_test

start_test "check EMPTY copy"

send "COPY t FROM STDIN;\r"
eexpect ">>"
send_eof
eexpect "COPY 0"
eexpect root@

send "COPY t FROM STDIN;\r"
eexpect ">>"
send "\\.\r"
eexpect "COPY 0"
eexpect root@

end_test

start_test "multi statement with COPY"
send "SELECT 1; COPY t FROM STDIN CSV;\r"
eexpect "COPY together with other statements in a query string is not supported"
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/docs-issue-generation/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ go_library(
],
importpath = "github.com/cockroachdb/cockroach/pkg/cmd/docs-issue-generation",
visibility = ["//visibility:private"],
deps = ["@com_github_spf13_cobra//:cobra"],
deps = [
"//pkg/util/timeutil",
"@com_github_spf13_cobra//:cobra",
],
)

go_binary(
Expand Down
Loading

0 comments on commit a9fcbd1

Please sign in to comment.