-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release-21.1: sql: various event log fixes #65554
Merged
knz
merged 11 commits into
cockroachdb:release-21.1
from
knz:backport21.1-61776-63743-64871-64894
May 21, 2021
Merged
release-21.1: sql: various event log fixes #65554
knz
merged 11 commits into
cockroachdb:release-21.1
from
knz:backport21.1-61776-63743-64871-64894
May 21, 2021
Conversation
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
Fixes: cockroachdb#58496 Previously, the object name information for TableIndexName, was not populated in multiple contexts leading to incorrect formatting of index names in event log messages. To address this, this patch modifies code paths for resolving table indexes to add this information during the planning phase. Release note: None
Helps with cockroachdb#41930. Previously, if we ran grant/revoke on multiple tables, we would create event logs for each table and write them one by one, resulting in round trips proportional to the number of tables. This patch addresses this by batch writing the event logs, so that 1 write to the event log table occurs regardless of the number of tables updated. Release note: None
Release note (sql change): The statement type ("tag") is now also included alongside the full text of the SQL query in the various structured log entries produced when query execution is being logged.
Prior to this patch, there was a little mess in `sql/event_log.go` that had been introduced when "optimizing" GRANT/REVOKE to only use one write batch for all the events logged: - the API interface for the functions in event_log.go were complex to use, requiring callers to provide descriptor IDs and structured events as separate slices; - the optimizing logic was not properly applied to the other case where multiple events are emitted: SQL audit logging in `exec_log.go`. This patch cleans this up by using the same struct `eventLogEntry` as argument to the various APIs. Release note: None
…ging The previous patch to batch event writes for GRANT/REVOKE had duplicated code. This was not necessary. This patch fixes this by using the same code for both cases. Release note: None
This clarifies its purpose. Release note: None
`logEventsOnlyExternally()` is specific to the code in `exec_log.go` and should thus reside there. This patch achieves that. Release note: None
The code was previously using two booleans `onlyLog` and `writeToEventLog` which were making the code difficult to understand and to maintain. This patch fixes this by introducing a bitset with descriptive names. Release note: None
This further simplifies the internal API. Release note: None
This patch describes `event_log.go` at a high level: an overall event refinement pipeline with a straightforward control flow. Release note: None
This patch fixes a bug introduced when query logging started using structured events: the ability to automatically copy all the execution events to the DEV channel when setting the `vmodule` setting to `exec_log=2` (or above). In addition to fixing that bug, the following new vmodule-based abilities are added: - events for DDL statements and others that call `logEvent()` can now be collected in the DEV channel by using the name of the source file where they were generated as filter (e.g. `vmodule=create_table=2` for the CREATE TABLE events. - events of other kinds can be collected in the DEV channel by setting `vmodule=event_log=2`. (Note a subtle difference between `vmodule=create_table=2` and `vmodule=exec_log=2`: the former emits the event to the DEV channel while the stmt is executed; the latter emits the event after the stmt completes. If both are enabled, TWO events are sent to the DEV channel.) Since all the vmodule filtering options are subject to change without notice between versions, we do not wish to document these nuances. For this reason, the release note below is left blank. Release note: None
rafiss
approved these changes
May 21, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport:
TableIndexName
can be wrong in certain contexts" (sql: formatting ofTableIndexName
can be wrong in certain contexts #61776)Please see individual PRs for details.
/cc @cockroachdb/release