Skip to content

Delete enable hint database param#166118

Closed
michae2 wants to merge 2 commits intocockroachdb:masterfrom
michae2:delete-enable-hint-database-param
Closed

Delete enable hint database param#166118
michae2 wants to merge 2 commits intocockroachdb:masterfrom
michae2:delete-enable-hint-database-param

Conversation

@michae2
Copy link
Copy Markdown
Collaborator

@michae2 michae2 commented Mar 19, 2026

No description provided.

@trunk-io
Copy link
Copy Markdown
Contributor

trunk-io Bot commented Mar 19, 2026

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@michae2 michae2 force-pushed the delete-enable-hint-database-param branch from a9c00cd to 5004b5c Compare March 19, 2026 17:32
michae2 and others added 2 commits March 19, 2026 11:09
Add an `optDatabase` parameter to `DeleteHintFromDB`,
`SetHintEnabledInDB`, and their corresponding `Planner` interface
methods (`DeleteStatementHint`, `SetStatementHintEnabled`). When
non-empty, the database is used as an additional WHERE filter.

`DeleteHintFromDB` now also returns the database of each deleted row so
callers can include it in telemetry events. It also gains a
`*cluster.Settings` parameter and a version check for the `database`
column, consistent with the other hint table functions.

Update the `DeleteRewriteInlineHints` and `DeleteSessionVariableHint`
proto messages to add a `database` field and reorder fields to match
their create-event counterparts (`RewriteInlineHints`,
`SetSessionVariableHint`). Also add the `DonorSQL` customname to
`DeleteRewriteInlineHints.donor_sql` for consistency.

Extract existing delete-hint overloads from inline definitions to named
package-level variables for consistency with the enable-hint overloads.

All existing callers pass empty string for the new parameter, so this
commit is a no-op.

Release note: None

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
Add new overloads that accept a `database` parameter:

- `crdb_delete_statement_hints(statement_fingerprint, database)` —
  deletes hints matching both the fingerprint and database.
- `crdb_enable_statement_hints(enabled, statement_fingerprint, database)`
  — enables/disables hints matching both the fingerprint and database.

These complement the existing database overloads on
`crdb_rewrite_inline_hints` and `crdb_set_session_variable_hint`.

Release note (sql change): Added database-scoped overloads for
crdb_delete_statement_hints and crdb_enable_statement_hints builtins,
allowing hints to be deleted or enabled/disabled by fingerprint and
database.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@michae2 michae2 force-pushed the delete-enable-hint-database-param branch from 5004b5c to 147b05c Compare March 19, 2026 18:15
@michae2 michae2 closed this Mar 27, 2026
@michae2 michae2 deleted the delete-enable-hint-database-param branch March 27, 2026 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants