From d4186bc68ab20ecdeb44ab5cf6b95cb4764428b2 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Fri, 4 Dec 2020 18:23:46 +0100 Subject: [PATCH] sql,log: productionize the event logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CockroachDB needs to report structured events for "important" events on the logical structure of a cluster, including changes to the SQL logical schema, node activity, privilege changes etc. Prior to this patch, these events were reported mainly into the table `system.eventlog`, with a partial copy of the payload into the debugging external log (`cockroach.log`). This solution was incomplete and unsatisfactory in many ways: - the event payloads were not documented. - the event payloads were not centrally defined, which was preventing the generation of automatic documentation. - the payload types were declared "inline" in the log calls, which made it easy for team members to inadvertently change the structure of the payload and make them backward-incompatible for users consuming this data externally. - the payload fields were inconsistently named across event types. - the metadata fields on the payloads were incompletely and inconsistently populated: - the SQL instance ID was missing in some cases. - the descriptor ID of affected descriptor was missing in some cases. - the same event type was mistakenly used for different events (e.g. "rename_database" for both RENAME DATABASE and CONVERT TO SCHEMA) - the same event type was abusingly over-used for multiple separate operations, e.g. a single event would be generated for a multi-table, multi-user GRANT or REVOKE operation. - the copy in the external log was not parseable. Generally, the logging package was unaware of the internal structure of events and would “flatten” them. - no provision was available to partially redact events. From the logging system's perspective, the entire payload is sensitive. This commit changes the situation as follows: - it centralizes the payload definitions and standardizes them into a new package `eventspb`. - it enables automatic generation of documentation for events. - it ensures that field names are consistent across event payloads. - it ensures that event metadata is consistently populted. - it decomposes complex GRANT/REVOKE operations into individual events. - it automates the generation of a reference documentation for all event types. (FIXME - remaining to be done:) - it provide a guardrail against the introduction of new DDL statements without a corresponding event log. The following problems continue to exist and need to be resolved separately: - privilege changes that occur as a side effect of certain operations do not get events logged: https://github.com/cockroachdb/cockroach/issues/57573 https://github.com/cockroachdb/cockroach/issues/57576 https://github.com/cockroachdb/cockroach/issues/57739 https://github.com/cockroachdb/cockroach/issues/57741 - the name fields in certain DDL events is not properly qualified, which prevents the determination of the logical schema or database where the object was altered: https://github.com/cockroachdb/cockroach/issues/57734 https://github.com/cockroachdb/cockroach/issues/57735 https://github.com/cockroachdb/cockroach/issues/57738 https://github.com/cockroachdb/cockroach/issues/57740 Release note (sql change): The cluster event logging system has been modernized. In particular, the schema of the entries for the `info` column in `system.eventlog` has been stabilized. See the documentation for details. Release note (sql change): The `targetID` and `reportingID` columns in `system.eventlog` are now deprecated. Their values, for relevant event types, can be found as fields inside the `info` column instead. --- Makefile | 14 +- build/variables.mk | 1 + docs/generated/eventlog.md | 1198 ++ pkg/cmd/roachtest/BUILD.bazel | 1 - pkg/cmd/roachtest/event_log.go | 27 +- pkg/server/BUILD.bazel | 1 + pkg/server/admin.go | 26 +- pkg/server/admin_test.go | 37 +- pkg/server/node.go | 74 +- pkg/server/server.go | 37 +- pkg/sql/BUILD.bazel | 1 + pkg/sql/alter_database.go | 17 +- pkg/sql/alter_index.go | 25 +- pkg/sql/alter_role.go | 21 +- pkg/sql/alter_schema.go | 37 +- pkg/sql/alter_sequence.go | 21 +- pkg/sql/alter_table.go | 28 +- pkg/sql/alter_type.go | 55 +- pkg/sql/catalog/systemschema/system.go | 6 + pkg/sql/comment_on_column.go | 34 +- pkg/sql/comment_on_database.go | 29 +- pkg/sql/comment_on_index.go | 34 +- pkg/sql/comment_on_table.go | 30 +- pkg/sql/create_database.go | 17 +- pkg/sql/create_index.go | 25 +- pkg/sql/create_role.go | 13 +- pkg/sql/create_schema.go | 21 +- pkg/sql/create_sequence.go | 18 +- pkg/sql/create_stats.go | 30 +- pkg/sql/create_table.go | 18 +- pkg/sql/create_type.go | 18 +- pkg/sql/create_view.go | 19 +- pkg/sql/drop_database.go | 20 +- pkg/sql/drop_index.go | 27 +- pkg/sql/drop_role.go | 21 +- pkg/sql/drop_schema.go | 18 +- pkg/sql/drop_sequence.go | 18 +- pkg/sql/drop_table.go | 23 +- pkg/sql/drop_type.go | 16 +- pkg/sql/drop_view.go | 19 +- pkg/sql/event_log.go | 274 +- pkg/sql/grant_revoke.go | 97 +- .../logictest/testdata/logic_test/event_log | 314 +- pkg/sql/rename_database.go | 20 +- pkg/sql/rename_table.go | 20 +- pkg/sql/repair.go | 104 +- pkg/sql/reparent_database.go | 19 +- pkg/sql/schema_changer.go | 43 +- pkg/sql/set_cluster_setting.go | 13 +- pkg/sql/set_zone_config.go | 41 +- pkg/sql/truncate.go | 18 +- pkg/ui/src/util/eventTypes.ts | 12 +- pkg/ui/src/util/events.ts | 63 +- pkg/util/log/BUILD.bazel | 2 + pkg/util/log/event_log.go | 25 + pkg/util/log/eventpb/BUILD.bazel | 25 + pkg/util/log/eventpb/cluster_events.pb.go | 1537 ++ pkg/util/log/eventpb/cluster_events.proto | 87 + pkg/util/log/eventpb/ddl_events.pb.go | 12300 ++++++++++++++++ pkg/util/log/eventpb/ddl_events.proto | 487 + pkg/util/log/eventpb/events.go | 55 + pkg/util/log/eventpb/events.pb.go | 653 + pkg/util/log/eventpb/events.proto | 62 + pkg/util/log/eventpb/events_test.go | 16 + pkg/util/log/eventpb/gen.go | 273 + pkg/util/log/eventpb/misc_sql_events.pb.go | 452 + pkg/util/log/eventpb/misc_sql_events.proto | 28 + pkg/util/log/eventpb/privilege_events.pb.go | 2312 +++ pkg/util/log/eventpb/privilege_events.proto | 100 + 69 files changed, 20511 insertions(+), 1036 deletions(-) create mode 100644 docs/generated/eventlog.md create mode 100644 pkg/util/log/event_log.go create mode 100644 pkg/util/log/eventpb/BUILD.bazel create mode 100644 pkg/util/log/eventpb/cluster_events.pb.go create mode 100644 pkg/util/log/eventpb/cluster_events.proto create mode 100644 pkg/util/log/eventpb/ddl_events.pb.go create mode 100644 pkg/util/log/eventpb/ddl_events.proto create mode 100644 pkg/util/log/eventpb/events.go create mode 100644 pkg/util/log/eventpb/events.pb.go create mode 100644 pkg/util/log/eventpb/events.proto create mode 100644 pkg/util/log/eventpb/events_test.go create mode 100644 pkg/util/log/eventpb/gen.go create mode 100644 pkg/util/log/eventpb/misc_sql_events.pb.go create mode 100644 pkg/util/log/eventpb/misc_sql_events.proto create mode 100644 pkg/util/log/eventpb/privilege_events.pb.go create mode 100644 pkg/util/log/eventpb/privilege_events.proto diff --git a/Makefile b/Makefile index 47714b1e3061..c874e0e634fc 100644 --- a/Makefile +++ b/Makefile @@ -827,7 +827,8 @@ DOCGEN_TARGETS := \ bin/.docgen_functions \ docs/generated/redact_safe.md \ bin/.docgen_http \ - docs/generated/logging.md + docs/generated/logging.md \ + docs/generated/eventlog.md EXECGEN_TARGETS = \ pkg/col/coldata/vec.eg.go \ @@ -1552,6 +1553,17 @@ docs/generated/redact_safe.md: sed -E -e 's/^([^:]*):[0-9]+:.*redact\.RegisterSafeType\((.*)\).*/\1 | \`\2\`/g' >>$@.tmp || { rm -f $@.tmp; exit 1; } @mv -f $@.tmp $@ +EVENTLOG_PROTOS = \ + pkg/util/log/eventpb/events.proto \ + pkg/util/log/eventpb/ddl_events.proto \ + pkg/util/log/eventpb/misc_sql_events.proto \ + pkg/util/log/eventpb/privilege_events.proto \ + pkg/util/log/eventpb/cluster_events.proto + +docs/generated/eventlog.md: pkg/util/log/eventpb/gen.go $(EVENTLOG_PROTOS) + $(GO) run $(GOFLAGS) $(GOMODVENDORFLAGS) $< eventlog.md $(EVENTLOG_PROTOS) >$@.tmp || { rm -f $@.tmp; exit 1; } + mv -f $@.tmp $@ + docs/generated/logging.md: pkg/util/log/gen.go pkg/util/log/logpb/log.proto $(GO) run $(GOFLAGS) $(GOMODVENDORFLAGS) $^ logging.md $@.tmp || { rm -f $@.tmp; exit 1; } mv -f $@.tmp $@ diff --git a/build/variables.mk b/build/variables.mk index 2ca0b5db0e97..d81d9a1284c7 100644 --- a/build/variables.mk +++ b/build/variables.mk @@ -44,6 +44,7 @@ define VALID_VARS ENABLE_LIBROACH_ASSERTIONS ERRORS_PATH ERRORS_PROTO + EVENTLOG_PROTOS EXECGEN_TARGETS EXTRA_XCMAKE_FLAGS EXTRA_XCONFIGURE_FLAGS diff --git a/docs/generated/eventlog.md b/docs/generated/eventlog.md new file mode 100644 index 000000000000..bab0040e7a1f --- /dev/null +++ b/docs/generated/eventlog.md @@ -0,0 +1,1198 @@ +# Cluster events + + +## `alter_database_owner` + +An event of type `alter_database_owner` is recorded when a database's owner is changed. + + +| Field | Description | +|--|--| +| `DatabaseName` | The name of the database being affected. | +| `Owner` | The name of the new owner. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_index` + +An event of type `alter_index` is recorded when an index is altered. + + +| Field | Description | +|--|--| +| `TableName` | The name of the table containing the affected index. | +| `IndexName` | The name of the affected index. | +| `MutationID` | The mutation ID for the asynchronous job that is processing the index update. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_role` + +An event of type `alter_role` is recorded when a role is altered. + + +| Field | Description | +|--|--| +| `RoleName` | The name of the affected user/role. | +| `array_of_` | The options set on the user/role. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_schema_owner` + +An event of type `alter_schema_owner` is recorded when a schema's owner is changed. + + +| Field | Description | +|--|--| +| `SchemaName` | The name of the affected schema. | +| `Owner` | The name of the new owner. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_sequence` + +An event of type `alter_sequence` is recorded when a sequence is altered. + + +| Field | Description | +|--|--| +| `SequenceName` | The name of the affected sequence. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_table` + +An event of type `alter_table` is recorded when a table is altered. + + +| Field | Description | +|--|--| +| `TableName` | The name of the affected table. | +| `MutationID` | The mutation ID for the asynchronous job that is processing the index update, if any. | +| `array_of_` | The names of the views dropped as a result of a cascade operation. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_type` + +EventAlterType is recorded when a user-defined type is altered. + + +| Field | Description | +|--|--| +| `TypeName` | The name of the affected type. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `alter_type_owner` + +An event of type `alter_type_owner` is recorded when the owner of a user-defiend type is changed. + + +| Field | Description | +|--|--| +| `TypeName` | The name of the affected type. | +| `Owner` | The name of the new owner. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `change_database_privilege` + +An event of type `change_database_privilege` is recorded when privileges are +added to / removed from a user for a database object. + + +| Field | Description | +|--|--| +| `DatabaseName` | The name of the affected database. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `Grantee` | The user/role affected by the grant or revoke operation. | +| `array_of_` | The privileges being granted to the grantee. | +| `array_of_` | The privileges being revoked from the grantee. | + +## `change_schema_privilege` + +An event of type `change_schema_privilege` is recorded when privileges are added to / +removed from a user for a schema object. + + +| Field | Description | +|--|--| +| `SchemaName` | The name of the affected schema. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `Grantee` | The user/role affected by the grant or revoke operation. | +| `array_of_` | The privileges being granted to the grantee. | +| `array_of_` | The privileges being revoked from the grantee. | + +## `change_table_privilege` + +An event of type `change_table_privilege` is recorded when privileges are added to / removed +from a user for a table, sequence or view object. + + +| Field | Description | +|--|--| +| `TableName` | The name of the affected table. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `Grantee` | The user/role affected by the grant or revoke operation. | +| `array_of_` | The privileges being granted to the grantee. | +| `array_of_` | The privileges being revoked from the grantee. | + +## `change_type_privilege` + +An event of type `change_type_privilege` is recorded when privileges are added to / +removed from a user for a type object. + + +| Field | Description | +|--|--| +| `TypeName` | The name of the affected type. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `Grantee` | The user/role affected by the grant or revoke operation. | +| `array_of_` | The privileges being granted to the grantee. | +| `array_of_` | The privileges being revoked from the grantee. | + +## `comment_on_column` + +An event of type `comment_on_column` is recorded when a column is commented. + + +| Field | Description | +|--|--| +| `TableName` | The name of the table containing the affected column. | +| `ColumnName` | The affected column. | +| `Comment` | The new comment. | +| `NullComment` | Set to true if the comment was removed entirely. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `comment_on_database` + +CommentOnTable is recorded when a database is commented. + + +| Field | Description | +|--|--| +| `DatabaseName` | The name of the affected database. | +| `Comment` | The new comment. | +| `NullComment` | Set to true if the comment was removed entirely. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `comment_on_index` + +An event of type `comment_on_index` is recorded when an index is commented. + + +| Field | Description | +|--|--| +| `TableName` | The name of the table containing the affected index. | +| `IndexName` | The name of the affected index. | +| `Comment` | The new comment. | +| `NullComment` | Set to true if the comment was removed entirely. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `comment_on_table` + +An event of type `comment_on_table` is recorded when a table is commented. + + +| Field | Description | +|--|--| +| `TableName` | The name of the affected table. | +| `Comment` | The new comment. | +| `NullComment` | Set to true if the comment was removed entirely. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `convert_to_schema` + +An event of type `convert_to_schema` is recorded when a database is converted to a schema. + + +| Field | Description | +|--|--| +| `DatabaseName` | The name of the database being converted to a schema. | +| `NewDatabaseParent` | The name of the parent database for the new schema. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_database` + +An event of type `create_database` is recorded when a database is created. + + +| Field | Description | +|--|--| +| `DatabaseName` | The name of the new database. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_index` + +An event of type `create_index` is recorded when an index is created. + + +| Field | Description | +|--|--| +| `TableName` | The name of the table containing the new index. | +| `IndexName` | The name of the new index. | +| `MutationID` | The mutation ID for the asynchronous job that is processing the index update. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_role` + +An event of type `create_role` is recorded when a role is created. + + +| Field | Description | +|--|--| +| `RoleName` | The name of the new user/role. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_schema` + +An event of type `create_schema` is recorded when a schema is created. + + +| Field | Description | +|--|--| +| `SchemaName` | The name of the new schema. | +| `Owner` | The name of the owner for the new schema. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_sequence` + +An event of type `create_sequence` is recorded when a sequence is created. + + +| Field | Description | +|--|--| +| `SequenceName` | The name of the new sequence. | +| `Owner` | The name of the owner for the new sequence. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_statistics` + +An event of type `create_statistics` is recorded when statistics are collected for a +table. + + +| Field | Description | +|--|--| +| `TableName` | The name of the table for which the statistics were created. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_table` + +An event of type `create_table` is recorded when a table is created. + + +| Field | Description | +|--|--| +| `TableName` | The name of the new table. | +| `Owner` | The name of the owner for the new table. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_type` + +An event of type `create_type` is recorded when a user-defined type is created. + + +| Field | Description | +|--|--| +| `TypeName` | The name of the new type. | +| `Owner` | The name of the owner for the new type. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `create_view` + +An event of type `create_view` is recorded when a view is created. + + +| Field | Description | +|--|--| +| `ViewName` | The name of the new view. | +| `Owner` | The name of the owner of the new view. | +| `ViewQuery` | The SQL selection clause used to define the view. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_database` + +An event of type `drop_database` is recorded when a database is dropped. + + +| Field | Description | +|--|--| +| `DatabaseName` | The name of the affected database. | +| `array_of_` | The names of the schemas dropped by a cascade operation. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_index` + +An event of type `drop_index` is recorded when an index is dropped. + + +| Field | Description | +|--|--| +| `TableName` | The name of the table containing the affected index. | +| `IndexName` | The name of the affected index. | +| `MutationID` | The mutation ID for the asynchronous job that is processing the index update. | +| `array_of_` | The names of the views dropped as a result of a cascade operation. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_role` + +An event of type `drop_role` is recorded when a role is dropped. + + +| Field | Description | +|--|--| +| `RoleName` | The name of the affected user/role. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_schema` + +An event of type `drop_schema` is recorded when a schema is dropped. + + +| Field | Description | +|--|--| +| `SchemaName` | The name of the affected schema. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_sequence` + +An event of type `drop_sequence` is recorded when a sequence is dropped. + + +| Field | Description | +|--|--| +| `SequenceName` | The name of the affected sequence. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_table` + +An event of type `drop_table` is recorded when a table is dropped. + + +| Field | Description | +|--|--| +| `TableName` | The name of the affected table. | +| `array_of_` | The names of the views dropped as a result of a cascade operation. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_type` + +An event of type `drop_type` is recorded when a user-defined type is dropped. + + +| Field | Description | +|--|--| +| `TypeName` | The name of the affected type. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `drop_view` + +An event of type `drop_view` is recorded when a view is dropped. + + +| Field | Description | +|--|--| +| `ViewName` | The name of the affected view. | +| `array_of_` | The names of the views dropped as a result of a cascade operation. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `finish_schema_change` + +An event of type `finish_schema_change` is recorded when a previously initiated schema +change has completed. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `MutationID` | The descriptor mutation that this schema change was processing. | + +## `finish_schema_change_rollback` + +An event of type `finish_schema_change_rollback` is recorded when a previously +initiated schema change rollback has completed. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `MutationID` | The descriptor mutation that this schema change was processing. | + +## `node_decommissioned` + +An event of type `node_decommissioned` is recorded when a node is marked as +decommissioned. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `RequestingNodeID` | The node ID where the event was originated. | +| `TargetNodeID` | The node ID affected by the operation. | + +## `node_decommissioning` + +NodeDecommissioned is recorded when a node is marked as +decommissioning. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `RequestingNodeID` | The node ID where the event was originated. | +| `TargetNodeID` | The node ID affected by the operation. | + +## `node_join` + +An event of type `node_join` is recorded when a node joins the cluster. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `NodeID` | The node ID where the event was originated. | +| `StartedAt` | The time when this node was last started. | +| `LastUp` | The approximate last time the node was up before the last restart. | + +## `node_recommissioned` + +An event of type `node_recommissioned` is recorded when a decommissioning node is +recommissioned. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `RequestingNodeID` | The node ID where the event was originated. | +| `TargetNodeID` | The node ID affected by the operation. | + +## `node_restart` + +An event of type `node_restart` is recorded when an existing node rejoins the cluster +after being offline. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `NodeID` | The node ID where the event was originated. | +| `StartedAt` | The time when this node was last started. | +| `LastUp` | The approximate last time the node was up before the last restart. | + +## `remove_zone_config` + +An event of type `remove_zone_config` is recorded when a zone config is removed. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `Target` | The target object of the zone config change. | +| `Config` | The applied zone config in YAML format. | +| `array_of_` | The SQL representation of the applied zone config options. | + +## `rename_database` + +An event of type `rename_database` is recorded when a database is renamed. + + +| Field | Description | +|--|--| +| `DatabaseName` | The old name of the affected database. | +| `NewDatabaseName` | The new name of the affected database. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `rename_schema` + +An event of type `rename_schema` is recorded when a schema is renamed. + + +| Field | Description | +|--|--| +| `SchemaName` | The old name of the affected schema. | +| `NewSchemaName` | The new name of the affected schema. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `rename_table` + +An event of type `rename_table` is recorded when a table, sequence or view is renamed. + + +| Field | Description | +|--|--| +| `TableName` | The old name of the affected table. | +| `NewTableName` | The new name of the affected table. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `rename_type` + +An event of type `rename_type` is recorded when a user-defined type is renamed. + + +| Field | Description | +|--|--| +| `TypeName` | The old name of the affected type. | +| `NewTypeName` | The new name of the affected type. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `reverse_schema_change` + +An event of type `reverse_schema_change` is recorded when an in-progress schema change +encounters a problem and is reversed. + + +| Field | Description | +|--|--| +| `Error` | The error encountered that caused the schema change to be reversed. The specific format of the error is variable and can change across releases without warning. | +| `SQLSTATE` | The SQLSTATE code for the error. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `MutationID` | The descriptor mutation that this schema change was processing. | + +## `set_cluster_setting` + +An event of type `set_cluster_setting` is recorded when a cluster setting is changed. + + +| Field | Description | +|--|--| +| `SettingName` | The name of the affected cluster setting. | +| `Value` | The new value of the cluster setting. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `set_zone_config` + +An event of type `set_zone_config` is recorded when a zone config is changed. + + + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | +| `Target` | The target object of the zone config change. | +| `Config` | The applied zone config in YAML format. | +| `array_of_` | The SQL representation of the applied zone config options. | + +## `truncate_table` + +An event of type `truncate_table` is recorded when a table is truncated. + + +| Field | Description | +|--|--| +| `TableName` | The name of the affected table. | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `unsafe_delete_descriptor` + +An event of type `unsafe_delete_descriptor` is recorded when a descriptor is written +using crdb_internal.unsafe_delete_descriptor(). + +The fields of this event type are reserved and can change across +patch releases without advance notice. + + +| Field | Description | +|--|--| +| `ParentID` | | +| `ParentSchemaID` | | +| `Name` | | +| `Force` | | +| `ForceNotice` | | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `unsafe_delete_namespace_entry` + +An event of type `unsafe_delete_namespace_entry` is recorded when a namespace entry is +written using crdb_internal.unsafe_delete_namespace_entry(). + +The fields of this event type are reserved and can change across +patch releases without advance notice. + + +| Field | Description | +|--|--| +| `ParentID` | | +| `ParentSchemaID` | | +| `Name` | | +| `Force` | | +| `ForceNotice` | | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `unsafe_upsert_descriptor` + +An event of type `unsafe_upsert_descriptor` is recorded when a descriptor is written +using crdb_internal.unsafe_upsert_descriptor(). + + +| Field | Description | +|--|--| +| `PreviousDescriptor` | | +| `NewDescriptor` | | +| `Force` | | +| `ForceNotice` | | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + +## `unsafe_upsert_namespace_entry` + +An event of type `unsafe_upsert_namespace_entry` is recorded when a namespace entry is +written using crdb_internal.unsafe_upsert_namespace_entry(). + +The fields of this event type are reserved and can change across +patch releases without advance notice. + + +| Field | Description | +|--|--| +| `ParentID` | | +| `ParentSchemaID` | | +| `Name` | | +| `PreviousID` | | +| `Force` | | +| `FailedValidation` | | +| `ValidationErrors` | | + + +### Inherited fields + +| Field | Description | +|--|--| +| `Timestamp` | The timestamp of the event. | +| `EventType` | The type of the event. | +| `Statement` | A normalized copy of the SQL statement that triggered the event. | +| `User` | The user account that triggered the event. | +| `InstanceID` | The instance ID (not tenant ID) of the SQL server where the event was originated. | +| `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | + diff --git a/pkg/cmd/roachtest/BUILD.bazel b/pkg/cmd/roachtest/BUILD.bazel index 076d334ef5ce..f0597ff23e10 100644 --- a/pkg/cmd/roachtest/BUILD.bazel +++ b/pkg/cmd/roachtest/BUILD.bazel @@ -153,7 +153,6 @@ go_library( "//pkg/util/syncutil", "//pkg/util/sysutil", "//pkg/util/timeutil", - "//pkg/util/uuid", "//pkg/util/version", "//pkg/workload/histogram", "//pkg/workload/querybench", diff --git a/pkg/cmd/roachtest/event_log.go b/pkg/cmd/roachtest/event_log.go index edd8bfbbd673..b8572b57ba78 100644 --- a/pkg/cmd/roachtest/event_log.go +++ b/pkg/cmd/roachtest/event_log.go @@ -19,13 +19,11 @@ import ( "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/util/retry" - "github.com/cockroachdb/cockroach/pkg/util/uuid" ) func runEventLog(ctx context.Context, t *test, c *cluster) { type nodeEventInfo struct { - Descriptor roachpb.NodeDescriptor - ClusterID uuid.UUID + NodeID roachpb.NodeID } c.Put(ctx, cockroach, "./cockroach") @@ -36,7 +34,6 @@ func runEventLog(ctx context.Context, t *test, c *cluster) { db := c.Conn(ctx, 1) defer db.Close() waitForFullReplication(t, db) - var clusterID uuid.UUID err := retry.ForDuration(10*time.Second, func() error { rows, err := db.Query( @@ -45,7 +42,6 @@ func runEventLog(ctx context.Context, t *test, c *cluster) { if err != nil { t.Fatal(err) } - clusterID = uuid.UUID{} seenIds := make(map[int64]struct{}) for rows.Next() { var targetID int64 @@ -62,22 +58,10 @@ func runEventLog(ctx context.Context, t *test, c *cluster) { if err := json.Unmarshal([]byte(infoStr.String), &info); err != nil { t.Fatal(err) } - if a, e := int64(info.Descriptor.NodeID), targetID; a != e { + if a, e := int64(info.NodeID), targetID; a != e { t.Fatalf("Node join with targetID %d had descriptor for wrong node %d", e, a) } - // Verify cluster ID is recorded, and is the same for all nodes. - if (info.ClusterID == uuid.UUID{}) { - t.Fatalf("Node join recorded nil cluster id, info: %v", info) - } - if (clusterID == uuid.UUID{}) { - clusterID = info.ClusterID - } else if clusterID != info.ClusterID { - t.Fatalf( - "Node join recorded different cluster ID than earlier node. Expected %s, got %s. Info: %v", - clusterID, info.ClusterID, info) - } - // Verify that all NodeIDs are different. if _, ok := seenIds[targetID]; ok { t.Fatalf("Node ID %d seen in two different node join messages", targetID) @@ -126,15 +110,10 @@ func runEventLog(ctx context.Context, t *test, c *cluster) { if err := json.Unmarshal([]byte(infoStr.String), &info); err != nil { t.Fatal(err) } - if a, e := int64(info.Descriptor.NodeID), targetID; a != e { + if a, e := int64(info.NodeID), targetID; a != e { t.Fatalf("node join with targetID %d had descriptor for wrong node %d", e, a) } - // Verify cluster ID is recorded, and is the same for all nodes. - if clusterID != info.ClusterID { - t.Fatalf("expected cluser ID %s, got %s\n%v", clusterID, info.ClusterID, info) - } - seenCount++ } if err := rows.Err(); err != nil { diff --git a/pkg/server/BUILD.bazel b/pkg/server/BUILD.bazel index 826cc8a36a57..b480b056abdb 100644 --- a/pkg/server/BUILD.bazel +++ b/pkg/server/BUILD.bazel @@ -135,6 +135,7 @@ go_library( "//pkg/util/httputil", "//pkg/util/humanizeutil", "//pkg/util/log", + "//pkg/util/log/eventpb", "//pkg/util/log/logcrash", "//pkg/util/log/logpb", "//pkg/util/log/severity", diff --git a/pkg/server/admin.go b/pkg/server/admin.go index 24e0fe84c256..3dbc2eff9e2b 100644 --- a/pkg/server/admin.go +++ b/pkg/server/admin.go @@ -51,6 +51,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/contextutil" "github.com/cockroachdb/cockroach/pkg/util/envutil" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/log/logcrash" "github.com/cockroachdb/cockroach/pkg/util/mon" "github.com/cockroachdb/cockroach/pkg/util/protoutil" @@ -896,6 +897,8 @@ func (s *adminServer) Users( return &resp, nil } +var eventSetClusterSettingName = eventpb.GetEventTypeName(&eventpb.SetClusterSetting{}) + // Events is an endpoint that returns the latest event log entries, with the following // optional URL parameters: // @@ -965,7 +968,7 @@ func (s *adminServer) Events( if err := scanner.ScanIndex(row, 4, &event.Info); err != nil { return nil, err } - if event.EventType == string(sql.EventLogSetClusterSetting) { + if event.EventType == eventSetClusterSettingName { if redactEvents { event.Info = redactSettingsChange(event.Info) } @@ -973,6 +976,9 @@ func (s *adminServer) Events( if err := scanner.ScanIndex(row, 5, &event.UniqueID); err != nil { return nil, err } + if redactEvents { + event.Info = redactStatement(event.Info) + } resp.Events = append(resp.Events, event) } @@ -981,7 +987,7 @@ func (s *adminServer) Events( // make a best-effort attempt at redacting the setting value. func redactSettingsChange(info string) string { - var s sql.EventLogSetClusterSettingDetail + var s eventpb.SetClusterSetting if err := json.Unmarshal([]byte(info), &s); err != nil { return "" } @@ -993,6 +999,22 @@ func redactSettingsChange(info string) string { return string(ret) } +// make a best-effort attempt at redacting the statement details. +func redactStatement(info string) string { + s := map[string]interface{}{} + if err := json.Unmarshal([]byte(info), &s); err != nil { + return info + } + if _, ok := s["Statement"]; ok { + s["Statement"] = "" + } + ret, err := json.Marshal(s) + if err != nil { + return "" + } + return string(ret) +} + // RangeLog is an endpoint that returns the latest range log entries. func (s *adminServer) RangeLog( ctx context.Context, req *serverpb.RangeLogRequest, diff --git a/pkg/server/admin_test.go b/pkg/server/admin_test.go index a110aa621e1c..4ae63f114c77 100644 --- a/pkg/server/admin_test.go +++ b/pkg/server/admin_test.go @@ -41,7 +41,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/server/telemetry" "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/settings/cluster" - "github.com/cockroachdb/cockroach/pkg/sql" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/testutils" @@ -943,26 +942,26 @@ func TestAdminAPIEvents(t *testing.T) { const allEvents = "" type testcase struct { - eventType sql.EventLogType + eventType string hasLimit bool limit int unredacted bool expCount int } testcases := []testcase{ - {sql.EventLogNodeJoin, false, 0, false, 1}, - {sql.EventLogNodeRestart, false, 0, false, 0}, - {sql.EventLogDropDatabase, false, 0, false, 0}, - {sql.EventLogCreateDatabase, false, 0, false, 3}, - {sql.EventLogDropTable, false, 0, false, 2}, - {sql.EventLogCreateTable, false, 0, false, 3}, - {sql.EventLogSetClusterSetting, false, 0, false, 4}, + {"node_join", false, 0, false, 1}, + {"node_restart", false, 0, false, 0}, + {"drop_database", false, 0, false, 0}, + {"create_database", false, 0, false, 3}, + {"drop_table", false, 0, false, 2}, + {"create_table", false, 0, false, 3}, + {"set_cluster_setting", false, 0, false, 4}, // We use limit=true with no limit here because otherwise the // expCount will mess up the expected total count below. - {sql.EventLogSetClusterSetting, true, 0, true, 4}, - {sql.EventLogCreateTable, true, 0, false, 3}, - {sql.EventLogCreateTable, true, -1, false, 3}, - {sql.EventLogCreateTable, true, 2, false, 2}, + {"set_cluster_setting", true, 0, true, 4}, + {"create_table", true, 0, false, 3}, + {"create_table", true, -1, false, 3}, + {"create_table", true, 2, false, 2}, } minTotalEvents := 0 for _, tc := range testcases { @@ -975,7 +974,7 @@ func TestAdminAPIEvents(t *testing.T) { for i, tc := range testcases { url := "events" if tc.eventType != allEvents { - url += "?type=" + string(tc.eventType) + url += "?type=" + tc.eventType if tc.hasLimit { url += fmt.Sprintf("&limit=%d", tc.limit) } @@ -1009,7 +1008,7 @@ func TestAdminAPIEvents(t *testing.T) { } if len(tc.eventType) > 0 { - if a, e := e.EventType, string(tc.eventType); a != e { + if a, e := e.EventType, tc.eventType; a != e { t.Errorf("%d: event type %s != expected %s", i, a, e) } } else { @@ -1018,10 +1017,10 @@ func TestAdminAPIEvents(t *testing.T) { } } - isSettingChange := e.EventType == string(sql.EventLogSetClusterSetting) - isRoleChange := e.EventType == string(sql.EventLogCreateRole) || - e.EventType == string(sql.EventLogDropRole) || - e.EventType == string(sql.EventLogAlterRole) + isSettingChange := e.EventType == "set_cluster_setting" + isRoleChange := e.EventType == "create_role" || + e.EventType == "drop_role" || + e.EventType == "alter_role" if e.TargetID == 0 && !isSettingChange && !isRoleChange { t.Errorf("%d: missing/empty TargetID", i) diff --git a/pkg/server/node.go b/pkg/server/node.go index 3564def10584..964295972532 100644 --- a/pkg/server/node.go +++ b/pkg/server/node.go @@ -41,6 +41,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/grpcutil" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/metric" "github.com/cockroachdb/cockroach/pkg/util/retry" "github.com/cockroachdb/cockroach/pkg/util/stop" @@ -155,8 +156,8 @@ type Node struct { clusterID *base.ClusterIDContainer // UUID for Cockroach cluster Descriptor roachpb.NodeDescriptor // Node ID, network/physical topology storeCfg kvserver.StoreConfig // Config to use and pass to stores - eventLogger sql.EventLogger - stores *kvserver.Stores // Access to node-local stores + sqlExec *sql.InternalExecutor // For event logging + stores *kvserver.Stores // Access to node-local stores metrics nodeMetrics recorder *status.MetricsRecorder startedAt int64 @@ -284,19 +285,19 @@ func NewNode( execCfg *sql.ExecutorConfig, clusterID *base.ClusterIDContainer, ) *Node { - var eventLogger sql.EventLogger + var sqlExec *sql.InternalExecutor if execCfg != nil { - eventLogger = sql.MakeEventLogger(execCfg) + sqlExec = execCfg.InternalExecutor } n := &Node{ - storeCfg: cfg, - stopper: stopper, - recorder: recorder, - metrics: makeNodeMetrics(reg, cfg.HistogramWindowInterval), - stores: kvserver.NewStores(cfg.AmbientCtx, cfg.Clock), - txnMetrics: txnMetrics, - eventLogger: eventLogger, - clusterID: clusterID, + storeCfg: cfg, + stopper: stopper, + recorder: recorder, + metrics: makeNodeMetrics(reg, cfg.HistogramWindowInterval), + stores: kvserver.NewStores(cfg.AmbientCtx, cfg.Clock), + txnMetrics: txnMetrics, + sqlExec: sqlExec, + clusterID: clusterID, } n.perReplicaServer = kvserver.MakeServer(&n.Descriptor, n.stores) return n @@ -304,7 +305,7 @@ func NewNode( // InitLogger needs to be called if a nil execCfg was passed to NewNode(). func (n *Node) InitLogger(execCfg *sql.ExecutorConfig) { - n.eventLogger = sql.MakeEventLogger(execCfg) + n.sqlExec = execCfg.InternalExecutor } // String implements fmt.Stringer. @@ -771,40 +772,47 @@ func (n *Node) writeNodeStatus(ctx context.Context, alertTTL time.Duration) erro // recordJoinEvent begins an asynchronous task which attempts to log a "node // join" or "node restart" event. This query will retry until it succeeds or the // server stops. -func (n *Node) recordJoinEvent() { - if !n.storeCfg.LogRangeEvents { - return +func (n *Node) recordJoinEvent(ctx context.Context) { + var event eventpb.EventPayload + var nodeDetails *eventpb.CommonNodeEventDetails + if !n.initialStart { + ev := &eventpb.NodeRestart{} + event = ev + nodeDetails = &ev.CommonNodeEventDetails + nodeDetails.LastUp = n.lastUp + } else { + ev := &eventpb.NodeJoin{} + event = ev + nodeDetails = &ev.CommonNodeEventDetails + nodeDetails.LastUp = n.startedAt } + event.CommonDetails().Timestamp = timeutil.Now() + nodeDetails.StartedAt = n.startedAt + nodeDetails.NodeID = int32(n.Descriptor.NodeID) - logEventType := sql.EventLogNodeRestart - lastUp := n.lastUp - if n.initialStart { - logEventType = sql.EventLogNodeJoin - lastUp = n.startedAt + // Ensure that the event goes to log files even if LogRangeEvents is + // disabled (which means skip the system.eventlog _table_). + log.ClusterEvent(ctx, event) + + if !n.storeCfg.LogRangeEvents { + return } - n.stopper.RunWorker(context.Background(), func(bgCtx context.Context) { + n.stopper.RunWorker(ctx, func(bgCtx context.Context) { ctx, span := n.AnnotateCtxWithSpan(bgCtx, "record-join-event") defer span.Finish() retryOpts := base.DefaultRetryOptions() retryOpts.Closer = n.stopper.ShouldStop() for r := retry.Start(retryOpts); r.Next(); { if err := n.storeCfg.DB.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { - return n.eventLogger.InsertEventRecord( - ctx, + return sql.InsertEventRecord(ctx, n.sqlExec, txn, - logEventType, int32(n.Descriptor.NodeID), int32(n.Descriptor.NodeID), - struct { - Descriptor roachpb.NodeDescriptor - ClusterID uuid.UUID - StartedAt int64 - LastUp int64 - }{n.Descriptor, n.clusterID.Get(), n.startedAt, lastUp}, - ) + true, /* skipExternalLog - we already call log.ClusterEvent above */ + event) }); err != nil { - log.Warningf(ctx, "%s: unable to log %s event: %s", n, logEventType, err) + log.Warningf(ctx, "%s: unable to log event %v: %v", n, event, err) } else { return } diff --git a/pkg/server/server.go b/pkg/server/server.go index 07714a904497..e3cd2c859f86 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -73,6 +73,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/httputil" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/metric" "github.com/cockroachdb/cockroach/pkg/util/netutil" "github.com/cockroachdb/cockroach/pkg/util/protoutil" @@ -1732,7 +1733,7 @@ func (s *Server) PreStart(ctx context.Context) error { // Record that this node joined the cluster in the event log. Since this // executes a SQL query, this must be done after the SQL layer is ready. - s.node.recordJoinEvent() + s.node.recordJoinEvent(ctx) if err := s.sqlServer.preStart( workersCtx, @@ -2011,17 +2012,25 @@ func (s *Server) Decommission( } } - eventLogger := sql.MakeEventLogger(s.sqlServer.execCfg) - var eventType sql.EventLogType + var event eventpb.EventPayload + var nodeDetails *eventpb.CommonNodeDecommissionDetails if targetStatus.Decommissioning() { - eventType = sql.EventLogNodeDecommissioning + ev := &eventpb.NodeDecommissioning{} + nodeDetails = &ev.CommonNodeDecommissionDetails + event = ev } else if targetStatus.Decommissioned() { - eventType = sql.EventLogNodeDecommissioned + ev := &eventpb.NodeDecommissioned{} + nodeDetails = &ev.CommonNodeDecommissionDetails + event = ev } else if targetStatus.Active() { - eventType = sql.EventLogNodeRecommissioned + ev := &eventpb.NodeRecommissioned{} + nodeDetails = &ev.CommonNodeDecommissionDetails + event = ev } else { panic("unexpected target membership status") } + event.CommonDetails().Timestamp = timeutil.Now() + nodeDetails.RequestingNodeID = int32(s.NodeID()) for _, nodeID := range nodeIDs { statusChanged, err := s.nodeLiveness.SetMembershipStatus(ctx, nodeID, targetStatus) @@ -2032,6 +2041,10 @@ func (s *Server) Decommission( return err } if statusChanged { + nodeDetails.TargetNodeID = int32(nodeID) + // Ensure an entry is produced in the external log in all cases. + log.ClusterEvent(ctx, event) + // If we die right now or if this transaction fails to commit, the // membership event will not be recorded to the event log. While we // could insert the event record in the same transaction as the liveness @@ -2039,11 +2052,15 @@ func (s *Server) Decommission( // the node liveness range. Better to make the event logging best effort // than to slow down future node liveness transactions. if err := s.db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { - return eventLogger.InsertEventRecord( - ctx, txn, eventType, int32(nodeID), int32(s.NodeID()), struct{}{}, - ) + return sql.InsertEventRecord( + ctx, + s.sqlServer.execCfg.InternalExecutor, + txn, + int32(nodeID), int32(s.NodeID()), + true, /* skipExternalLog - we already call log.ClusterEvent above */ + event) }); err != nil { - log.Errorf(ctx, "unable to record %s event for node %d: %s", eventType, nodeID, err) + log.Errorf(ctx, "unable to record %s event for node %d: %v", event, err) } } } diff --git a/pkg/sql/BUILD.bazel b/pkg/sql/BUILD.bazel index a81af8382b54..ebb08510f5d4 100644 --- a/pkg/sql/BUILD.bazel +++ b/pkg/sql/BUILD.bazel @@ -343,6 +343,7 @@ go_library( "//pkg/util/humanizeutil", "//pkg/util/json", "//pkg/util/log", + "//pkg/util/log/eventpb", "//pkg/util/log/logcrash", "//pkg/util/log/severity", "//pkg/util/metric", diff --git a/pkg/sql/alter_database.go b/pkg/sql/alter_database.go index 425ba364dc00..6685390225e1 100644 --- a/pkg/sql/alter_database.go +++ b/pkg/sql/alter_database.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/roleoption" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type alterDatabaseOwnerNode struct { @@ -68,18 +69,10 @@ func (n *alterDatabaseOwnerNode) startExec(params runParams) error { // Log Alter Database Owner event. This is an auditable log event and is recorded // in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterDatabaseOwner, - int32(n.desc.GetID()), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - DatabaseName string - Owner string - User string - }{n.n.Name.String(), newOwner.Normalized(), params.p.User().Normalized()}, - ) + return params.p.logEvent(params.ctx, n.desc.ID, &eventpb.AlterDatabaseOwner{ + DatabaseName: n.n.Name.String(), + Owner: newOwner.Normalized(), + }) } // checkCanAlterDatabaseAndSetNewOwner handles privilege checking and setting new owner. diff --git a/pkg/sql/alter_index.go b/pkg/sql/alter_index.go index 807fdce188a2..de922006f5cc 100644 --- a/pkg/sql/alter_index.go +++ b/pkg/sql/alter_index.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -116,23 +117,13 @@ func (n *alterIndexNode) startExec(params runParams) error { // Record this index alteration in the event log. This is an auditable log // event and is recorded in the same transaction as the table descriptor // update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterIndex, - int32(n.tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - IndexName string - Statement string - User string - MutationID uint32 - }{ - n.n.Index.Table.FQString(), n.indexDesc.Name, n.n.String(), - params.SessionData().User().Normalized(), uint32(mutationID), - }, - ) + return params.p.logEvent(params.ctx, + n.tableDesc.ID, + &eventpb.AlterIndex{ + TableName: n.n.Index.Table.FQString(), + IndexName: n.indexDesc.Name, + MutationID: uint32(mutationID), + }) } func (n *alterIndexNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/alter_role.go b/pkg/sql/alter_role.go index d6da56fc68e8..0f79713ad0e7 100644 --- a/pkg/sql/alter_role.go +++ b/pkg/sql/alter_role.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -245,17 +246,17 @@ func (n *alterRoleNode) startExec(params runParams) error { } } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterRole, + optStrs := make([]string, len(n.roleOptions)) + for i := range optStrs { + optStrs[i] = n.roleOptions[i].String() + } + + return params.p.logEvent(params.ctx, 0, /* no target */ - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - RoleName string - User string - }{normalizedUsername.Normalized(), params.p.User().Normalized()}, - ) + &eventpb.AlterRole{ + RoleName: normalizedUsername.Normalized(), + Options: optStrs, + }) } func (*alterRoleNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/alter_schema.go b/pkg/sql/alter_schema.go index 35351599b150..2a6662beaa63 100644 --- a/pkg/sql/alter_schema.go +++ b/pkg/sql/alter_schema.go @@ -26,6 +26,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -98,18 +99,12 @@ func (n *alterSchemaNode) startExec(params runParams) error { ); err != nil { return err } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogRenameSchema, - int32(n.desc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SchemaName string - NewSchemaName string - User string - }{oldName, newName, params.p.User().Normalized()}, - ) + return params.p.logEvent(params.ctx, n.desc.ID, &eventpb.RenameSchema{ + // TODO(knz): This name is insufficiently qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57738 + SchemaName: oldName, + NewSchemaName: newName, + }) case *tree.AlterSchemaOwner: newOwner := t.Owner if err := params.p.alterSchemaOwner( @@ -117,18 +112,12 @@ func (n *alterSchemaNode) startExec(params runParams) error { ); err != nil { return err } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterSchemaOwner, - int32(n.desc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SchemaName string - Owner string - User string - }{n.desc.Name, newOwner.Normalized(), params.p.User().Normalized()}, - ) + return params.p.logEvent(params.ctx, n.desc.ID, &eventpb.AlterSchemaOwner{ + // TODO(knz): This name is insufficiently qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57738 + SchemaName: n.desc.Name, + Owner: newOwner.Normalized(), + }) default: return errors.AssertionFailedf("unknown schema cmd %T", t) } diff --git a/pkg/sql/alter_sequence.go b/pkg/sql/alter_sequence.go index fed1a9985c8f..63535fa17231 100644 --- a/pkg/sql/alter_sequence.go +++ b/pkg/sql/alter_sequence.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type alterSequenceNode struct { @@ -78,21 +79,11 @@ func (n *alterSequenceNode) startExec(params runParams) error { // Record this sequence alteration in the event log. This is an auditable log // event and is recorded in the same transaction as the table descriptor // update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterSequence, - int32(n.seqDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SequenceName string - Statement string - User string - }{ - params.p.ResolvedName(n.n.Name).FQString(), - n.n.String(), - params.SessionData().User().Normalized()}, - ) + return params.p.logEvent(params.ctx, + n.seqDesc.ID, + &eventpb.AlterSequence{ + SequenceName: params.p.ResolvedName(n.n.Name).FQString(), + }) } func (n *alterSequenceNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/alter_table.go b/pkg/sql/alter_table.go index 03e7ca1f3a1f..2e5b7e803d0e 100644 --- a/pkg/sql/alter_table.go +++ b/pkg/sql/alter_table.go @@ -35,6 +35,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/sql/stats" "github.com/cockroachdb/cockroach/pkg/sql/types" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/errors" ) @@ -838,24 +839,15 @@ func (n *alterTableNode) startExec(params runParams) error { // Record this table alteration in the event log. This is an auditable log // event and is recorded in the same transaction as the table descriptor // update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterTable, - int32(n.tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - User string - MutationID uint32 - CascadeDroppedViews []string - }{ - params.p.ResolvedName(n.n.Table).FQString(), - n.n.String(), - params.SessionData().User().Normalized(), - uint32(mutationID), droppedViews}, - ) + return params.p.logEvent(params.ctx, + n.tableDesc.ID, + &eventpb.AlterTable{ + TableName: params.p.ResolvedName(n.n.Table).FQString(), + MutationID: uint32(mutationID), + // TODO(knz): This is missing some qualification, see + // https://github.com/cockroachdb/cockroach/issues/57735 + CascadeDroppedViews: droppedViews, + }) } func (p *planner) setAuditMode( diff --git a/pkg/sql/alter_type.go b/pkg/sql/alter_type.go index 12a86a4e7768..b736d17e41aa 100644 --- a/pkg/sql/alter_type.go +++ b/pkg/sql/alter_type.go @@ -24,6 +24,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -83,6 +84,8 @@ func (p *planner) AlterType(ctx context.Context, n *tree.AlterType) (planNode, e func (n *alterTypeNode) startExec(params runParams) error { telemetry.Inc(n.n.Cmd.TelemetryCounter()) + + eventLogDone := false var err error switch t := n.n.Cmd.(type) { case *tree.AlterTypeAddValue: @@ -90,11 +93,31 @@ func (n *alterTypeNode) startExec(params runParams) error { case *tree.AlterTypeRenameValue: err = params.p.renameTypeValue(params.ctx, n, string(t.OldVal), string(t.NewVal)) case *tree.AlterTypeRename: - err = params.p.renameType(params.ctx, n, string(t.NewName)) + if err = params.p.renameType(params.ctx, n, string(t.NewName)); err != nil { + return err + } + err = params.p.logEvent(params.ctx, n.desc.ID, &eventpb.RenameType{ + // TODO(knz): This name is insufficiently qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57734 + TypeName: n.desc.Name, + NewTypeName: string(t.NewName), + }) + eventLogDone = true case *tree.AlterTypeSetSchema: + // TODO(knz): this is missing dedicated logging, + // See https://github.com/cockroachdb/cockroach/issues/57741 err = params.p.setTypeSchema(params.ctx, n, string(t.Schema)) case *tree.AlterTypeOwner: - err = params.p.alterTypeOwner(params.ctx, n, t.Owner) + if err = params.p.alterTypeOwner(params.ctx, n, t.Owner); err != nil { + return err + } + err = params.p.logEvent(params.ctx, n.desc.ID, &eventpb.AlterTypeOwner{ + // TODO(knz): This name is insufficiently qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57734 + TypeName: n.desc.Name, + Owner: t.Owner.Normalized(), + }) + eventLogDone = true default: err = errors.AssertionFailedf("unknown alter type cmd %s", t) } @@ -108,23 +131,17 @@ func (n *alterTypeNode) startExec(params runParams) error { return err } - // Write a log event. - return MakeEventLogger(params.p.ExecCfg()).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogAlterType, - int32(n.desc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TypeName string - Statement string - User string - }{ - n.desc.Name, - tree.AsStringWithFQNames(n.n, params.Ann()), - params.p.User().Normalized(), - }, - ) + if !eventLogDone { + // Write a log event. + if err := params.p.logEvent(params.ctx, + n.desc.ID, + &eventpb.AlterType{ + TypeName: n.desc.Name, + }); err != nil { + return err + } + } + return nil } func (p *planner) addEnumValue( diff --git a/pkg/sql/catalog/systemschema/system.go b/pkg/sql/catalog/systemschema/system.go index 501e904b05a6..5adbb79e2b60 100644 --- a/pkg/sql/catalog/systemschema/system.go +++ b/pkg/sql/catalog/systemschema/system.go @@ -127,6 +127,9 @@ CREATE TABLE system.lease ( PRIMARY KEY ("descID", version, expiration, "nodeID") );` + // TODO(knz): targetID and reportingID are deprecated and should + // be removed after v21.1 is released. Their content is now + // available inside the info payload, which is a JSON blob. EventLogTableSchema = ` CREATE TABLE system.eventlog ( timestamp TIMESTAMP NOT NULL, @@ -719,6 +722,9 @@ var ( Columns: []descpb.ColumnDescriptor{ {Name: "timestamp", ID: 1, Type: types.Timestamp}, {Name: "eventType", ID: 2, Type: types.String}, + // TODO(knz): targetID and reportingID are deprecated and should + // be removed after v21.1 is released. Their content is now + // available inside the info payload, which is a JSON blob. {Name: "targetID", ID: 3, Type: types.Int}, {Name: "reportingID", ID: 4, Type: types.Int}, {Name: "info", ID: 5, Type: types.String, Nullable: true}, diff --git a/pkg/sql/comment_on_column.go b/pkg/sql/comment_on_column.go index 2ea7f02e56bd..2e2eabd5054b 100644 --- a/pkg/sql/comment_on_column.go +++ b/pkg/sql/comment_on_column.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type commentOnColumnNode struct { @@ -88,25 +89,20 @@ func (n *commentOnColumnNode) startExec(params runParams) error { } } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCommentOnColumn, - int32(n.tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - ColumnName string - Statement string - User string - Comment *string - }{ - n.tableDesc.Name, - string(n.n.ColumnItem.ColumnName), - n.n.String(), - params.p.User().Normalized(), - n.n.Comment}, - ) + comment := "" + if n.n.Comment != nil { + comment = *n.n.Comment + } + return params.p.logEvent(params.ctx, + n.tableDesc.ID, + &eventpb.CommentOnColumn{ + // TODO(knz): This table name is improperly qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57740 + TableName: n.tableDesc.Name, + ColumnName: string(n.n.ColumnItem.ColumnName), + Comment: comment, + NullComment: n.n.Comment == nil, + }) } func (n *commentOnColumnNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/comment_on_database.go b/pkg/sql/comment_on_database.go index f7b293ba196e..c6de3ed3d539 100644 --- a/pkg/sql/comment_on_database.go +++ b/pkg/sql/comment_on_database.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type commentOnDatabaseNode struct { @@ -79,23 +80,17 @@ func (n *commentOnDatabaseNode) startExec(params runParams) error { } } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCommentOnDatabase, - int32(n.dbDesc.GetID()), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - DatabaseName string - Statement string - User string - Comment *string - }{ - n.n.Name.String(), - n.n.String(), - params.p.User().Normalized(), - n.n.Comment}, - ) + comment := "" + if n.n.Comment != nil { + comment = *n.n.Comment + } + return params.p.logEvent(params.ctx, + n.dbDesc.GetID(), + &eventpb.CommentOnDatabase{ + DatabaseName: n.n.Name.String(), + Comment: comment, + NullComment: n.n.Comment == nil, + }) } func (n *commentOnDatabaseNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/comment_on_index.go b/pkg/sql/comment_on_index.go index 612b8ca3154c..cde7718b879c 100644 --- a/pkg/sql/comment_on_index.go +++ b/pkg/sql/comment_on_index.go @@ -20,6 +20,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type commentOnIndexNode struct { @@ -64,25 +65,20 @@ func (n *commentOnIndexNode) startExec(params runParams) error { } } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCommentOnIndex, - int32(n.tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - IndexName string - Statement string - User string - Comment *string - }{ - n.tableDesc.Name, - string(n.n.Index.Index), - n.n.String(), - params.p.User().Normalized(), - n.n.Comment}, - ) + comment := "" + if n.n.Comment != nil { + comment = *n.n.Comment + } + return params.p.logEvent(params.ctx, + n.tableDesc.ID, + &eventpb.CommentOnIndex{ + // TODO(knz): This table name is improperly qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57740 + TableName: n.tableDesc.Name, + IndexName: string(n.n.Index.Index), + Comment: comment, + NullComment: n.n.Comment == nil, + }) } func (p *planner) upsertIndexComment( diff --git a/pkg/sql/comment_on_table.go b/pkg/sql/comment_on_table.go index c5979674b91c..3bed87d7cb9a 100644 --- a/pkg/sql/comment_on_table.go +++ b/pkg/sql/comment_on_table.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type commentOnTableNode struct { @@ -79,24 +80,17 @@ func (n *commentOnTableNode) startExec(params runParams) error { } } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCommentOnTable, - int32(n.tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - User string - Comment *string - }{ - params.p.ResolvedName(n.n.Table).FQString(), - n.n.String(), - params.p.User().Normalized(), - n.n.Comment, - }, - ) + comment := "" + if n.n.Comment != nil { + comment = *n.n.Comment + } + return params.p.logEvent(params.ctx, + n.tableDesc.ID, + &eventpb.CommentOnTable{ + TableName: params.p.ResolvedName(n.n.Table).FQString(), + Comment: comment, + NullComment: n.n.Comment == nil, + }) } func (n *commentOnTableNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/create_database.go b/pkg/sql/create_database.go index 1570012ee2c5..4b3ee3b81052 100644 --- a/pkg/sql/create_database.go +++ b/pkg/sql/create_database.go @@ -21,6 +21,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type createDatabaseNode struct { @@ -107,18 +108,10 @@ func (n *createDatabaseNode) startExec(params runParams) error { if created { // Log Create Database event. This is an auditable log event and is // recorded in the same transaction as the table descriptor update. - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateDatabase, - int32(desc.GetID()), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - DatabaseName string - Statement string - User string - }{n.n.Name.String(), n.n.String(), params.p.User().Normalized()}, - ); err != nil { + if err := params.p.logEvent(params.ctx, desc.GetID(), + &eventpb.CreateDatabase{ + DatabaseName: n.n.Name.String(), + }); err != nil { return err } } diff --git a/pkg/sql/create_index.go b/pkg/sql/create_index.go index 31915f59b520..c8460a0a427b 100644 --- a/pkg/sql/create_index.go +++ b/pkg/sql/create_index.go @@ -31,6 +31,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -471,23 +472,13 @@ func (n *createIndexNode) startExec(params runParams) error { // Record index creation in the event log. This is an auditable log // event and is recorded in the same transaction as the table descriptor // update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateIndex, - int32(n.tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - IndexName string - Statement string - User string - MutationID uint32 - }{ - n.n.Table.FQString(), indexName, n.n.String(), - params.p.User().Normalized(), uint32(mutationID), - }, - ) + return params.p.logEvent(params.ctx, + n.tableDesc.ID, + &eventpb.CreateIndex{ + TableName: n.n.Table.FQString(), + IndexName: indexName, + MutationID: uint32(mutationID), + }) } func (*createIndexNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/create_role.go b/pkg/sql/create_role.go index 65adc3cd1d43..9517a4d2cd12 100644 --- a/pkg/sql/create_role.go +++ b/pkg/sql/create_role.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -228,17 +229,9 @@ func (n *CreateRoleNode) startExec(params runParams) error { } } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateRole, + return params.p.logEvent(params.ctx, 0, /* no target */ - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - RoleName string - User string - }{normalizedUsername.Normalized(), params.p.User().Normalized()}, - ) + &eventpb.CreateRole{RoleName: normalizedUsername.Normalized()}) } // Next implements the planNode interface. diff --git a/pkg/sql/create_schema.go b/pkg/sql/create_schema.go index f4af6e6ea0fc..4e7d9412151e 100644 --- a/pkg/sql/create_schema.go +++ b/pkg/sql/create_schema.go @@ -25,6 +25,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" ) @@ -165,18 +166,14 @@ func (p *planner) createUserDefinedSchema(params runParams, n *tree.CreateSchema ); err != nil { return err } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateSchema, - int32(desc.GetID()), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SchemaName string - Owner string - User string - }{schemaName, privs.Owner().Normalized(), params.p.User().Normalized()}, - ) + return params.p.logEvent(params.ctx, + desc.GetID(), + // TODO(knz): This is missing some details about the database. + // See: https://github.com/cockroachdb/cockroach/issues/57738 + &eventpb.CreateSchema{ + SchemaName: schemaName, + Owner: privs.Owner().Normalized(), + }) } func (*createSchemaNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/create_sequence.go b/pkg/sql/create_sequence.go index b57fa5bd8b4c..96f63d8c65c1 100644 --- a/pkg/sql/create_sequence.go +++ b/pkg/sql/create_sequence.go @@ -26,6 +26,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/hlc" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) type createSequenceNode struct { @@ -157,18 +158,11 @@ func doCreateSequence( // Log Create Sequence event. This is an auditable log event and is // recorded in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateSequence, - int32(desc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SequenceName string - Statement string - User string - }{name.FQString(), context, params.p.User().Normalized()}, - ) + return params.p.logEvent(params.ctx, + desc.ID, + &eventpb.CreateSequence{ + SequenceName: name.FQString(), + }) } func (*createSequenceNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/create_stats.go b/pkg/sql/create_stats.go index 55be4446a308..6204e8abefeb 100644 --- a/pkg/sql/create_stats.go +++ b/pkg/sql/create_stats.go @@ -38,6 +38,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/grpcutil" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -249,6 +250,7 @@ func (n *createStatsNode) makeJobRecord(ctx context.Context) (*jobs.Record, erro // Create a job to run statistics creation. statement := tree.AsStringWithFQNames(n, n.p.EvalContext().Annotations) + eventLogStatement := statement var description string if n.Name == stats.AutoStatsName { // Use a user-friendly description for automatic statistics. @@ -268,7 +270,7 @@ func (n *createStatsNode) makeJobRecord(ctx context.Context) (*jobs.Record, erro FQTableName: fqTableName, Table: tableDesc.TableDescriptor, ColumnStats: colStats, - Statement: n.String(), + Statement: eventLogStatement, AsOf: asOf, MaxFractionIdle: n.Options.Throttling, }, @@ -548,19 +550,21 @@ func (r *createStatsResumer) Resume( // because that transaction must be read-only. In the future we may want // to use the transaction that inserted the new stats into the // system.table_statistics table, but that would require calling - // MakeEventLogger from the distsqlrun package. + // logEvent() from the distsqlrun package. + // + // TODO(knz): figure out why this is not triggered for a regular + // CREATE STATISTICS statement. + // See: https://github.com/cockroachdb/cockroach/issues/57739 return evalCtx.ExecCfg.DB.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { - return MakeEventLogger(evalCtx.ExecCfg).InsertEventRecord( - ctx, - txn, - EventLogCreateStatistics, - int32(details.Table.ID), - int32(evalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - }{details.FQTableName, details.Statement}, - ) + return logEventInternalForSQLStatements(ctx, evalCtx.ExecCfg, txn, + evalCtx.TxnTimestamp, + evalCtx.NodeID.SQLInstanceID(), + details.Table.ID, + evalCtx.SessionData.User(), + details.Statement, + &eventpb.CreateStatistics{ + TableName: details.FQTableName, + }) }) } diff --git a/pkg/sql/create_table.go b/pkg/sql/create_table.go index e463dbea47f5..d8f3a244ebbd 100644 --- a/pkg/sql/create_table.go +++ b/pkg/sql/create_table.go @@ -47,6 +47,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" "github.com/cockroachdb/cockroach/pkg/util/hlc" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" "github.com/lib/pq/oid" ) @@ -391,18 +392,11 @@ func (n *createTableNode) startExec(params runParams) error { // Log Create Table event. This is an auditable log event and is // recorded in the same transaction as the table descriptor update. - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateTable, - int32(desc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - User string - }{n.n.Table.FQString(), n.n.String(), params.p.User().Normalized()}, - ); err != nil { + if err := params.p.logEvent(params.ctx, + desc.ID, + &eventpb.CreateTable{ + TableName: n.n.Table.FQString(), + }); err != nil { return err } diff --git a/pkg/sql/create_type.go b/pkg/sql/create_type.go index f4b1a697ba17..240a4a10685e 100644 --- a/pkg/sql/create_type.go +++ b/pkg/sql/create_type.go @@ -32,6 +32,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -376,18 +377,11 @@ func (p *planner) createEnumWithID( } // Log the event. - return MakeEventLogger(p.ExecCfg()).InsertEventRecord( - params.ctx, - p.txn, - EventLogCreateType, - int32(typeDesc.GetID()), - int32(p.ExtendedEvalContext().NodeID.SQLInstanceID()), - struct { - TypeName string - Statement string - User string - }{typeName.FQString(), typeName.String(), p.User().Normalized()}, - ) + return p.logEvent(params.ctx, + typeDesc.GetID(), + &eventpb.CreateType{ + TypeName: typeName.FQString(), + }) } func (n *createTypeNode) Next(params runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/create_view.go b/pkg/sql/create_view.go index d06c6b44beb2..6663899402ec 100644 --- a/pkg/sql/create_view.go +++ b/pkg/sql/create_view.go @@ -31,6 +31,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" ) // createViewNode represents a CREATE VIEW statement. @@ -257,22 +258,12 @@ func (n *createViewNode) startExec(params runParams) error { // Log Create View event. This is an auditable log event and is // recorded in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogCreateView, - int32(newDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - ViewName string - ViewQuery string - User string - }{ + return params.p.logEvent(params.ctx, + newDesc.ID, + &eventpb.CreateView{ ViewName: n.viewName.FQString(), ViewQuery: n.viewQuery, - User: params.p.User().Normalized(), - }, - ) + }) } func (*createViewNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/drop_database.go b/pkg/sql/drop_database.go index d99b463bf72c..1f1226acebef 100644 --- a/pkg/sql/drop_database.go +++ b/pkg/sql/drop_database.go @@ -30,6 +30,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -195,19 +196,12 @@ func (n *dropDatabaseNode) startExec(params runParams) error { // Log Drop Database event. This is an auditable log event and is recorded // in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - p.txn, - EventLogDropDatabase, - int32(n.dbDesc.GetID()), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - DatabaseName string - Statement string - User string - DroppedSchemaObjects []string - }{n.n.Name.String(), n.n.String(), p.User().Normalized(), n.d.droppedNames}, - ) + return p.logEvent(ctx, + n.dbDesc.GetID(), + &eventpb.DropDatabase{ + DatabaseName: n.n.Name.String(), + DroppedSchemaObjects: n.d.droppedNames, + }) } func (*dropDatabaseNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/drop_index.go b/pkg/sql/drop_index.go index 09932cdb59bf..d09218579612 100644 --- a/pkg/sql/drop_index.go +++ b/pkg/sql/drop_index.go @@ -29,6 +29,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -533,20 +534,14 @@ func (p *planner) dropIndexByName( // Record index drop in the event log. This is an auditable log event // and is recorded in the same transaction as the table descriptor // update. - return MakeEventLogger(p.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - p.txn, - EventLogDropIndex, - int32(tableDesc.ID), - int32(p.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - IndexName string - Statement string - User string - MutationID uint32 - CascadeDroppedViews []string - }{tn.FQString(), string(idxName), jobDesc, p.User().Normalized(), uint32(mutationID), - droppedViews}, - ) + return p.logEvent(ctx, + tableDesc.ID, + &eventpb.DropIndex{ + TableName: tn.FQString(), + IndexName: string(idxName), + MutationID: uint32(mutationID), + // TODO(knz): the dropped views are improperly qualified. + // See: https://github.com/cockroachdb/cockroach/issues/57735 + CascadeDroppedViews: droppedViews, + }) } diff --git a/pkg/sql/drop_role.go b/pkg/sql/drop_role.go index 0e4ef698de40..a4077ca87162 100644 --- a/pkg/sql/drop_role.go +++ b/pkg/sql/drop_role.go @@ -14,7 +14,6 @@ import ( "context" "fmt" "sort" - "strings" "github.com/cockroachdb/cockroach/pkg/security" "github.com/cockroachdb/cockroach/pkg/sql/catalog/dbdesc" @@ -24,6 +23,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -337,17 +337,14 @@ func (n *DropRoleNode) startExec(params runParams) error { } sort.Strings(names) - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogDropRole, - 0, /* no target */ - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - RoleName string - User string - }{strings.Join(names, ", "), params.p.User().Normalized()}, - ) + for _, name := range names { + if err := params.p.logEvent(params.ctx, + 0, /* no target */ + &eventpb.DropRole{RoleName: name}); err != nil { + return err + } + } + return nil } // Next implements the planNode interface. diff --git a/pkg/sql/drop_schema.go b/pkg/sql/drop_schema.go index f3df2a6aac65..b8910a48491d 100644 --- a/pkg/sql/drop_schema.go +++ b/pkg/sql/drop_schema.go @@ -27,6 +27,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -167,18 +168,11 @@ func (n *dropSchemaNode) startExec(params runParams) error { // in the same transaction as table descriptor update. for _, schemaToDelete := range n.d.schemasToDelete { sc := schemaToDelete.schema - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - p.txn, - EventLogDropSchema, - int32(sc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SchemaName string - Statement string - User string - }{sc.Name, n.n.String(), p.User().Normalized()}, - ); err != nil { + if err := params.p.logEvent(params.ctx, + sc.ID, + // TODO(knz): This is missing some details about the database. + // See: https://github.com/cockroachdb/cockroach/issues/57738 + &eventpb.DropSchema{SchemaName: sc.Name}); err != nil { return err } } diff --git a/pkg/sql/drop_sequence.go b/pkg/sql/drop_sequence.go index 808e1db7deb9..af24c5b37444 100644 --- a/pkg/sql/drop_sequence.go +++ b/pkg/sql/drop_sequence.go @@ -23,6 +23,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -89,18 +90,11 @@ func (n *dropSequenceNode) startExec(params runParams) error { // Log a Drop Sequence event for this table. This is an auditable log event // and is recorded in the same transaction as the table descriptor // update. - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - params.p.txn, - EventLogDropSequence, - int32(droppedDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - SequenceName string - Statement string - User string - }{toDel.tn.FQString(), n.n.String(), params.p.User().Normalized()}, - ); err != nil { + if err := params.p.logEvent(params.ctx, + droppedDesc.ID, + &eventpb.DropSequence{ + SequenceName: toDel.tn.FQString(), + }); err != nil { return err } } diff --git a/pkg/sql/drop_table.go b/pkg/sql/drop_table.go index 54fb96629d26..6429f753d769 100644 --- a/pkg/sql/drop_table.go +++ b/pkg/sql/drop_table.go @@ -26,6 +26,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/timeutil" "github.com/cockroachdb/errors" ) @@ -134,20 +135,14 @@ func (n *dropTableNode) startExec(params runParams) error { // Log a Drop Table event for this table. This is an auditable log event // and is recorded in the same transaction as the table descriptor // update. - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - params.p.txn, - EventLogDropTable, - int32(droppedDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - User string - CascadeDroppedViews []string - }{toDel.tn.FQString(), n.n.String(), - params.p.User().Normalized(), droppedViews}, - ); err != nil { + if err := params.p.logEvent(params.ctx, + droppedDesc.ID, + &eventpb.DropTable{ + TableName: toDel.tn.FQString(), + // TODO(knz): the droppedViews are insufficiently qualified + // See: https://github.com/cockroachdb/cockroach/issues/57735 + CascadeDroppedViews: droppedViews, + }); err != nil { return err } } diff --git a/pkg/sql/drop_type.go b/pkg/sql/drop_type.go index 41295a35a428..387f2123fc30 100644 --- a/pkg/sql/drop_type.go +++ b/pkg/sql/drop_type.go @@ -24,6 +24,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -142,18 +143,9 @@ func (n *dropTypeNode) startExec(params runParams) error { return err } // Log a Drop Type event. - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogDropType, - int32(typ.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TypeName string - Statement string - User string - }{typ.Name, tree.AsStringWithFQNames(n.n, params.Ann()), params.p.User().Normalized()}, - ); err != nil { + // TODO(knz): This logging is imperfect, see this issue: + // https://github.com/cockroachdb/cockroach/issues/57734 + if err := params.p.logEvent(params.ctx, typ.ID, &eventpb.DropType{TypeName: typ.Name}); err != nil { return err } } diff --git a/pkg/sql/drop_view.go b/pkg/sql/drop_view.go index 3c0d40ada742..cde7d390cb29 100644 --- a/pkg/sql/drop_view.go +++ b/pkg/sql/drop_view.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -108,19 +109,11 @@ func (n *dropViewNode) startExec(params runParams) error { // Log a Drop View event for this table. This is an auditable log event // and is recorded in the same transaction as the table descriptor // update. - if err := MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - params.p.txn, - EventLogDropView, - int32(droppedDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - ViewName string - Statement string - User string - CascadeDroppedViews []string - }{toDel.tn.FQString(), n.n.String(), params.p.User().Normalized(), cascadeDroppedViews}, - ); err != nil { + if err := params.p.logEvent(ctx, + droppedDesc.ID, + &eventpb.DropView{ + ViewName: toDel.tn.FQString(), + CascadeDroppedViews: cascadeDroppedViews}); err != nil { return err } } diff --git a/pkg/sql/event_log.go b/pkg/sql/event_log.go index b3decc49b786..86ea0d6dace7 100644 --- a/pkg/sql/event_log.go +++ b/pkg/sql/event_log.go @@ -13,186 +13,129 @@ package sql import ( "context" "encoding/json" + "time" + "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/kv" + "github.com/cockroachdb/cockroach/pkg/security" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" + "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) -// EventLogType represents an event type that can be recorded in the event log. -type EventLogType string - -// NOTE: When you add a new event type here. Please manually add it to -// pkg/ui/src/util/eventTypes.ts so that it will be recognized in the UI. -const ( - // EventLogCreateDatabase is recorded when a database is created. - EventLogCreateDatabase EventLogType = "create_database" - // EventLogDropDatabase is recorded when a database is dropped. - EventLogDropDatabase EventLogType = "drop_database" - // EventLogRenameDatabase is recorded when a database is renamed. - EventLogRenameDatabase EventLogType = "rename_database" - // EventLogAlterDatabaseOwner is recorded when a database's owner is changed. - EventLogAlterDatabaseOwner EventLogType = "alter_database_owner" - - // EventLogCreateSchema is recorded when a schema is created. - EventLogCreateSchema EventLogType = "create_schema" - // EventLogDropSchema is recorded when a schema is dropped. - EventLogDropSchema EventLogType = "drop_schema" - // EventLogRenameSchema is recorded when a schema is renamed. - EventLogRenameSchema EventLogType = "rename_schema" - // EventLogAlterSchemaOwner is recorded when a schema's owner is changed. - EventLogAlterSchemaOwner EventLogType = "alter_schema_owner" - // EventLogConvertToSchema is recorded when a database is converted to a schema. - EventLogConvertToSchema EventLogType = "convert_to_schema" - - // EventLogCreateTable is recorded when a table is created. - EventLogCreateTable EventLogType = "create_table" - // EventLogDropTable is recorded when a table is dropped. - EventLogDropTable EventLogType = "drop_table" - // EventLogRenameTable is recorded when a table is renamed. - EventLogRenameTable EventLogType = "rename_table" - // EventLogTruncateTable is recorded when a table is truncated. - EventLogTruncateTable EventLogType = "truncate_table" - // EventLogAlterTable is recorded when a table is altered. - EventLogAlterTable EventLogType = "alter_table" - // EventLogCommentOnColumn is recorded when a column is commented. - EventLogCommentOnColumn EventLogType = "comment_on_column" - // EventLogCommentOnTable is recorded when a table is commented. - EventLogCommentOnDatabase EventLogType = "comment_on_database" - // EventLogCommentOnTable is recorded when a table is commented. - EventLogCommentOnTable EventLogType = "comment_on_table" - // EventLogCommentOnIndex is recorded when a index is commented. - EventLogCommentOnIndex EventLogType = "comment_on_index" - - // EventLogCreateIndex is recorded when an index is created. - EventLogCreateIndex EventLogType = "create_index" - // EventLogDropIndex is recorded when an index is dropped. - EventLogDropIndex EventLogType = "drop_index" - // EventLogAlterIndex is recorded when an index is altered. - EventLogAlterIndex EventLogType = "alter_index" - - // EventLogCreateView is recorded when a view is created. - EventLogCreateView EventLogType = "create_view" - // EventLogDropView is recorded when a view is dropped. - EventLogDropView EventLogType = "drop_view" - - // EventLogCreateSequence is recorded when a sequence is created. - EventLogCreateSequence EventLogType = "create_sequence" - // EventLogDropSequence is recorded when a sequence is dropped. - EventLogDropSequence EventLogType = "drop_sequence" - // EventLogAlterSequence is recorded when a sequence is altered. - EventLogAlterSequence EventLogType = "alter_sequence" - - // EventLogReverseSchemaChange is recorded when an in-progress schema change - // encounters a problem and is reversed. - EventLogReverseSchemaChange EventLogType = "reverse_schema_change" - // EventLogFinishSchemaChange is recorded when a previously initiated schema - // change has completed. - EventLogFinishSchemaChange EventLogType = "finish_schema_change" - // EventLogFinishSchemaRollback is recorded when a previously - // initiated schema change rollback has completed. - EventLogFinishSchemaRollback EventLogType = "finish_schema_change_rollback" - - // EventLogCreateType is recorded when a type is created. - EventLogCreateType EventLogType = "create_type" - // EventLogDropType is recorded when a type is dropped. - EventLogDropType EventLogType = "drop_type" - // EventAlterType is recorded when a type is altered. - EventLogAlterType EventLogType = "alter_type" - - // EventLogNodeJoin is recorded when a node joins the cluster. - EventLogNodeJoin EventLogType = "node_join" - // EventLogNodeRestart is recorded when an existing node rejoins the cluster - // after being offline. - EventLogNodeRestart EventLogType = "node_restart" - - // EventLogNodeDecommissioned is recorded when a node is marked as - // decommissioning. - EventLogNodeDecommissioning EventLogType = "node_decommissioning" - // EventLogNodeDecommissioned is recorded when a node is marked as - // decommissioned. - EventLogNodeDecommissioned EventLogType = "node_decommissioned" - // EventLogNodeRecommissioned is recorded when a decommissioning node is - // recommissioned. - EventLogNodeRecommissioned EventLogType = "node_recommissioned" - - // EventLogSetClusterSetting is recorded when a cluster setting is changed. - EventLogSetClusterSetting EventLogType = "set_cluster_setting" - - // EventLogSetZoneConfig is recorded when a zone config is changed. - EventLogSetZoneConfig EventLogType = "set_zone_config" - // EventLogRemoveZoneConfig is recorded when a zone config is removed. - EventLogRemoveZoneConfig EventLogType = "remove_zone_config" - - // EventLogCreateStatistics is recorded when statistics are collected for a - // table. - EventLogCreateStatistics EventLogType = "create_statistics" - - // EventLogGrantPrivilege is recorded when privileges are added to a user - // for a database object. - EventLogGrantPrivilege EventLogType = "grant_privilege" - // EventLogRevokePrivilege is recorded when privileges are removed from a - // user for a database object. - EventLogRevokePrivilege EventLogType = "revoke_privilege" - - // EventLogCreateRole is recorded when a role is created. - EventLogCreateRole EventLogType = "create_role" - // EventLogDropRole is recorded when a role is dropped. - EventLogDropRole EventLogType = "drop_role" - // EventLogAlterRole is recorded when a role is altered. - EventLogAlterRole EventLogType = "alter_role" - - // EventLogUnsafeUpsertDescriptor is recorded when a descriptor is written - // using crdb_internal.unsafe_upsert_descriptor. - EventLogUnsafeUpsertDescriptor EventLogType = "unsafe_upsert_descriptor" - - // EventLogUnsafeDeleteDescriptor is recorded when a descriptor is written - // using crdb_internal.unsafe_delete_descriptor. - EventLogUnsafeDeleteDescriptor EventLogType = "unsafe_delete_descriptor" - - // EventLogUnsafeUpsertNamespaceEntry is recorded when a namespace entry is - // written using crdb_internal.unsafe_upsert_namespace_entry. - EventLogUnsafeUpsertNamespaceEntry EventLogType = "unsafe_upsert_namespace_entry" - - // EventLogUnsafeDeleteNamespaceEntry is recorded when a namespace entry is - // written using crdb_internal.unsafe_delete_namespace_entry. - EventLogUnsafeDeleteNamespaceEntry EventLogType = "unsafe_delete_namespace_entry" -) +// logEvent emits a cluster event in the context of a regular SQL +// statement. +func (p *planner) logEvent( + ctx context.Context, descID descpb.ID, event eventpb.EventPayload, +) error { + // Compute the common fields from data already known to the planner. + ts := p.extendedEvalCtx.TxnTimestamp + sqlInstanceID := p.extendedEvalCtx.NodeID.SQLInstanceID() + user := p.User() + stmt := tree.AsStringWithFQNames(p.stmt.AST, p.extendedEvalCtx.EvalContext.Annotations) -// EventLogSetClusterSettingDetail is the json details for a settings change. -type EventLogSetClusterSettingDetail struct { - SettingName string - Value string - User string + return logEventInternalForSQLStatements(ctx, p.extendedEvalCtx.ExecCfg, p.txn, ts, sqlInstanceID, descID, user, stmt, event) } -// An EventLogger exposes methods used to record events to the event table. -type EventLogger struct { - *InternalExecutor +// logEventInternalForSchemaChange emits a cluster event in the +// context of a schema changer. +func logEventInternalForSchemaChanges( + ctx context.Context, + execCfg *ExecutorConfig, + txn *kv.Txn, + sqlInstanceID base.SQLInstanceID, + descID descpb.ID, + mutationID descpb.MutationID, + event eventpb.EventPayload, +) error { + event.CommonDetails().Timestamp = txn.ReadTimestamp().GoTime() + scCommon, ok := event.(eventpb.EventWithCommonSchemaChangePayload) + if !ok { + return errors.AssertionFailedf("unknown event type: %T", event) + } + m := scCommon.CommonSchemaChangeDetails() + m.InstanceID = int32(sqlInstanceID) + m.DescriptorID = uint32(descID) + m.MutationID = uint32(mutationID) + + // Delegate the storing of the event to the regular event logic. + return InsertEventRecord( + ctx, execCfg.InternalExecutor, + txn, + int32(descID), + int32(sqlInstanceID), + false, /* skipExternalLog */ + event) } -// MakeEventLogger constructs a new EventLogger. -func MakeEventLogger(execCfg *ExecutorConfig) EventLogger { - return EventLogger{InternalExecutor: execCfg.InternalExecutor} +// logEventInternalForSQLStatements emits a cluster event on behalf of +// a SQL statement, when the point where the event is emitted does not +// have access to a (*planner) and the current statement metadata. +// +// Note: usage of this interface should be minimized. +func logEventInternalForSQLStatements( + ctx context.Context, + execCfg *ExecutorConfig, + txn *kv.Txn, + ts time.Time, + sqlInstanceID base.SQLInstanceID, + descID descpb.ID, + user security.SQLUsername, + stmt string, + event eventpb.EventPayload, +) error { + // Inject the common fields into the payload provided by the caller. + event.CommonDetails().Timestamp = ts + sqlCommon, ok := event.(eventpb.EventWithCommonSQLPayload) + if !ok { + return errors.AssertionFailedf("unknown event type: %T", event) + } + m := sqlCommon.CommonSQLDetails() + m.Statement = stmt + m.User = user.Normalized() + m.InstanceID = int32(sqlInstanceID) + m.DescriptorID = uint32(descID) + + // Delegate the storing of the event to the regular event logic. + return InsertEventRecord(ctx, execCfg.InternalExecutor, + txn, + int32(descID), + int32(sqlInstanceID), + false, /* skipExternalLog */ + event) } -// InsertEventRecord inserts a single event into the event log as part of the -// provided transaction. -func (ev EventLogger) InsertEventRecord( +// InsertEventRecord inserts a single event into the event log as part +// of the provided transaction, using the provided internal executor. +// +// The caller is responsible for populating the timestamp field +// in the event payload. +// +// If the skipExternalLog bool is set, this function does not call +// log.ClusterEvent(). In that case, the caller is responsible for +// calling log.ClusterEvent() directly. +// +// Note: the targetID and reportingID columns are deprecated and +// should be removed after v21.1 is released. +func InsertEventRecord( ctx context.Context, + ex *InternalExecutor, txn *kv.Txn, - eventType EventLogType, targetID, reportingID int32, - info interface{}, + skipExternalLog bool, + info eventpb.EventPayload, ) error { - // Record event record insertion in local log output. + eventType := eventpb.GetEventTypeName(info) + + // Ensure the type field is populated. + info.CommonDetails().EventType = eventType + + // Ensure that the external logging sees the event when the + // transaction commits. txn.AddCommitTrigger(func(ctx context.Context) { - log.Infof( - ctx, "Event: %q, target: %d, info: %+v", - eventType, - targetID, - info, - ) + log.ClusterEvent(ctx, info) }) const insertEventTableStmt = ` @@ -200,10 +143,11 @@ INSERT INTO system.eventlog ( timestamp, "eventType", "targetID", "reportingID", info ) VALUES( - now(), $1, $2, $3, $4 + $1, $2, $3, $4, $5 ) ` args := []interface{}{ + info.CommonDetails().Timestamp, eventType, targetID, reportingID, @@ -214,9 +158,9 @@ VALUES( if err != nil { return err } - args[3] = string(infoBytes) + args[4] = string(infoBytes) } - rows, err := ev.Exec(ctx, "log-event", txn, insertEventTableStmt, args...) + rows, err := ex.Exec(ctx, "log-event", txn, insertEventTableStmt, args...) if err != nil { return err } diff --git a/pkg/sql/grant_revoke.go b/pkg/sql/grant_revoke.go index 8e8c1c5b9b9c..d35d16207582 100644 --- a/pkg/sql/grant_revoke.go +++ b/pkg/sql/grant_revoke.go @@ -13,7 +13,6 @@ package sql import ( "context" "fmt" - "strings" "github.com/cockroachdb/cockroach/pkg/security" "github.com/cockroachdb/cockroach/pkg/sql/catalog" @@ -25,6 +24,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/privilege" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -68,14 +68,14 @@ func (p *planner) Grant(ctx context.Context, n *tree.Grant) (planNode, error) { } return &changePrivilegesNode{ + isGrant: true, targets: n.Targets, grantees: grantees, desiredprivs: n.Privileges, changePrivilege: func(privDesc *descpb.PrivilegeDescriptor, grantee security.SQLUsername) { privDesc.Grant(grantee, n.Privileges) }, - grantOn: grantOn, - eventLogType: EventLogGrantPrivilege, + grantOn: grantOn, }, nil } @@ -119,24 +119,24 @@ func (p *planner) Revoke(ctx context.Context, n *tree.Revoke) (planNode, error) } return &changePrivilegesNode{ + isGrant: false, targets: n.Targets, grantees: grantees, desiredprivs: n.Privileges, changePrivilege: func(privDesc *descpb.PrivilegeDescriptor, grantee security.SQLUsername) { privDesc.Revoke(grantee, n.Privileges, grantOn) }, - grantOn: grantOn, - eventLogType: EventLogRevokePrivilege, + grantOn: grantOn, }, nil } type changePrivilegesNode struct { + isGrant bool targets tree.TargetList grantees []security.SQLUsername desiredprivs privilege.List changePrivilege func(*descpb.PrivilegeDescriptor, security.SQLUsername) grantOn privilege.ObjectType - eventLogType EventLogType } // ReadingOwnWrites implements the planNodeReadingOwnWrites interface. @@ -174,6 +174,13 @@ func (n *changePrivilegesNode) startExec(params runParams) error { return err } + // The events to log at the end. + type eventEntry struct { + descID descpb.ID + event eventpb.EventPayload + } + var events []eventEntry + // First, update the descriptors. We want to catch all errors before // we update them in KV below. b := p.txn.NewBatch() @@ -201,6 +208,13 @@ func (n *changePrivilegesNode) startExec(params runParams) error { return err } + eventDetails := eventpb.CommonSQLPrivilegeEventDetails{} + if n.isGrant { + eventDetails.GrantedPrivileges = n.desiredprivs.SortedNames() + } else { + eventDetails.RevokedPrivileges = n.desiredprivs.SortedNames() + } + switch d := descriptor.(type) { case *dbdesc.Mutable: if err := p.writeDatabaseChangeToBatch(ctx, d, b); err != nil { @@ -211,6 +225,15 @@ func (n *changePrivilegesNode) startExec(params runParams) error { ); err != nil { return err } + for _, grantee := range n.grantees { + privs := eventDetails // copy the granted/revoked privilege list. + privs.Grantee = grantee.Normalized() + events = append(events, eventEntry{d.ID, + &eventpb.ChangeDatabasePrivilege{ + CommonSQLPrivilegeEventDetails: privs, + DatabaseName: (*tree.Name)(&d.Name).String(), + }}) + } case *tabledesc.Mutable: // TODO (lucy): This should probably have a single consolidated job like @@ -227,11 +250,29 @@ func (n *changePrivilegesNode) startExec(params runParams) error { return err } } + for _, grantee := range n.grantees { + privs := eventDetails // copy the granted/revoked privilege list. + privs.Grantee = grantee.Normalized() + events = append(events, eventEntry{d.ID, + &eventpb.ChangeTablePrivilege{ + CommonSQLPrivilegeEventDetails: privs, + TableName: d.Name, // FIXME + }}) + } case *typedesc.Mutable: err := p.writeTypeSchemaChange(ctx, d, fmt.Sprintf("updating privileges for type %d", d.ID)) if err != nil { return err } + for _, grantee := range n.grantees { + privs := eventDetails // copy the granted/revoked privilege list. + privs.Grantee = grantee.Normalized() + events = append(events, eventEntry{d.ID, + &eventpb.ChangeTypePrivilege{ + CommonSQLPrivilegeEventDetails: privs, + TypeName: d.Name, // FIXME + }}) + } case *schemadesc.Mutable: if err := p.writeSchemaDescChange( ctx, @@ -240,6 +281,15 @@ func (n *changePrivilegesNode) startExec(params runParams) error { ); err != nil { return err } + for _, grantee := range n.grantees { + privs := eventDetails // copy the granted/revoked privilege list. + privs.Grantee = grantee.Normalized() + events = append(events, eventEntry{d.ID, + &eventpb.ChangeSchemaPrivilege{ + CommonSQLPrivilegeEventDetails: privs, + SchemaName: d.Name, // FIXME + }}) + } } } @@ -248,34 +298,15 @@ func (n *changePrivilegesNode) startExec(params runParams) error { return err } - // Record this index alteration in the event log. This is an auditable log - // event and is recorded in the same transaction as the table descriptor - // update. - fmtCtx := tree.NewFmtCtx(tree.FmtSimple) - n.targets.Format(fmtCtx) - targets := fmtCtx.CloseAndGetString() - - var grantees strings.Builder - comma := "" - for _, g := range n.grantees { - grantees.WriteString(comma) - grantees.WriteString(g.Normalized()) - comma = "," + // Record the privilege changes in the event log. This is an + // auditable log event and is recorded in the same transaction as + // the table descriptor update. + for _, ev := range events { + if err := params.p.logEvent(params.ctx, ev.descID, ev.event); err != nil { + return err + } } - - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - n.eventLogType, - 0, /* no target */ - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - Target string - User string - Grantees string - Privileges string - }{targets, p.User().Normalized(), grantees.String(), n.desiredprivs.String()}, - ) + return nil } func (*changePrivilegesNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/logictest/testdata/logic_test/event_log b/pkg/sql/logictest/testdata/logic_test/event_log index 989afe043738..8f71ca44dd16 100644 --- a/pkg/sql/logictest/testdata/logic_test/event_log +++ b/pkg/sql/logictest/testdata/logic_test/event_log @@ -18,17 +18,17 @@ ALTER ROLE r WITH CONTROLCHANGEFEED statement ok DROP ROLE r, r2 -query ITTT -SELECT "reportingID", info::JSONB->>'RoleName', "eventType", user +query ITT rowsort +SELECT "reportingID", "eventType", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" IN ('create_role', 'drop_role', 'alter_role') -ORDER BY "eventType", 2 ---- -1 r alter_role root -1 r create_role root -1 r2 create_role root -1 testuser create_role root -1 r, r2 drop_role root +1 create_role {"EventType": "create_role", "InstanceID": 1, "RoleName": "testuser", "Statement": "CREATE USER 'testuser'", "User": "root"} +1 create_role {"EventType": "create_role", "InstanceID": 1, "RoleName": "r", "Statement": "CREATE ROLE 'r'", "User": "root"} +1 create_role {"EventType": "create_role", "InstanceID": 1, "RoleName": "r2", "Statement": "CREATE ROLE IF NOT EXISTS 'r2'", "User": "root"} +1 alter_role {"EventType": "alter_role", "InstanceID": 1, "Options": ["CONTROLCHANGEFEED"], "RoleName": "r", "Statement": "ALTER ROLE 'r' WITH CONTROLCHANGEFEED", "User": "root"} +1 drop_role {"EventType": "drop_role", "InstanceID": 1, "RoleName": "r2", "Statement": "DROP ROLE 'r', 'r2'", "User": "root"} +1 drop_role {"EventType": "drop_role", "InstanceID": 1, "RoleName": "r", "Statement": "DROP ROLE 'r', 'r2'", "User": "root"} # Create two tables + superfluous "IF NOT EXISTS" ################## @@ -48,32 +48,32 @@ CREATE TABLE IF NOT EXISTS a (id INT PRIMARY KEY) ################## query IT rowsort -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_table' ---- -1 test.public.a -1 test.public.b +1 {"DescriptorID": 53, "EventType": "create_table", "InstanceID": 1, "Statement": "CREATE TABLE test.public.a (id INT8 PRIMARY KEY)", "TableName": "test.public.a", "User": "root"} +1 {"DescriptorID": 54, "EventType": "create_table", "InstanceID": 1, "Statement": "CREATE TABLE IF NOT EXISTS test.public.b (id INT8 PRIMARY KEY)", "TableName": "test.public.b", "User": "root"} # Verify the contents of the 'Info' field of each log message using a LIKE # statement. ################## query IT -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_table' - AND info::JSONB->>'Statement' LIKE 'CREATE TABLE a%' + AND info::JSONB->>'Statement' LIKE 'CREATE TABLE test.public.a%' ---- -1 test.public.a +1 {"DescriptorID": 53, "EventType": "create_table", "InstanceID": 1, "Statement": "CREATE TABLE test.public.a (id INT8 PRIMARY KEY)", "TableName": "test.public.a", "User": "root"} query IT -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_table' - AND info::JSONB->>'Statement' LIKE 'CREATE TABLE IF NOT EXISTS b%' + AND info::JSONB->>'Statement' LIKE 'CREATE TABLE IF NOT EXISTS test.public.b%' ---- -1 test.public.b +1 {"DescriptorID": 54, "EventType": "create_table", "InstanceID": 1, "Statement": "CREATE TABLE IF NOT EXISTS test.public.b (id INT8 PRIMARY KEY)", "TableName": "test.public.b", "User": "root"} # Sanity check - check for a non-matching info value. ################## @@ -90,7 +90,7 @@ WHERE "eventType" = 'create_table' ################## query IT rowsort -SELECT "reportingID", info::JSONB->>'TableName' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'alter_table' ---- @@ -98,16 +98,16 @@ statement ok ALTER TABLE a ADD val INT query IT rowsort -SELECT "reportingID", info::JSONB->>'TableName' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'alter_table' ---- -1 test.public.a +1 {"DescriptorID": 53, "EventType": "alter_table", "InstanceID": 1, "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "User": "root"} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'finish_schema_change' ---- -1 1 +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 1} query I SELECT "reportingID" FROM system.eventlog @@ -118,11 +118,11 @@ WHERE "eventType" = 'reverse_schema_change' # statement. ################## query IT -SELECT "reportingID", info::JSONB->>'TableName' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'alter_table' - AND info::JSONB->>'Statement' LIKE 'ALTER TABLE a%' + AND info::JSONB->>'Statement' LIKE 'ALTER TABLE test.public.a%' ---- -1 test.public.a +1 {"DescriptorID": 53, "EventType": "alter_table", "InstanceID": 1, "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "User": "root"} # Add a UNIQUE constraint to the table in a way that will ensure the schema # change is reversed. @@ -135,30 +135,31 @@ statement error pgcode 23505 violates unique constraint \"foo\" ALTER TABLE a ADD CONSTRAINT foo UNIQUE(val) query IT rowsort -SELECT "reportingID", info::JSONB->>'TableName' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'alter_table' ---- -1 test.public.a -1 test.public.a +1 {"DescriptorID": 53, "EventType": "alter_table", "InstanceID": 1, "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "User": "root"} +1 {"DescriptorID": 53, "EventType": "alter_table", "InstanceID": 1, "MutationID": 2, "Statement": "ALTER TABLE test.public.a ADD CONSTRAINT foo UNIQUE (val)", "TableName": "test.public.a", "User": "root"} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'finish_schema_change' ---- -1 1 +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 1} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' || jsonb_object('{Error}', ARRAY[regexp_replace(info::JSONB->>'Error', '\n.*','')]) + FROM system.eventlog WHERE "eventType" = 'reverse_schema_change' ---- -1 2 +1 {"DescriptorID": 53, "Error": "duplicate key value (val)=(1) violates unique constraint \"foo\"", "EventType": "reverse_schema_change", "InstanceID": 1, "MutationID": 2} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'finish_schema_change_rollback' ---- -1 2 +1 {"DescriptorID": 53, "EventType": "finish_schema_change_rollback", "InstanceID": 1, "MutationID": 2} # Create an Index on the table ################# @@ -166,37 +167,37 @@ WHERE "eventType" = 'finish_schema_change_rollback' statement ok CREATE INDEX a_foo ON a (val) -query ITT -SELECT "reportingID", info::JSONB->>'TableName', info::JSONB->>'IndexName' FROM system.eventlog +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_index' - AND info::JSONB->>'Statement' LIKE 'CREATE INDEX a_foo%' + AND info::JSONB->>'Statement' LIKE 'CREATE INDEX %a_foo%' ---- -1 test.public.a a_foo +1 {"DescriptorID": 53, "EventType": "create_index", "IndexName": "a_foo", "InstanceID": 1, "MutationID": 3, "Statement": "CREATE INDEX a_foo ON test.public.a (val)", "TableName": "test.public.a", "User": "root"} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'finish_schema_change' ---- -1 1 -1 3 +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 1} +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 3} statement ok CREATE INDEX ON a (val) -query ITT -SELECT "reportingID", info::JSONB->>'TableName', info::JSONB->>'IndexName' FROM system.eventlog +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_index' AND info::JSONB->>'Statement' LIKE 'CREATE INDEX ON%' ---- -1 test.public.a a_val_idx +1 {"DescriptorID": 53, "EventType": "create_index", "IndexName": "a_val_idx", "InstanceID": 1, "MutationID": 4, "Statement": "CREATE INDEX ON test.public.a (val)", "TableName": "test.public.a", "User": "root"} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'finish_schema_change' ---- -1 1 -1 3 -1 4 +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 1} +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 3} +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 4} # Drop the index @@ -205,21 +206,21 @@ WHERE "eventType" = 'finish_schema_change' statement ok DROP INDEX a@a_foo -query ITT -SELECT "reportingID", info::JSONB->>'TableName', info::JSONB->>'IndexName' FROM system.eventlog +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_index' AND info::JSONB->>'Statement' LIKE 'DROP INDEX%a_foo' ---- -1 test.public.a a_foo +1 {"DescriptorID": 53, "EventType": "drop_index", "IndexName": "a_foo", "InstanceID": 1, "MutationID": 5, "Statement": "DROP INDEX test.public.a@a_foo", "TableName": "test.public.a", "User": "root"} query IT rowsort -SELECT "reportingID", info::JSONB->>'MutationID' FROM system.eventlog +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'finish_schema_change' ---- -1 1 -1 3 -1 4 -1 5 +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 1} +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 3} +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 4} +1 {"DescriptorID": 53, "EventType": "finish_schema_change", "InstanceID": 1, "MutationID": 5} # Truncate a table ################## @@ -228,11 +229,11 @@ statement ok TRUNCATE TABLE a query IT rowsort -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'truncate_table' ---- -1 test.public.a +1 {"DescriptorID": 53, "EventType": "truncate_table", "InstanceID": 1, "Statement": "TRUNCATE TABLE test.public.a", "TableName": "test.public.a", "User": "root"} # Drop both tables + superfluous "IF EXISTS" ################## @@ -252,31 +253,31 @@ DROP TABLE IF EXISTS b ################## query IT rowsort -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_table' ---- -1 test.public.a -1 test.public.b +1 {"DescriptorID": 53, "EventType": "drop_table", "InstanceID": 1, "Statement": "DROP TABLE test.public.a", "TableName": "test.public.a", "User": "root"} +1 {"DescriptorID": 54, "EventType": "drop_table", "InstanceID": 1, "Statement": "DROP TABLE IF EXISTS test.public.b", "TableName": "test.public.b", "User": "root"} # Verify the contents of the 'info' field of each event. ################## query IT -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_table' - AND info::JSONB->>'Statement' LIKE 'DROP TABLE a%' + AND info::JSONB->>'Statement' LIKE 'DROP TABLE test.public.a%' ---- -1 test.public.a +1 {"DescriptorID": 53, "EventType": "drop_table", "InstanceID": 1, "Statement": "DROP TABLE test.public.a", "TableName": "test.public.a", "User": "root"} query IT -SELECT "reportingID", info::JSONB->>'TableName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_table' - AND info::JSONB->>'Statement' LIKE 'DROP TABLE IF EXISTS b%' + AND info::JSONB->>'Statement' LIKE 'DROP TABLE IF EXISTS test.public.b%' ---- -1 test.public.b +1 {"DescriptorID": 54, "EventType": "drop_table", "InstanceID": 1, "Statement": "DROP TABLE IF EXISTS test.public.b", "TableName": "test.public.b", "User": "root"} # Create + Rename table ################## @@ -291,13 +292,13 @@ ALTER TABLE toberenamed RENAME TO renamedtable; # Verify that rename table event is logged ################## -query ITT -SELECT "reportingID", info::JSONB->>'TableName', info::JSONB->>'NewTableName' +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'rename_table' - AND info::JSONB->>'Statement' LIKE 'ALTER TABLE toberenamed RENAME TO renamedtable%' + AND info::JSONB->>'Statement' LIKE 'ALTER TABLE %toberenamed% RENAME TO %renamedtable%' ---- -1 test.public.toberenamed test.public.renamedtable +1 {"DescriptorID": 55, "EventType": "rename_table", "InstanceID": 1, "NewTableName": "test.public.renamedtable", "Statement": "ALTER TABLE toberenamed RENAME TO renamedtable", "TableName": "test.public.toberenamed", "User": "root"} ################## @@ -321,20 +322,20 @@ CREATE DATABASE IF NOT EXISTS othereventlogtest ################## query IT -SELECT "reportingID", info::JSONB->>'DatabaseName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_database' AND info::JSONB->>'Statement' LIKE 'CREATE DATABASE eventlogtest%' ---- -1 eventlogtest +1 {"DatabaseName": "eventlogtest", "DescriptorID": 56, "EventType": "create_database", "InstanceID": 1, "Statement": "CREATE DATABASE eventlogtest", "User": "root"} query IT -SELECT "reportingID", info::JSONB->>'DatabaseName' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_database' AND info::JSONB->>'Statement' LIKE 'CREATE DATABASE IF NOT EXISTS othereventlogtest%' ---- -1 othereventlogtest +1 {"DatabaseName": "othereventlogtest", "DescriptorID": 57, "EventType": "create_database", "InstanceID": 1, "Statement": "CREATE DATABASE IF NOT EXISTS othereventlogtest", "User": "root"} # Add some tables to eventlogtest. ################## @@ -366,20 +367,20 @@ DROP DATABASE IF EXISTS othereventlogtest CASCADE # verify event is there, and cascading table drops are logged. query IT -SELECT "reportingID", info::JSONB->>'DroppedSchemaObjects' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_database' AND info::JSONB->>'Statement' LIKE 'DROP DATABASE eventlogtest%' ---- -1 ["eventlogtest.public.anothertesttable", "eventlogtest.public.testtable"] +1 {"DatabaseName": "eventlogtest", "DescriptorID": 56, "DroppedSchemaObjects": ["eventlogtest.public.anothertesttable", "eventlogtest.public.testtable"], "EventType": "drop_database", "InstanceID": 1, "Statement": "DROP DATABASE eventlogtest CASCADE", "User": "root"} query IT -SELECT "reportingID", info::JSONB->>'DroppedSchemaObjects' +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_database' AND info::JSONB->>'Statement' LIKE 'DROP DATABASE IF EXISTS othereventlogtest%' ---- -1 [] +1 {"DatabaseName": "othereventlogtest", "DescriptorID": 57, "EventType": "drop_database", "InstanceID": 1, "Statement": "DROP DATABASE IF EXISTS othereventlogtest CASCADE", "User": "root"} statement ok SET DATABASE = test @@ -399,13 +400,13 @@ ALTER DATABASE eventlogtorename RENAME TO eventlogtonewname # verify contents of database rename event ################## -query ITT -SELECT "reportingID", info::JSONB->>'DatabaseName', info::JSONB->>'NewDatabaseName' +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'rename_database' - AND info::JSONB->>'Statement' LIKE 'ALTER DATABASE eventlogtorename RENAME TO eventlogtonewname%' + AND info::JSONB->>'Statement' LIKE 'ALTER DATABASE %eventlogtorename% RENAME TO %eventlogtonewname%' ---- -1 eventlogtorename eventlogtonewname +1 {"DatabaseName": "eventlogtorename", "DescriptorID": 60, "EventType": "rename_database", "InstanceID": 1, "NewDatabaseName": "eventlogtonewname", "Statement": "ALTER DATABASE eventlogtorename RENAME TO eventlogtonewname", "User": "root"} statement ok SET DATABASE = test @@ -419,12 +420,12 @@ CREATE USER u statement ok ALTER DATABASE eventlogtonewname OWNER TO u -query ITT -SELECT "reportingID", info::JSONB->>'DatabaseName', info::JSONB->>'Owner' +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'alter_database_owner' ---- -1 eventlogtonewname u +1 {"DatabaseName": "eventlogtonewname", "DescriptorID": 60, "EventType": "alter_database_owner", "InstanceID": 1, "Owner": "u", "Statement": "ALTER DATABASE eventlogtonewname OWNER TO u", "User": "root"} # convert database to schema ################## @@ -432,12 +433,12 @@ WHERE "eventType" = 'alter_database_owner' statement ok ALTER DATABASE eventlogtonewname CONVERT TO SCHEMA WITH PARENT test -query ITT -SELECT "reportingID", info::JSONB->>'DatabaseName', info::JSONB->>'NewDatabaseName' +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'convert_to_schema' ---- -1 eventlogtonewname test +1 {"DatabaseName": "eventlogtonewname", "DescriptorID": 60, "EventType": "convert_to_schema", "InstanceID": 1, "NewDatabaseParent": "test", "Statement": "ALTER DATABASE eventlogtonewname CONVERT TO SCHEMA WITH PARENT test", "User": "root"} statement ok DROP SCHEMA eventlogtonewname @@ -467,7 +468,7 @@ EXECUTE set_setting('some string') # verify setting changes are logged ################## query IIT -SELECT "targetID", "reportingID", "info" +SELECT "targetID", "reportingID", "info"::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'set_cluster_setting' AND info NOT LIKE '%version%' AND info NOT LIKE '%sql.defaults.distsql%' AND info NOT LIKE '%cluster.secret%' @@ -477,12 +478,12 @@ AND info NOT LIKE '%sql.testing%' AND info NOT LIKE '%sql.defaults.experimental_distsql_planning%' ORDER BY "timestamp" ---- -0 1 {"SettingName":"diagnostics.reporting.enabled","Value":"true","User":"root"} -0 1 {"SettingName":"kv.range_merge.queue_enabled","Value":"false","User":"root"} -0 1 {"SettingName":"sql.stats.automatic_collection.min_stale_rows","Value":"5","User":"root"} -0 1 {"SettingName":"kv.allocator.load_based_lease_rebalancing.enabled","Value":"false","User":"root"} -0 1 {"SettingName":"kv.allocator.load_based_lease_rebalancing.enabled","Value":"DEFAULT","User":"root"} -0 1 {"SettingName":"cluster.organization","Value":"'some string'","User":"root"} +0 1 {"EventType": "set_cluster_setting", "InstanceID": 1, "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "User": "root", "Value": "true"} +0 1 {"EventType": "set_cluster_setting", "InstanceID": 1, "SettingName": "kv.range_merge.queue_enabled", "Statement": "SET CLUSTER SETTING \"kv.range_merge.queue_enabled\" = false", "User": "root", "Value": "false"} +0 1 {"EventType": "set_cluster_setting", "InstanceID": 1, "SettingName": "sql.stats.automatic_collection.min_stale_rows", "Statement": "SET CLUSTER SETTING \"sql.stats.automatic_collection.min_stale_rows\" = $1::INT8", "User": "root", "Value": "5"} +0 1 {"EventType": "set_cluster_setting", "InstanceID": 1, "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = false", "User": "root", "Value": "false"} +0 1 {"EventType": "set_cluster_setting", "InstanceID": 1, "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = DEFAULT", "User": "root", "Value": "DEFAULT"} +0 1 {"EventType": "set_cluster_setting", "InstanceID": 1, "SettingName": "cluster.organization", "Statement": "SET CLUSTER SETTING \"cluster.organization\" = $1", "User": "root", "Value": "'some string'"} # Set and unset zone configs ################## @@ -499,20 +500,20 @@ ALTER TABLE a CONFIGURE ZONE DISCARD # verify zone config changes are logged ################## query IT -SELECT "reportingID", "info" +SELECT "reportingID", "info"::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'set_zone_config' ORDER BY "timestamp" ---- -1 {"Target":"TABLE test.public.a","Options":"range_max_bytes = 67108865, range_min_bytes = 16777216","User":"root"} +1 {"DescriptorID": 62, "EventType": "set_zone_config", "InstanceID": 1, "Options": ["range_max_bytes = 67108865", "range_min_bytes = 16777216"], "Statement": "ALTER TABLE \"\".\"\".a CONFIGURE ZONE USING range_max_bytes = 67108865, range_min_bytes = 16777216", "Target": "TABLE test.public.a", "User": "root"} query IT -SELECT "reportingID", "info" +SELECT "reportingID", "info"::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'remove_zone_config' ORDER BY "timestamp" ---- -1 {"Target":"TABLE test.public.a","User":"root"} +1 {"DescriptorID": 62, "EventType": "remove_zone_config", "InstanceID": 1, "Statement": "ALTER TABLE \"\".\"\".a CONFIGURE ZONE DISCARD", "Target": "TABLE test.public.a", "User": "root"} statement ok DROP TABLE a @@ -529,13 +530,13 @@ statement ok DROP SEQUENCE s query TIT rowsort -SELECT "eventType", "reportingID", info::JSONB->>'SequenceName' +SELECT "eventType", "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" in ('create_sequence', 'alter_sequence', 'drop_sequence') ---- -create_sequence 1 test.public.s -alter_sequence 1 test.public.s -drop_sequence 1 test.public.s +create_sequence 1 {"DescriptorID": 63, "EventType": "create_sequence", "InstanceID": 1, "SequenceName": "test.public.s", "Statement": "CREATE SEQUENCE test.public.s", "User": "root"} +alter_sequence 1 {"DescriptorID": 63, "EventType": "alter_sequence", "InstanceID": 1, "SequenceName": "test.public.s", "Statement": "ALTER SEQUENCE test.public.s START 10", "User": "root"} +drop_sequence 1 {"DescriptorID": 63, "EventType": "drop_sequence", "InstanceID": 1, "SequenceName": "test.public.s", "Statement": "DROP SEQUENCE test.public.s", "User": "root"} # Views @@ -546,12 +547,12 @@ statement ok DROP VIEW v query TIT rowsort -SELECT "eventType", "reportingID", info::JSONB->>'ViewName' +SELECT "eventType", "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" in ('create_view', 'drop_view') ---- -create_view 1 test.public.v -drop_view 1 test.public.v +create_view 1 {"DescriptorID": 64, "EventType": "create_view", "InstanceID": 1, "Statement": "CREATE VIEW \"\".\"\".v AS SELECT 1", "User": "root", "ViewName": "test.public.v", "ViewQuery": "SELECT 1"} +drop_view 1 {"DescriptorID": 64, "EventType": "drop_view", "InstanceID": 1, "Statement": "DROP VIEW test.public.v", "User": "root", "ViewName": "test.public.v"} # Change privileges @@ -563,6 +564,18 @@ CREATE TABLE a (id INT PRIMARY KEY) statement ok CREATE TABLE b (id INT PRIMARY KEY) +statement ok +CREATE VIEW c AS SELECT id FROM b + +statement ok +CREATE SEQUENCE sq + +statement ok +CREATE DATABASE dbt + +statement ok +CREATE SCHEMA sc + statement ok CREATE USER u @@ -572,18 +585,56 @@ CREATE USER v statement ok GRANT INSERT ON TABLE a,b TO u +statement ok +GRANT SELECT ON TABLE sq TO u + +statement ok +GRANT SELECT ON TABLE c TO u + +statement ok +GRANT CREATE ON DATABASE dbt TO u + +statement ok +GRANT CREATE ON SCHEMA sc TO u + statement ok REVOKE UPDATE ON TABLE a FROM u,v -query ITT -SELECT "reportingID", "info", "eventType" +statement ok +REVOKE CREATE ON SCHEMA sc FROM u,v + +statement ok +REVOKE CREATE ON DATABASE dbt FROM u,v + +query ITT rowsort +SELECT "reportingID", "info"::JSONB - 'Timestamp', "eventType" FROM system.eventlog -WHERE "eventType" = 'grant_privilege' -OR "eventType" = 'revoke_privilege' -ORDER BY "eventType" +WHERE "eventType" LIKE 'change_%_privilege' ---- -1 {"Target":"TABLE a, b","User":"root","Grantees":"u","Privileges":"INSERT"} grant_privilege -1 {"Target":"TABLE a","User":"root","Grantees":"u,v","Privileges":"UPDATE"} revoke_privilege +1 {"DescriptorID": 65, "EventType": "change_table_privilege", "GrantedPrivileges": ["INSERT"], "Grantee": "u", "InstanceID": 1, "Statement": "GRANT INSERT ON TABLE a, b TO u", "TableName": "a", "User": "root"} change_table_privilege +1 {"DescriptorID": 66, "EventType": "change_table_privilege", "GrantedPrivileges": ["INSERT"], "Grantee": "u", "InstanceID": 1, "Statement": "GRANT INSERT ON TABLE a, b TO u", "TableName": "b", "User": "root"} change_table_privilege +1 {"DescriptorID": 68, "EventType": "change_table_privilege", "GrantedPrivileges": ["SELECT"], "Grantee": "u", "InstanceID": 1, "Statement": "GRANT SELECT ON TABLE sq TO u", "TableName": "sq", "User": "root"} change_table_privilege +1 {"DescriptorID": 67, "EventType": "change_table_privilege", "GrantedPrivileges": ["SELECT"], "Grantee": "u", "InstanceID": 1, "Statement": "GRANT SELECT ON TABLE c TO u", "TableName": "c", "User": "root"} change_table_privilege +1 {"DatabaseName": "dbt", "DescriptorID": 69, "EventType": "change_database_privilege", "GrantedPrivileges": ["CREATE"], "Grantee": "u", "InstanceID": 1, "Statement": "GRANT CREATE ON DATABASE dbt TO u", "User": "root"} change_database_privilege +1 {"DescriptorID": 70, "EventType": "change_schema_privilege", "GrantedPrivileges": ["CREATE"], "Grantee": "u", "InstanceID": 1, "SchemaName": "sc", "Statement": "GRANT CREATE ON SCHEMA \"\".sc TO u", "User": "root"} change_schema_privilege +1 {"DescriptorID": 65, "EventType": "change_table_privilege", "Grantee": "u", "InstanceID": 1, "RevokedPrivileges": ["UPDATE"], "Statement": "REVOKE UPDATE ON TABLE a FROM u, v", "TableName": "a", "User": "root"} change_table_privilege +1 {"DescriptorID": 65, "EventType": "change_table_privilege", "Grantee": "v", "InstanceID": 1, "RevokedPrivileges": ["UPDATE"], "Statement": "REVOKE UPDATE ON TABLE a FROM u, v", "TableName": "a", "User": "root"} change_table_privilege +1 {"DescriptorID": 70, "EventType": "change_schema_privilege", "Grantee": "u", "InstanceID": 1, "RevokedPrivileges": ["CREATE"], "SchemaName": "sc", "Statement": "REVOKE CREATE ON SCHEMA \"\".sc FROM u, v", "User": "root"} change_schema_privilege +1 {"DescriptorID": 70, "EventType": "change_schema_privilege", "Grantee": "v", "InstanceID": 1, "RevokedPrivileges": ["CREATE"], "SchemaName": "sc", "Statement": "REVOKE CREATE ON SCHEMA \"\".sc FROM u, v", "User": "root"} change_schema_privilege +1 {"DatabaseName": "dbt", "DescriptorID": 69, "EventType": "change_database_privilege", "Grantee": "v", "InstanceID": 1, "RevokedPrivileges": ["CREATE"], "Statement": "REVOKE CREATE ON DATABASE dbt FROM u, v", "User": "root"} change_database_privilege +1 {"DatabaseName": "dbt", "DescriptorID": 69, "EventType": "change_database_privilege", "Grantee": "u", "InstanceID": 1, "RevokedPrivileges": ["CREATE"], "Statement": "REVOKE CREATE ON DATABASE dbt FROM u, v", "User": "root"} change_database_privilege + +statement ok +DROP DATABASE dbt + +statement ok +DROP SEQUENCE sq + +statement ok +DROP SCHEMA sc + +statement ok +DROP VIEW c statement ok DROP TABLE a @@ -597,7 +648,6 @@ DROP USER u statement ok DROP USER v - # Schema events ################## @@ -610,44 +660,44 @@ CREATE USER u statement ok CREATE SCHEMA AUTHORIZATION u -query ITT -SELECT "reportingID", info::JSONB->>'SchemaName', info::JSONB->>'Owner' +query IT rowsort +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'create_schema' -ORDER BY 2 ---- -1 s root -1 u u +1 {"DescriptorID": 70, "EventType": "create_schema", "InstanceID": 1, "Owner": "root", "SchemaName": "sc", "Statement": "CREATE SCHEMA \"\".sc", "User": "root"} +1 {"DescriptorID": 71, "EventType": "create_schema", "InstanceID": 1, "Owner": "root", "SchemaName": "s", "Statement": "CREATE SCHEMA \"\".s", "User": "root"} +1 {"DescriptorID": 72, "EventType": "create_schema", "InstanceID": 1, "Owner": "u", "SchemaName": "u", "Statement": "CREATE SCHEMA AUTHORIZATION u", "User": "root"} statement ok ALTER SCHEMA u RENAME TO t -query ITT -SELECT "reportingID", info::JSONB->>'SchemaName', info::JSONB->>'NewSchemaName' +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'rename_schema' ---- -1 u t +1 {"DescriptorID": 72, "EventType": "rename_schema", "InstanceID": 1, "NewSchemaName": "t", "SchemaName": "u", "Statement": "ALTER SCHEMA \"\".u RENAME TO t", "User": "root"} statement ok ALTER SCHEMA t OWNER TO root -query ITT -SELECT "reportingID", info::JSONB->>'SchemaName', info::JSONB->>'Owner' +query IT +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'alter_schema_owner' ---- -1 t root +1 {"DescriptorID": 72, "EventType": "alter_schema_owner", "InstanceID": 1, "Owner": "root", "SchemaName": "t", "Statement": "ALTER SCHEMA \"\".t OWNER TO root", "User": "root"} statement ok DROP SCHEMA s, t -query IT -SELECT "reportingID", info::JSONB->>'SchemaName' +query IT rowsort +SELECT "reportingID", info::JSONB - 'Timestamp' FROM system.eventlog WHERE "eventType" = 'drop_schema' -ORDER BY 2 ---- -1 eventlogtonewname -1 s -1 t +1 {"DescriptorID": 61, "EventType": "drop_schema", "InstanceID": 1, "SchemaName": "eventlogtonewname", "Statement": "DROP SCHEMA \"\".eventlogtonewname", "User": "root"} +1 {"DescriptorID": 70, "EventType": "drop_schema", "InstanceID": 1, "SchemaName": "sc", "Statement": "DROP SCHEMA \"\".sc", "User": "root"} +1 {"DescriptorID": 72, "EventType": "drop_schema", "InstanceID": 1, "SchemaName": "t", "Statement": "DROP SCHEMA \"\".s, \"\".t", "User": "root"} +1 {"DescriptorID": 71, "EventType": "drop_schema", "InstanceID": 1, "SchemaName": "s", "Statement": "DROP SCHEMA \"\".s, \"\".t", "User": "root"} diff --git a/pkg/sql/rename_database.go b/pkg/sql/rename_database.go index ff4bc48dd95f..649d3df5b9ae 100644 --- a/pkg/sql/rename_database.go +++ b/pkg/sql/rename_database.go @@ -28,6 +28,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/util" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/sequence" "github.com/cockroachdb/errors" ) @@ -243,19 +244,12 @@ func (n *renameDatabaseNode) startExec(params runParams) error { // Log Rename Database event. This is an auditable log event and is recorded // in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - p.txn, - EventLogRenameDatabase, - int32(n.dbDesc.GetID()), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - DatabaseName string - Statement string - User string - NewDatabaseName string - }{n.n.Name.String(), n.n.String(), p.User().Normalized(), n.newName}, - ) + return p.logEvent(ctx, + n.dbDesc.GetID(), + &eventpb.RenameDatabase{ + DatabaseName: n.n.Name.String(), + NewDatabaseName: n.newName, + }) } // isAllowedDependentDescInRename determines when rename database is allowed with diff --git a/pkg/sql/rename_table.go b/pkg/sql/rename_table.go index a87f2e9c2d4e..2b77c9249ce8 100644 --- a/pkg/sql/rename_table.go +++ b/pkg/sql/rename_table.go @@ -26,6 +26,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/errors" ) @@ -257,19 +258,12 @@ func (n *renameTableNode) startExec(params runParams) error { // Log Rename Table event. This is an auditable log event and is recorded // in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - EventLogRenameTable, - int32(tableDesc.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - User string - NewTableName string - }{oldTn.FQString(), n.n.String(), params.p.User().Normalized(), newTn.FQString()}, - ) + return p.logEvent(ctx, + tableDesc.ID, + &eventpb.RenameTable{ + TableName: oldTn.FQString(), + NewTableName: newTn.FQString(), + }) } func (n *renameTableNode) Next(runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/repair.go b/pkg/sql/repair.go index d3a2cf9b457b..7b6a20325c00 100644 --- a/pkg/sql/repair.go +++ b/pkg/sql/repair.go @@ -25,6 +25,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgnotice" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/errors" ) @@ -140,25 +141,12 @@ func (p *planner) UnsafeUpsertDescriptor( return err } } - - return MakeEventLogger(p.execCfg).InsertEventRecord( - ctx, - p.txn, - EventLogUnsafeUpsertDescriptor, - int32(id), - int32(p.EvalContext().NodeID.SQLInstanceID()), - &struct { - ID descpb.ID `json:"id"` - ExistingDescriptor string `json:"existing_descriptor,omitempty"` - Descriptor string `json:"descriptor,omitempty"` - Force bool `json:"force,omitempty"` - ValidationErrors string `json:"validation_errors,omitempty"` - }{ - ID: id, - ExistingDescriptor: existingStr, - Descriptor: hex.EncodeToString(encodedDesc), + return p.logEvent(ctx, id, + &eventpb.UnsafeUpsertDescriptor{ + PreviousDescriptor: existingStr, + NewDescriptor: hex.EncodeToString(encodedDesc), Force: force, - ValidationErrors: forceNoticeString, + ForceNotice: forceNoticeString, }) } @@ -290,27 +278,14 @@ func (p *planner) UnsafeUpsertNamespaceEntry( if validationErr != nil { validationErrStr = validationErr.Error() } - return MakeEventLogger(p.execCfg).InsertEventRecord( - ctx, - p.txn, - EventLogUnsafeUpsertNamespaceEntry, - int32(descID), - int32(p.EvalContext().NodeID.SQLInstanceID()), - &struct { - ParentID descpb.ID `json:"parent_id,omitempty"` - ParentSchemaID descpb.ID `json:"parent_schema_id,omitempty"` - Name string `json:"name"` - ID descpb.ID `json:"id"` - ExistingID descpb.ID `json:"existing_id,omitempty"` - Force bool `json:"force,omitempty"` - ValidationErrors string `json:"validation_errors,omitempty"` - }{ - ParentID: parentID, - ParentSchemaID: parentSchemaID, - ID: descID, + return p.logEvent(ctx, descID, + &eventpb.UnsafeUpsertNamespaceEntry{ + ParentID: uint32(parentID), + ParentSchemaID: uint32(parentSchemaID), Name: name, - ExistingID: existingID, + PreviousID: uint32(existingID), Force: force, + FailedValidation: validationErr != nil, ValidationErrors: validationErrStr, }) } @@ -373,27 +348,13 @@ func (p *planner) UnsafeDeleteNamespaceEntry( if err := p.txn.Del(ctx, key); err != nil { return errors.Wrap(err, "failed to delete entry") } - return MakeEventLogger(p.execCfg).InsertEventRecord( - ctx, - p.txn, - EventLogUnsafeDeleteNamespaceEntry, - int32(descID), - int32(p.EvalContext().NodeID.SQLInstanceID()), - &struct { - ParentID descpb.ID `json:"parent_id,omitempty"` - ParentSchemaID descpb.ID `json:"parent_schema_id,omitempty"` - Name string `json:"name"` - ID descpb.ID `json:"id"` - ExistingID descpb.ID `json:"existing_id,omitempty"` - Force bool `json:"force,omitempty"` - ValidationErrors string `json:"validation_errors,omitempty"` - }{ - ParentID: parentID, - ParentSchemaID: parentSchemaID, - ID: descID, - Name: name, - Force: force, - ValidationErrors: forceNoticeString, + return p.logEvent(ctx, descID, + &eventpb.UnsafeDeleteNamespaceEntry{ + ParentID: uint32(parentID), + ParentSchemaID: uint32(parentSchemaID), + Name: name, + Force: force, + ForceNotice: forceNoticeString, }) } @@ -426,31 +387,16 @@ func (p *planner) UnsafeDeleteDescriptor(ctx context.Context, descID int64, forc if err := p.txn.Del(ctx, descKey); err != nil { return err } - ev := struct { - ParentID descpb.ID `json:"parent_id,omitempty"` - ParentSchemaID descpb.ID `json:"parent_schema_id,omitempty"` - Name string `json:"name"` - ID descpb.ID `json:"id"` - Force bool `json:"force,omitempty"` - ValidationErrors string `json:"validation_errors,omitempty"` - }{ - ID: id, - Force: force, - ValidationErrors: forceNoticeString, + ev := &eventpb.UnsafeDeleteDescriptor{ + Force: force, + ForceNotice: forceNoticeString, } if mut != nil { - ev.ParentID = mut.GetParentID() - ev.ParentSchemaID = mut.GetParentSchemaID() + ev.ParentID = uint32(mut.GetParentID()) + ev.ParentSchemaID = uint32(mut.GetParentSchemaID()) ev.Name = mut.GetName() } - return MakeEventLogger(p.execCfg).InsertEventRecord( - ctx, - p.txn, - EventLogUnsafeDeleteDescriptor, - int32(descID), - int32(p.EvalContext().NodeID.SQLInstanceID()), - ev, - ) + return p.logEvent(ctx, id, ev) } func checkPlannerStateForRepairFunctions(ctx context.Context, p *planner, method string) error { diff --git a/pkg/sql/reparent_database.go b/pkg/sql/reparent_database.go index 5b53791c518e..9ff6a065f3eb 100644 --- a/pkg/sql/reparent_database.go +++ b/pkg/sql/reparent_database.go @@ -28,6 +28,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sqlerrors" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/errors" ) @@ -297,18 +298,12 @@ func (n *reparentDatabaseNode) startExec(params runParams) error { // Log Rename Database event. This is an auditable log event and is recorded // in the same transaction as the table descriptor update. - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - p.txn, - EventLogConvertToSchema, - int32(n.db.ID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - DatabaseName string - NewDatabaseName string - User string - }{n.db.Name, n.newParent.Name, p.User().Normalized()}, - ) + return p.logEvent(ctx, + n.db.ID, + &eventpb.ConvertToSchema{ + DatabaseName: n.db.Name, + NewDatabaseParent: n.newParent.Name, + }) } func (n *reparentDatabaseNode) Next(params runParams) (bool, error) { return false, nil } diff --git a/pkg/sql/schema_changer.go b/pkg/sql/schema_changer.go index a200ed0c776a..db9051e99636 100644 --- a/pkg/sql/schema_changer.go +++ b/pkg/sql/schema_changer.go @@ -49,6 +49,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/grpcutil" "github.com/cockroachdb/cockroach/pkg/util/hlc" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/cockroach/pkg/util/retry" "github.com/cockroachdb/cockroach/pkg/util/timeutil" @@ -1327,25 +1328,23 @@ func (sc *SchemaChanger) done(ctx context.Context) error { return err } - schemaChangeEventType := EventLogFinishSchemaChange + var info eventpb.EventPayload if isRollback { - schemaChangeEventType = EventLogFinishSchemaRollback + info = &eventpb.FinishSchemaChangeRollback{} + } else { + info = &eventpb.FinishSchemaChange{} } // Log "Finish Schema Change" or "Finish Schema Change Rollback" // event. Only the table ID and mutation ID are logged; this can // be correlated with the DDL statement that initiated the change // using the mutation id. - return MakeEventLogger(sc.execCfg).InsertEventRecord( - ctx, - txn, - schemaChangeEventType, - int32(sc.descID), - int32(sc.sqlInstanceID), - struct { - MutationID uint32 - }{uint32(sc.mutationID)}, - ) + return logEventInternalForSchemaChanges( + ctx, sc.execCfg, txn, + sc.sqlInstanceID, + sc.descID, + sc.mutationID, + info) }) if fn := sc.testingKnobs.RunBeforeChildJobs; fn != nil { if len(childJobs) != 0 { @@ -1622,17 +1621,15 @@ func (sc *SchemaChanger) maybeReverseMutations(ctx context.Context, causingError // Log "Reverse Schema Change" event. Only the causing error and the // mutation ID are logged; this can be correlated with the DDL statement // that initiated the change using the mutation id. - return MakeEventLogger(sc.execCfg).InsertEventRecord( - ctx, - txn, - EventLogReverseSchemaChange, - int32(sc.descID), - int32(sc.sqlInstanceID), - struct { - Error string - MutationID uint32 - }{fmt.Sprintf("%+v", causingError), uint32(sc.mutationID)}, - ) + return logEventInternalForSchemaChanges( + ctx, sc.execCfg, txn, + sc.sqlInstanceID, + sc.descID, + sc.mutationID, + &eventpb.ReverseSchemaChange{ + Error: fmt.Sprintf("%+v", causingError), + SQLSTATE: pgerror.GetPGCode(causingError).String(), + }) }) if err != nil || alreadyReversed { return err diff --git a/pkg/sql/set_cluster_setting.go b/pkg/sql/set_cluster_setting.go index 2811ce56e9d3..249ad5d68cfc 100644 --- a/pkg/sql/set_cluster_setting.go +++ b/pkg/sql/set_cluster_setting.go @@ -36,6 +36,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/humanizeutil" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/cockroach/pkg/util/retry" "github.com/cockroachdb/errors" @@ -315,14 +316,12 @@ func (n *setClusterSettingNode) startExec(params runParams) error { telemetry.Inc(sqltelemetry.VecModeCounter(validatedExecMode.String())) } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - txn, - EventLogSetClusterSetting, + return params.p.logEvent(ctx, 0, /* no target */ - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - EventLogSetClusterSettingDetail{n.name, reportedValue, params.p.User().Normalized()}, - ) + &eventpb.SetClusterSetting{ + SettingName: n.name, + Value: reportedValue, + }) }); err != nil { return err } diff --git a/pkg/sql/set_zone_config.go b/pkg/sql/set_zone_config.go index 6a74b1180440..7a9c7c72b12d 100644 --- a/pkg/sql/set_zone_config.go +++ b/pkg/sql/set_zone_config.go @@ -35,6 +35,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" "github.com/cockroachdb/cockroach/pkg/sql/types" "github.com/cockroachdb/cockroach/pkg/util/errorutil" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/errors" "github.com/gogo/protobuf/proto" @@ -274,7 +275,7 @@ func (n *setZoneConfigNode) startExec(params runParams) error { // We'll add back the missing newline below. yamlConfig = strings.TrimSpace(yamlConfig) } - var optionStr strings.Builder + var optionsStr []string var copyFromParentList []tree.Name if n.options != nil { // Set from var = value attributes. @@ -296,10 +297,7 @@ func (n *setZoneConfigNode) startExec(params runParams) error { inheritVal, expr := val.inheritValue, val.explicitValue if inheritVal { copyFromParentList = append(copyFromParentList, *name) - if optionStr.Len() > 0 { - optionStr.WriteString(", ") - } - fmt.Fprintf(&optionStr, "%s = COPY FROM PARENT", name) + optionsStr = append(optionsStr, fmt.Sprintf("%s = COPY FROM PARENT", name)) continue } datum, err := expr.Eval(params.EvalContext()) @@ -312,11 +310,7 @@ func (n *setZoneConfigNode) startExec(params runParams) error { } setter := supportedZoneConfigOptions[*name].setter setters = append(setters, func(c *zonepb.ZoneConfig) { setter(c, datum) }) - if optionStr.Len() > 0 { - optionStr.WriteString(", ") - } - fmt.Fprintf(&optionStr, "%s = %s", name, datum) - + optionsStr = append(optionsStr, fmt.Sprintf("%s = %s", name, datum)) } } @@ -677,31 +671,18 @@ func (n *setZoneConfigNode) startExec(params runParams) error { } // Record that the change has occurred for auditing. - var eventLogType EventLogType - info := struct { - Target string - Config string `json:",omitempty"` - Options string `json:",omitempty"` - User string - }{ + eventDetails := eventpb.CommonZoneConfigDetails{ Target: tree.AsStringWithFQNames(&zs, params.Ann()), Config: strings.TrimSpace(yamlConfig), - Options: optionStr.String(), - User: params.p.User().Normalized(), + Options: optionsStr, } + var info eventpb.EventPayload if deleteZone { - eventLogType = EventLogRemoveZoneConfig + info = &eventpb.RemoveZoneConfig{CommonZoneConfigDetails: eventDetails} } else { - eventLogType = EventLogSetZoneConfig - } - return MakeEventLogger(params.extendedEvalCtx.ExecCfg).InsertEventRecord( - params.ctx, - params.p.txn, - eventLogType, - int32(targetID), - int32(params.extendedEvalCtx.NodeID.SQLInstanceID()), - info, - ) + info = &eventpb.SetZoneConfig{CommonZoneConfigDetails: eventDetails} + } + return params.p.logEvent(params.ctx, targetID, info) } for _, zs := range specifiers { // Note(solon): Currently the zone configurations are applied serially for diff --git a/pkg/sql/truncate.go b/pkg/sql/truncate.go index 6ba47d98e425..95d9ca4e34c4 100644 --- a/pkg/sql/truncate.go +++ b/pkg/sql/truncate.go @@ -27,6 +27,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/sessiondata" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" "github.com/cockroachdb/cockroach/pkg/util/protoutil" "github.com/cockroachdb/cockroach/pkg/util/timeutil" "github.com/cockroachdb/errors" @@ -151,18 +152,11 @@ func (t *truncateNode) startExec(params runParams) error { } // Log a Truncate Table event for this table. - if err := MakeEventLogger(p.extendedEvalCtx.ExecCfg).InsertEventRecord( - ctx, - p.txn, - EventLogTruncateTable, - int32(id), - int32(p.extendedEvalCtx.NodeID.SQLInstanceID()), - struct { - TableName string - Statement string - User string - }{name, n.String(), p.User().Normalized()}, - ); err != nil { + if err := params.p.logEvent(ctx, + id, + &eventpb.TruncateTable{ + TableName: name, + }); err != nil { return err } } diff --git a/pkg/ui/src/util/eventTypes.ts b/pkg/ui/src/util/eventTypes.ts index d6a43dc06f4d..5f0387336b35 100644 --- a/pkg/ui/src/util/eventTypes.ts +++ b/pkg/ui/src/util/eventTypes.ts @@ -75,10 +75,14 @@ export const SET_ZONE_CONFIG = "set_zone_config"; export const REMOVE_ZONE_CONFIG = "remove_zone_config"; // Recorded when statistics are collected for a table. export const CREATE_STATISTICS = "create_statistics"; -// Recorded when privileges are added to a user(s). -export const GRANT_PRIVILEGE = "grant_privilege"; -// Recorded when privileges are removed from a user(s). -export const REVOKE_PRIVILEGE = "revoke_privilege"; +// Recorded when privileges are added to a user. +export const CHANGE_DATABASE_PRIVILEGE = "change_database_privilege"; +// Recorded when privileges are added to a user. +export const CHANGE_TABLE_PRIVILEGE = "change_table_privilege"; +// Recorded when privileges are added to a user. +export const CHANGE_SCHEMA_PRIVILEGE = "change_schema_privilege"; +// Recorded when privileges are added to a user. +export const CHANGE_TYPE_PRIVILEGE = "change_type_privilege"; // Recorded when a schema is created. export const CREATE_SCHEMA = "create_schema"; // Recorded when a schema is dropped. diff --git a/pkg/ui/src/util/events.ts b/pkg/ui/src/util/events.ts index 80d533eefacd..d4d463341f43 100644 --- a/pkg/ui/src/util/events.ts +++ b/pkg/ui/src/util/events.ts @@ -20,7 +20,7 @@ type Event$Properties = protos.cockroach.server.serverpb.EventsResponse.IEvent; */ export function getEventDescription(e: Event$Properties): string { const info: EventInfo = protobuf.util.isset(e, "info") ? JSON.parse(e.info) : {}; - const targetId: number = e.target_id ? e.target_id.toNumber() : null; + let privs = ''; switch (e.event_type) { case eventTypes.CREATE_DATABASE: @@ -59,21 +59,21 @@ export function getEventDescription(e: Event$Properties): string { case eventTypes.DROP_SEQUENCE: return `Sequence Dropped: User ${info.User} dropped sequence ${info.SequenceName}`; case eventTypes.REVERSE_SCHEMA_CHANGE: - return `Schema Change Reversed: Schema change with ID ${info.MutationID} was reversed.`; + return `Schema Change Reversed: Schema change on descriptor ${info.DescriptorID} with ID ${info.MutationID} was reversed.`; case eventTypes.FINISH_SCHEMA_CHANGE: - return `Schema Change Completed: Schema change with ID ${info.MutationID} was completed.`; + return `Schema Change Completed: Schema change on descriptor ${info.DescriptorID} with ID ${info.MutationID} was completed.`; case eventTypes.FINISH_SCHEMA_CHANGE_ROLLBACK: - return `Schema Change Rollback Completed: Rollback of schema change with ID ${info.MutationID} was completed.`; + return `Schema Change Rollback Completed: Rollback of schema change on descriptor ${info.DescriptorID} with ID ${info.MutationID} was completed.`; case eventTypes.NODE_JOIN: - return `Node Joined: Node ${targetId} joined the cluster`; + return `Node Joined: Node ${info.NodeID} joined the cluster`; case eventTypes.NODE_DECOMMISSIONING: - return `Node Decommissioning: Node ${targetId} was marked as decommissioning`; + return `Node Decommissioning: Node ${info.TargetNodeID} was marked as decommissioning`; case eventTypes.NODE_DECOMMISSIONED: - return `Node Decommissioned: Node ${targetId} was decommissioned`; + return `Node Decommissioned: Node ${info.TargetNodeID} was decommissioned`; case eventTypes.NODE_RECOMMISSIONED: - return `Node Recommissioned: Node ${targetId} was recommissioned`; + return `Node Recommissioned: Node ${info.TargetNodeID} was recommissioned`; case eventTypes.NODE_RESTART: - return `Node Rejoined: Node ${targetId} rejoined the cluster`; + return `Node Rejoined: Node ${info.TargetNodeID} rejoined the cluster`; case eventTypes.SET_CLUSTER_SETTING: if (info.Value && info.Value.length > 0) { return `Cluster Setting Changed: User ${info.User} set ${info.SettingName} to ${info.Value}`; @@ -85,10 +85,38 @@ export function getEventDescription(e: Event$Properties): string { return `Zone Config Removed: User ${info.User} removed the zone config for ${info.Target}`; case eventTypes.CREATE_STATISTICS: return `Table statistics refreshed for ${info.TableName}`; - case eventTypes.GRANT_PRIVILEGE: - return `Privileges granted: User ${info.User} granted ${info.Privileges} to ${info.Grantees} on ${info.Target}`; - case eventTypes.REVOKE_PRIVILEGE: - return `Privileges revoked: User ${info.User} revoked ${info.Privileges} from ${info.Grantees} on ${info.Target}`; + case eventTypes.CHANGE_TABLE_PRIVILEGE: + if (info.GrantedPrivileges && info.GrantedPrivileges.length > 0) { + privs += ' granted ' + info.GrantedPrivileges; + } + if (info.RevokedPrivileges && info.RevokedPrivileges.length > 0) { + privs += ' revoked ' + info.GrantedPrivileges; + } + return `Privilege change: User ${info.User}${privs} to ${info.Grantee} on table ${info.TableName}`; + case eventTypes.CHANGE_SCHEMA_PRIVILEGE: + if (info.GrantedPrivileges && info.GrantedPrivileges.length > 0) { + privs += ' granted ' + info.GrantedPrivileges; + } + if (info.RevokedPrivileges && info.RevokedPrivileges.length > 0) { + privs += ' revoked ' + info.GrantedPrivileges; + } + return `Privilege change: User ${info.User}${privs} to ${info.Grantee} on schema ${info.SchemaName}`; + case eventTypes.CHANGE_DATABASE_PRIVILEGE: + if (info.GrantedPrivileges && info.GrantedPrivileges.length > 0) { + privs += ' granted ' + info.GrantedPrivileges; + } + if (info.RevokedPrivileges && info.RevokedPrivileges.length > 0) { + privs += ' revoked ' + info.GrantedPrivileges; + } + return `Privilege change: User ${info.User}${privs} to ${info.Grantee} on database ${info.DatabaseName}`; + case eventTypes.CHANGE_TYPE_PRIVILEGE: + if (info.GrantedPrivileges && info.GrantedPrivileges.length > 0) { + privs += ' granted ' + info.GrantedPrivileges; + } + if (info.RevokedPrivileges && info.RevokedPrivileges.length > 0) { + privs += ' revoked ' + info.GrantedPrivileges; + } + return `Privilege change: User ${info.User}${privs} to ${info.Grantee} on type ${info.TypeName}`; case eventTypes.CREATE_SCHEMA: return `Schema Created: User ${info.User} created schema ${info.SchemaName} with owner ${info.Owner}`; case eventTypes.DROP_SCHEMA: @@ -98,11 +126,11 @@ export function getEventDescription(e: Event$Properties): string { case eventTypes.ALTER_SCHEMA_OWNER: return `Schema Owner Altered: User ${info.User} altered the owner of schema ${info.SchemaName} to ${info.Owner}`; case eventTypes.CONVERT_TO_SCHEMA: - return `Database Converted: User ${info.User} converted database ${info.DatabaseName} to a schema with parent database ${info.NewDatabaseName}`; + return `Database Converted: User ${info.User} converted database ${info.DatabaseName} to a schema with parent database ${info.NewDatabaseParent}`; case eventTypes.CREATE_ROLE: return `Role Created: User ${info.User} created role ${info.RoleName}`; case eventTypes.DROP_ROLE: - return `Role Dropped: User ${info.User} dropped role(s) ${info.RoleName}`; + return `Role Dropped: User ${info.User} dropped role ${info.RoleName}`; case eventTypes.ALTER_ROLE: return `Role Altered: User ${info.User} altered role ${info.RoleName}`; default: @@ -127,7 +155,7 @@ export interface EventInfo { Target?: string; Config?: string; Statement?: string; - Grantees?: string; + Grantee?: string; Privileges?: string; SchemaName?: string; NewSchemaName?: string; @@ -138,11 +166,12 @@ export interface EventInfo { DroppedTables?: string[]; DroppedTablesAndViews?: string[]; DroppedSchemaObjects?: string[]; + CascadeDroppedViews?: string[]; } export function getDroppedObjectsText(eventInfo: EventInfo): string { const droppedObjects = - eventInfo.DroppedSchemaObjects || eventInfo.DroppedTablesAndViews || eventInfo.DroppedTables; + eventInfo.DroppedSchemaObjects || eventInfo.DroppedTablesAndViews || eventInfo.DroppedTables || eventInfo.CascadeDroppedViews; if (!droppedObjects) { return ""; } diff --git a/pkg/util/log/BUILD.bazel b/pkg/util/log/BUILD.bazel index bc0276697526..5fe1871c7361 100644 --- a/pkg/util/log/BUILD.bazel +++ b/pkg/util/log/BUILD.bazel @@ -7,6 +7,7 @@ go_library( "channels.go", "clog.go", "doc.go", + "event_log.go", "every_n.go", "exit_override.go", "file.go", @@ -48,6 +49,7 @@ go_library( "//pkg/util/envutil", "//pkg/util/fileutil", "//pkg/util/log/channel", + "//pkg/util/log/eventpb", "//pkg/util/log/logconfig", "//pkg/util/log/logflags", "//pkg/util/log/logpb", diff --git a/pkg/util/log/event_log.go b/pkg/util/log/event_log.go new file mode 100644 index 000000000000..1b27c58be504 --- /dev/null +++ b/pkg/util/log/event_log.go @@ -0,0 +1,25 @@ +// Copyright 2020 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 log + +import ( + "context" + + "github.com/cockroachdb/cockroach/pkg/util/log/eventpb" +) + +// ClusterEvent emits a structured event to the debug log. +// +// TODO(knz): Change this to log to different channels depending +// on event type. +func ClusterEvent(ctx context.Context, event eventpb.EventPayload) { + InfofDepth(ctx, 1, "Event: %+v", event) +} diff --git a/pkg/util/log/eventpb/BUILD.bazel b/pkg/util/log/eventpb/BUILD.bazel new file mode 100644 index 000000000000..f5af54c2bce4 --- /dev/null +++ b/pkg/util/log/eventpb/BUILD.bazel @@ -0,0 +1,25 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +go_library( + name = "eventpb", + srcs = [ + "cluster_events.pb.go", + "ddl_events.pb.go", + "events.go", + "events.pb.go", + "misc_sql_events.pb.go", + "privilege_events.pb.go", + ], + importpath = "github.com/cockroachdb/cockroach/pkg/util/log/eventpb", + visibility = ["//visibility:public"], + deps = [ + "//vendor/github.com/gogo/protobuf/proto", + "//vendor/github.com/gogo/protobuf/types", + ], +) + +go_test( + name = "eventpb_test", + srcs = ["events_test.go"], + embed = [":eventpb"], +) diff --git a/pkg/util/log/eventpb/cluster_events.pb.go b/pkg/util/log/eventpb/cluster_events.pb.go new file mode 100644 index 000000000000..fdd13cfcad31 --- /dev/null +++ b/pkg/util/log/eventpb/cluster_events.pb.go @@ -0,0 +1,1537 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: util/log/eventpb/cluster_events.proto + +package eventpb + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// CommonNodeEventDetails contains the fields common to all +// node-level events. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +type CommonNodeEventDetails struct { + // The node ID where the event was originated. + NodeID int32 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:",omitempty"` + // The time when this node was last started. + StartedAt int64 `protobuf:"varint,3,opt,name=started_at,json=startedAt,proto3" json:",omitempty"` + // The approximate last time the node was up before the last restart. + LastUp int64 `protobuf:"varint,4,opt,name=last_up,json=lastUp,proto3" json:",omitempty"` +} + +func (m *CommonNodeEventDetails) Reset() { *m = CommonNodeEventDetails{} } +func (m *CommonNodeEventDetails) String() string { return proto.CompactTextString(m) } +func (*CommonNodeEventDetails) ProtoMessage() {} +func (*CommonNodeEventDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{0} +} +func (m *CommonNodeEventDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonNodeEventDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommonNodeEventDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonNodeEventDetails.Merge(dst, src) +} +func (m *CommonNodeEventDetails) XXX_Size() int { + return m.Size() +} +func (m *CommonNodeEventDetails) XXX_DiscardUnknown() { + xxx_messageInfo_CommonNodeEventDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonNodeEventDetails proto.InternalMessageInfo + +// NodeJoin is recorded when a node joins the cluster. +type NodeJoin struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonNodeEventDetails `protobuf:"bytes,2,opt,name=node,proto3,embedded=node" json:""` +} + +func (m *NodeJoin) Reset() { *m = NodeJoin{} } +func (m *NodeJoin) String() string { return proto.CompactTextString(m) } +func (*NodeJoin) ProtoMessage() {} +func (*NodeJoin) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{1} +} +func (m *NodeJoin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *NodeJoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeJoin.Merge(dst, src) +} +func (m *NodeJoin) XXX_Size() int { + return m.Size() +} +func (m *NodeJoin) XXX_DiscardUnknown() { + xxx_messageInfo_NodeJoin.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeJoin proto.InternalMessageInfo + +// NodeRestart is recorded when an existing node rejoins the cluster +// after being offline. +type NodeRestart struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonNodeEventDetails `protobuf:"bytes,2,opt,name=node,proto3,embedded=node" json:""` +} + +func (m *NodeRestart) Reset() { *m = NodeRestart{} } +func (m *NodeRestart) String() string { return proto.CompactTextString(m) } +func (*NodeRestart) ProtoMessage() {} +func (*NodeRestart) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{2} +} +func (m *NodeRestart) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeRestart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *NodeRestart) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeRestart.Merge(dst, src) +} +func (m *NodeRestart) XXX_Size() int { + return m.Size() +} +func (m *NodeRestart) XXX_DiscardUnknown() { + xxx_messageInfo_NodeRestart.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeRestart proto.InternalMessageInfo + +// CommonNodeDecommissionDetails contains the fields common to all +// node-level decommission/recommission events. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +type CommonNodeDecommissionDetails struct { + // The node ID where the event was originated. + RequestingNodeID int32 `protobuf:"varint,1,opt,name=requesting_node_id,json=requestingNodeId,proto3" json:",omitempty"` + // The node ID affected by the operation. + TargetNodeID int32 `protobuf:"varint,2,opt,name=target_node_id,json=targetNodeId,proto3" json:",omitempty"` +} + +func (m *CommonNodeDecommissionDetails) Reset() { *m = CommonNodeDecommissionDetails{} } +func (m *CommonNodeDecommissionDetails) String() string { return proto.CompactTextString(m) } +func (*CommonNodeDecommissionDetails) ProtoMessage() {} +func (*CommonNodeDecommissionDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{3} +} +func (m *CommonNodeDecommissionDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonNodeDecommissionDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommonNodeDecommissionDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonNodeDecommissionDetails.Merge(dst, src) +} +func (m *CommonNodeDecommissionDetails) XXX_Size() int { + return m.Size() +} +func (m *CommonNodeDecommissionDetails) XXX_DiscardUnknown() { + xxx_messageInfo_CommonNodeDecommissionDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonNodeDecommissionDetails proto.InternalMessageInfo + +// NodeDecommissioned is recorded when a node is marked as +// decommissioning. +type NodeDecommissioning struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonNodeDecommissionDetails `protobuf:"bytes,2,opt,name=node,proto3,embedded=node" json:""` +} + +func (m *NodeDecommissioning) Reset() { *m = NodeDecommissioning{} } +func (m *NodeDecommissioning) String() string { return proto.CompactTextString(m) } +func (*NodeDecommissioning) ProtoMessage() {} +func (*NodeDecommissioning) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{4} +} +func (m *NodeDecommissioning) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeDecommissioning) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *NodeDecommissioning) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeDecommissioning.Merge(dst, src) +} +func (m *NodeDecommissioning) XXX_Size() int { + return m.Size() +} +func (m *NodeDecommissioning) XXX_DiscardUnknown() { + xxx_messageInfo_NodeDecommissioning.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeDecommissioning proto.InternalMessageInfo + +// NodeDecommissioned is recorded when a node is marked as +// decommissioned. +type NodeDecommissioned struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonNodeDecommissionDetails `protobuf:"bytes,2,opt,name=node,proto3,embedded=node" json:""` +} + +func (m *NodeDecommissioned) Reset() { *m = NodeDecommissioned{} } +func (m *NodeDecommissioned) String() string { return proto.CompactTextString(m) } +func (*NodeDecommissioned) ProtoMessage() {} +func (*NodeDecommissioned) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{5} +} +func (m *NodeDecommissioned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeDecommissioned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *NodeDecommissioned) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeDecommissioned.Merge(dst, src) +} +func (m *NodeDecommissioned) XXX_Size() int { + return m.Size() +} +func (m *NodeDecommissioned) XXX_DiscardUnknown() { + xxx_messageInfo_NodeDecommissioned.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeDecommissioned proto.InternalMessageInfo + +// NodeRecommissioned is recorded when a decommissioning node is +// recommissioned. +type NodeRecommissioned struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonNodeDecommissionDetails `protobuf:"bytes,2,opt,name=node,proto3,embedded=node" json:""` +} + +func (m *NodeRecommissioned) Reset() { *m = NodeRecommissioned{} } +func (m *NodeRecommissioned) String() string { return proto.CompactTextString(m) } +func (*NodeRecommissioned) ProtoMessage() {} +func (*NodeRecommissioned) Descriptor() ([]byte, []int) { + return fileDescriptor_cluster_events_4feefb29149cfde6, []int{6} +} +func (m *NodeRecommissioned) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NodeRecommissioned) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *NodeRecommissioned) XXX_Merge(src proto.Message) { + xxx_messageInfo_NodeRecommissioned.Merge(dst, src) +} +func (m *NodeRecommissioned) XXX_Size() int { + return m.Size() +} +func (m *NodeRecommissioned) XXX_DiscardUnknown() { + xxx_messageInfo_NodeRecommissioned.DiscardUnknown(m) +} + +var xxx_messageInfo_NodeRecommissioned proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CommonNodeEventDetails)(nil), "cockroach.util.log.eventpb.CommonNodeEventDetails") + proto.RegisterType((*NodeJoin)(nil), "cockroach.util.log.eventpb.NodeJoin") + proto.RegisterType((*NodeRestart)(nil), "cockroach.util.log.eventpb.NodeRestart") + proto.RegisterType((*CommonNodeDecommissionDetails)(nil), "cockroach.util.log.eventpb.CommonNodeDecommissionDetails") + proto.RegisterType((*NodeDecommissioning)(nil), "cockroach.util.log.eventpb.NodeDecommissioning") + proto.RegisterType((*NodeDecommissioned)(nil), "cockroach.util.log.eventpb.NodeDecommissioned") + proto.RegisterType((*NodeRecommissioned)(nil), "cockroach.util.log.eventpb.NodeRecommissioned") +} +func (m *CommonNodeEventDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonNodeEventDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.NodeID != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.NodeID)) + } + if m.StartedAt != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.StartedAt)) + } + if m.LastUp != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.LastUp)) + } + return i, nil +} + +func (m *NodeJoin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeJoin) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n1, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + dAtA[i] = 0x12 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonNodeEventDetails.Size())) + n2, err := m.CommonNodeEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + return i, nil +} + +func (m *NodeRestart) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeRestart) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n3, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + dAtA[i] = 0x12 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonNodeEventDetails.Size())) + n4, err := m.CommonNodeEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + return i, nil +} + +func (m *CommonNodeDecommissionDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonNodeDecommissionDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.RequestingNodeID != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.RequestingNodeID)) + } + if m.TargetNodeID != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.TargetNodeID)) + } + return i, nil +} + +func (m *NodeDecommissioning) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeDecommissioning) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n5, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + dAtA[i] = 0x12 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonNodeDecommissionDetails.Size())) + n6, err := m.CommonNodeDecommissionDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + return i, nil +} + +func (m *NodeDecommissioned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeDecommissioned) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n7, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + dAtA[i] = 0x12 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonNodeDecommissionDetails.Size())) + n8, err := m.CommonNodeDecommissionDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + return i, nil +} + +func (m *NodeRecommissioned) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeRecommissioned) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n9, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + dAtA[i] = 0x12 + i++ + i = encodeVarintClusterEvents(dAtA, i, uint64(m.CommonNodeDecommissionDetails.Size())) + n10, err := m.CommonNodeDecommissionDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + return i, nil +} + +func encodeVarintClusterEvents(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *CommonNodeEventDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NodeID != 0 { + n += 1 + sovClusterEvents(uint64(m.NodeID)) + } + if m.StartedAt != 0 { + n += 1 + sovClusterEvents(uint64(m.StartedAt)) + } + if m.LastUp != 0 { + n += 1 + sovClusterEvents(uint64(m.LastUp)) + } + return n +} + +func (m *NodeJoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + l = m.CommonNodeEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + return n +} + +func (m *NodeRestart) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + l = m.CommonNodeEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + return n +} + +func (m *CommonNodeDecommissionDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestingNodeID != 0 { + n += 1 + sovClusterEvents(uint64(m.RequestingNodeID)) + } + if m.TargetNodeID != 0 { + n += 1 + sovClusterEvents(uint64(m.TargetNodeID)) + } + return n +} + +func (m *NodeDecommissioning) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + l = m.CommonNodeDecommissionDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + return n +} + +func (m *NodeDecommissioned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + l = m.CommonNodeDecommissionDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + return n +} + +func (m *NodeRecommissioned) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + l = m.CommonNodeDecommissionDetails.Size() + n += 1 + l + sovClusterEvents(uint64(l)) + return n +} + +func sovClusterEvents(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozClusterEvents(x uint64) (n int) { + return sovClusterEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CommonNodeEventDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonNodeEventDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonNodeEventDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeID", wireType) + } + m.NodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NodeID |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartedAt", wireType) + } + m.StartedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartedAt |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastUp", wireType) + } + m.LastUp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastUp |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeJoin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeJoin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeJoin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonNodeEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonNodeEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeRestart) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeRestart: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeRestart: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonNodeEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonNodeEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonNodeDecommissionDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonNodeDecommissionDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonNodeDecommissionDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestingNodeID", wireType) + } + m.RequestingNodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestingNodeID |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetNodeID", wireType) + } + m.TargetNodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TargetNodeID |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeDecommissioning) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeDecommissioning: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeDecommissioning: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonNodeDecommissionDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonNodeDecommissionDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeDecommissioned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeDecommissioned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeDecommissioned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonNodeDecommissionDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonNodeDecommissionDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeRecommissioned) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeRecommissioned: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeRecommissioned: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonNodeDecommissionDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClusterEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonNodeDecommissionDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipClusterEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthClusterEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipClusterEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthClusterEvents + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowClusterEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipClusterEvents(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthClusterEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowClusterEvents = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("util/log/eventpb/cluster_events.proto", fileDescriptor_cluster_events_4feefb29149cfde6) +} + +var fileDescriptor_cluster_events_4feefb29149cfde6 = []byte{ + // 463 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x94, 0xc1, 0x6a, 0xd4, 0x40, + 0x18, 0xc7, 0x33, 0x6d, 0xcd, 0xea, 0xd7, 0xa5, 0x94, 0x51, 0x24, 0x2c, 0x74, 0x52, 0x02, 0x62, + 0x05, 0xcd, 0x62, 0x3d, 0x79, 0x74, 0x5d, 0x0f, 0xf5, 0x20, 0x12, 0xd6, 0x8b, 0x1e, 0x42, 0x9a, + 0x0c, 0x71, 0x30, 0x9b, 0x89, 0x99, 0x6f, 0x05, 0xdf, 0xc2, 0x77, 0xf0, 0x1d, 0x14, 0x9f, 0xc0, + 0x3d, 0xee, 0xb1, 0xa7, 0xa0, 0xd9, 0x5b, 0x9f, 0x42, 0x66, 0x1a, 0xdb, 0x6e, 0x8c, 0xe8, 0xa5, + 0x87, 0xbd, 0x25, 0xfc, 0xff, 0xf3, 0x9b, 0xef, 0xff, 0xcf, 0x47, 0xe0, 0xce, 0x0c, 0x45, 0x36, + 0xcc, 0x64, 0x3a, 0xe4, 0x1f, 0x78, 0x8e, 0xc5, 0xf1, 0x30, 0xce, 0x66, 0x0a, 0x79, 0x19, 0x9a, + 0x77, 0xe5, 0x17, 0xa5, 0x44, 0x49, 0x07, 0xb1, 0x8c, 0xdf, 0x95, 0x32, 0x8a, 0xdf, 0xfa, 0xfa, + 0x80, 0x9f, 0xc9, 0xd4, 0x6f, 0x0e, 0x0c, 0x6e, 0xa5, 0x32, 0x95, 0xc6, 0x36, 0xd4, 0x4f, 0x67, + 0x27, 0x06, 0x7b, 0x7f, 0x80, 0x2f, 0x03, 0xbd, 0xcf, 0x04, 0x6e, 0x3f, 0x95, 0xd3, 0xa9, 0xcc, + 0x5f, 0xc8, 0x84, 0x3f, 0xd3, 0xd2, 0x98, 0x63, 0x24, 0x32, 0x45, 0x1f, 0x42, 0x2f, 0x97, 0x09, + 0x0f, 0x45, 0xe2, 0x90, 0x7d, 0x72, 0x70, 0x6d, 0xe4, 0xd4, 0x95, 0x6b, 0x6b, 0xdb, 0xd1, 0xf8, + 0xb4, 0x72, 0xe1, 0xbe, 0x9c, 0x0a, 0xe4, 0xd3, 0x02, 0x3f, 0x06, 0xb6, 0x36, 0x1e, 0x25, 0xf4, + 0x01, 0x80, 0xc2, 0xa8, 0x44, 0x9e, 0x84, 0x11, 0x3a, 0x9b, 0xfb, 0xe4, 0x60, 0x73, 0xb4, 0xd3, + 0xf2, 0xde, 0x68, 0x1c, 0x4f, 0x90, 0xde, 0x85, 0x5e, 0x16, 0x29, 0x0c, 0x67, 0x85, 0xb3, 0xd5, + 0xe9, 0xb5, 0xb5, 0xfc, 0xaa, 0xf0, 0xbe, 0x10, 0xb8, 0xae, 0x2f, 0x7e, 0x2e, 0x45, 0x4e, 0x27, + 0x60, 0xc7, 0x66, 0x62, 0x33, 0xd6, 0xf6, 0xa1, 0xef, 0xff, 0xbd, 0x14, 0xff, 0x2c, 0xdb, 0xe5, + 0x5c, 0xa3, 0xfe, 0xbc, 0x72, 0xad, 0x45, 0xe5, 0x92, 0xd3, 0xca, 0xb5, 0x82, 0x86, 0x45, 0x27, + 0xb0, 0xa5, 0x43, 0x38, 0x1b, 0x86, 0x79, 0xf8, 0x6f, 0x66, 0xbb, 0xaf, 0x16, 0xd7, 0xd0, 0xbc, + 0x6f, 0x04, 0xb6, 0xb5, 0x31, 0xe0, 0x26, 0xf5, 0x5a, 0xcd, 0xfe, 0x95, 0xc0, 0xde, 0x85, 0x7d, + 0xcc, 0xf5, 0x65, 0x42, 0x29, 0x21, 0xf3, 0xdf, 0x1b, 0xf2, 0x12, 0x68, 0xc9, 0xdf, 0xcf, 0xb8, + 0x42, 0x91, 0xa7, 0xe1, 0xea, 0xb2, 0x78, 0x75, 0xe5, 0xee, 0x06, 0xe7, 0x6a, 0xe7, 0xda, 0xec, + 0x96, 0xab, 0x7a, 0x42, 0xc7, 0xb0, 0x83, 0x51, 0x99, 0x72, 0x3c, 0xa7, 0x6d, 0x18, 0x1a, 0xab, + 0x2b, 0xb7, 0x3f, 0x31, 0x4a, 0x27, 0xa9, 0x8f, 0x17, 0x5a, 0xe2, 0xcd, 0x09, 0xdc, 0x6c, 0xcf, + 0x2c, 0xf2, 0xf4, 0x8a, 0xda, 0x7f, 0xb3, 0xd2, 0xfe, 0xe3, 0xff, 0x6b, 0xbf, 0xa3, 0xce, 0xce, + 0x8f, 0xf0, 0x9d, 0x00, 0x6d, 0xfb, 0x79, 0xb2, 0xce, 0x49, 0x82, 0x75, 0x4f, 0x32, 0xba, 0x37, + 0xff, 0xc9, 0xac, 0x79, 0xcd, 0xc8, 0xa2, 0x66, 0xe4, 0xa4, 0x66, 0xe4, 0x47, 0xcd, 0xc8, 0xa7, + 0x25, 0xb3, 0x16, 0x4b, 0x66, 0x9d, 0x2c, 0x99, 0xf5, 0xba, 0xd7, 0xc0, 0x8f, 0x6d, 0xf3, 0x97, + 0x7d, 0xf4, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x16, 0x76, 0x3f, 0x6f, 0xdf, 0x05, 0x00, 0x00, +} diff --git a/pkg/util/log/eventpb/cluster_events.proto b/pkg/util/log/eventpb/cluster_events.proto new file mode 100644 index 000000000000..8284730cbb69 --- /dev/null +++ b/pkg/util/log/eventpb/cluster_events.proto @@ -0,0 +1,87 @@ +// Copyright 2020 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. + +syntax = "proto3"; +package cockroach.util.log.eventpb; +option go_package = "eventpb"; + +import "gogoproto/gogo.proto"; +import "util/log/eventpb/events.proto"; + +// CommonNodeEventDetails contains the fields common to all +// node-level events. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +message CommonNodeEventDetails { + // The node ID where the event was originated. + int32 node_id = 1 [(gogoproto.customname) = "NodeID", (gogoproto.jsontag) = ",omitempty"]; + + // The time when this node was last started. + int64 started_at = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The approximate last time the node was up before the last restart. + int64 last_up = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// NodeJoin is recorded when a node joins the cluster. +message NodeJoin { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonNodeEventDetails node = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + +// NodeRestart is recorded when an existing node rejoins the cluster +// after being offline. +message NodeRestart { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonNodeEventDetails node = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + + +// CommonNodeDecommissionDetails contains the fields common to all +// node-level decommission/recommission events. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +message CommonNodeDecommissionDetails { + // The node ID where the event was originated. + int32 requesting_node_id = 1 [(gogoproto.customname) = "RequestingNodeID", (gogoproto.jsontag) = ",omitempty"]; + + // The node ID affected by the operation. + int32 target_node_id = 2 [(gogoproto.customname) = "TargetNodeID", (gogoproto.jsontag) = ",omitempty"]; +} + +// NodeDecommissioned is recorded when a node is marked as +// decommissioning. +message NodeDecommissioning { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonNodeDecommissionDetails node = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + +// NodeDecommissioned is recorded when a node is marked as +// decommissioned. +message NodeDecommissioned { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonNodeDecommissionDetails node = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + +// NodeRecommissioned is recorded when a decommissioning node is +// recommissioned. +message NodeRecommissioned { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonNodeDecommissionDetails node = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + + diff --git a/pkg/util/log/eventpb/ddl_events.pb.go b/pkg/util/log/eventpb/ddl_events.pb.go new file mode 100644 index 000000000000..c77235194ee9 --- /dev/null +++ b/pkg/util/log/eventpb/ddl_events.pb.go @@ -0,0 +1,12300 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: util/log/eventpb/ddl_events.proto + +package eventpb + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// CreateDatabase is recorded when a database is created. +type CreateDatabase struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the new database. + DatabaseName string `protobuf:"bytes,3,opt,name=database_name,json=databaseName,proto3" json:",omitempty"` +} + +func (m *CreateDatabase) Reset() { *m = CreateDatabase{} } +func (m *CreateDatabase) String() string { return proto.CompactTextString(m) } +func (*CreateDatabase) ProtoMessage() {} +func (*CreateDatabase) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{0} +} +func (m *CreateDatabase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateDatabase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateDatabase) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateDatabase.Merge(dst, src) +} +func (m *CreateDatabase) XXX_Size() int { + return m.Size() +} +func (m *CreateDatabase) XXX_DiscardUnknown() { + xxx_messageInfo_CreateDatabase.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateDatabase proto.InternalMessageInfo + +// DropDatabase is recorded when a database is dropped. +type DropDatabase struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected database. + DatabaseName string `protobuf:"bytes,3,opt,name=database_name,json=databaseName,proto3" json:",omitempty"` + // The names of the schemas dropped by a cascade operation. + DroppedSchemaObjects []string `protobuf:"bytes,4,rep,name=dropped_schema_objects,json=droppedSchemaObjects,proto3" json:",omitempty"` +} + +func (m *DropDatabase) Reset() { *m = DropDatabase{} } +func (m *DropDatabase) String() string { return proto.CompactTextString(m) } +func (*DropDatabase) ProtoMessage() {} +func (*DropDatabase) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{1} +} +func (m *DropDatabase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropDatabase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropDatabase) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropDatabase.Merge(dst, src) +} +func (m *DropDatabase) XXX_Size() int { + return m.Size() +} +func (m *DropDatabase) XXX_DiscardUnknown() { + xxx_messageInfo_DropDatabase.DiscardUnknown(m) +} + +var xxx_messageInfo_DropDatabase proto.InternalMessageInfo + +// RenameDatabase is recorded when a database is renamed. +type RenameDatabase struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The old name of the affected database. + DatabaseName string `protobuf:"bytes,3,opt,name=database_name,json=databaseName,proto3" json:",omitempty"` + // The new name of the affected database. + NewDatabaseName string `protobuf:"bytes,4,opt,name=new_database_name,json=newDatabaseName,proto3" json:",omitempty"` +} + +func (m *RenameDatabase) Reset() { *m = RenameDatabase{} } +func (m *RenameDatabase) String() string { return proto.CompactTextString(m) } +func (*RenameDatabase) ProtoMessage() {} +func (*RenameDatabase) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{2} +} +func (m *RenameDatabase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RenameDatabase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *RenameDatabase) XXX_Merge(src proto.Message) { + xxx_messageInfo_RenameDatabase.Merge(dst, src) +} +func (m *RenameDatabase) XXX_Size() int { + return m.Size() +} +func (m *RenameDatabase) XXX_DiscardUnknown() { + xxx_messageInfo_RenameDatabase.DiscardUnknown(m) +} + +var xxx_messageInfo_RenameDatabase proto.InternalMessageInfo + +// ConvertToSchema is recorded when a database is converted to a schema. +type ConvertToSchema struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the database being converted to a schema. + DatabaseName string `protobuf:"bytes,3,opt,name=database_name,json=databaseName,proto3" json:",omitempty"` + // The name of the parent database for the new schema. + NewDatabaseParent string `protobuf:"bytes,4,opt,name=new_database_parent,json=newDatabaseParent,proto3" json:",omitempty"` +} + +func (m *ConvertToSchema) Reset() { *m = ConvertToSchema{} } +func (m *ConvertToSchema) String() string { return proto.CompactTextString(m) } +func (*ConvertToSchema) ProtoMessage() {} +func (*ConvertToSchema) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{3} +} +func (m *ConvertToSchema) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConvertToSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *ConvertToSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConvertToSchema.Merge(dst, src) +} +func (m *ConvertToSchema) XXX_Size() int { + return m.Size() +} +func (m *ConvertToSchema) XXX_DiscardUnknown() { + xxx_messageInfo_ConvertToSchema.DiscardUnknown(m) +} + +var xxx_messageInfo_ConvertToSchema proto.InternalMessageInfo + +// AlterDatabaseOwner is recorded when a database's owner is changed. +type AlterDatabaseOwner struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the database being affected. + DatabaseName string `protobuf:"bytes,3,opt,name=database_name,json=databaseName,proto3" json:",omitempty"` + // The name of the new owner. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *AlterDatabaseOwner) Reset() { *m = AlterDatabaseOwner{} } +func (m *AlterDatabaseOwner) String() string { return proto.CompactTextString(m) } +func (*AlterDatabaseOwner) ProtoMessage() {} +func (*AlterDatabaseOwner) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{4} +} +func (m *AlterDatabaseOwner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterDatabaseOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterDatabaseOwner) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterDatabaseOwner.Merge(dst, src) +} +func (m *AlterDatabaseOwner) XXX_Size() int { + return m.Size() +} +func (m *AlterDatabaseOwner) XXX_DiscardUnknown() { + xxx_messageInfo_AlterDatabaseOwner.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterDatabaseOwner proto.InternalMessageInfo + +// CreateSchema is recorded when a schema is created. +type CreateSchema struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the new schema. + SchemaName string `protobuf:"bytes,3,opt,name=schema_name,json=schemaName,proto3" json:",omitempty"` + // The name of the owner for the new schema. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *CreateSchema) Reset() { *m = CreateSchema{} } +func (m *CreateSchema) String() string { return proto.CompactTextString(m) } +func (*CreateSchema) ProtoMessage() {} +func (*CreateSchema) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{5} +} +func (m *CreateSchema) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateSchema.Merge(dst, src) +} +func (m *CreateSchema) XXX_Size() int { + return m.Size() +} +func (m *CreateSchema) XXX_DiscardUnknown() { + xxx_messageInfo_CreateSchema.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateSchema proto.InternalMessageInfo + +// DropSchema is recorded when a schema is dropped. +type DropSchema struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected schema. + SchemaName string `protobuf:"bytes,3,opt,name=schema_name,json=schemaName,proto3" json:",omitempty"` +} + +func (m *DropSchema) Reset() { *m = DropSchema{} } +func (m *DropSchema) String() string { return proto.CompactTextString(m) } +func (*DropSchema) ProtoMessage() {} +func (*DropSchema) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{6} +} +func (m *DropSchema) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropSchema.Merge(dst, src) +} +func (m *DropSchema) XXX_Size() int { + return m.Size() +} +func (m *DropSchema) XXX_DiscardUnknown() { + xxx_messageInfo_DropSchema.DiscardUnknown(m) +} + +var xxx_messageInfo_DropSchema proto.InternalMessageInfo + +// RenameSchema is recorded when a schema is renamed. +type RenameSchema struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The old name of the affected schema. + SchemaName string `protobuf:"bytes,3,opt,name=schema_name,json=schemaName,proto3" json:",omitempty"` + // The new name of the affected schema. + NewSchemaName string `protobuf:"bytes,4,opt,name=new_schema_name,json=newSchemaName,proto3" json:",omitempty"` +} + +func (m *RenameSchema) Reset() { *m = RenameSchema{} } +func (m *RenameSchema) String() string { return proto.CompactTextString(m) } +func (*RenameSchema) ProtoMessage() {} +func (*RenameSchema) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{7} +} +func (m *RenameSchema) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RenameSchema) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *RenameSchema) XXX_Merge(src proto.Message) { + xxx_messageInfo_RenameSchema.Merge(dst, src) +} +func (m *RenameSchema) XXX_Size() int { + return m.Size() +} +func (m *RenameSchema) XXX_DiscardUnknown() { + xxx_messageInfo_RenameSchema.DiscardUnknown(m) +} + +var xxx_messageInfo_RenameSchema proto.InternalMessageInfo + +// AlterSchemaOwner is recorded when a schema's owner is changed. +type AlterSchemaOwner struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected schema. + SchemaName string `protobuf:"bytes,3,opt,name=schema_name,json=schemaName,proto3" json:",omitempty"` + // The name of the new owner. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *AlterSchemaOwner) Reset() { *m = AlterSchemaOwner{} } +func (m *AlterSchemaOwner) String() string { return proto.CompactTextString(m) } +func (*AlterSchemaOwner) ProtoMessage() {} +func (*AlterSchemaOwner) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{8} +} +func (m *AlterSchemaOwner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterSchemaOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterSchemaOwner) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterSchemaOwner.Merge(dst, src) +} +func (m *AlterSchemaOwner) XXX_Size() int { + return m.Size() +} +func (m *AlterSchemaOwner) XXX_DiscardUnknown() { + xxx_messageInfo_AlterSchemaOwner.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterSchemaOwner proto.InternalMessageInfo + +// CreateTable is recorded when a table is created. +type CreateTable struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the new table. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The name of the owner for the new table. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *CreateTable) Reset() { *m = CreateTable{} } +func (m *CreateTable) String() string { return proto.CompactTextString(m) } +func (*CreateTable) ProtoMessage() {} +func (*CreateTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{9} +} +func (m *CreateTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateTable.Merge(dst, src) +} +func (m *CreateTable) XXX_Size() int { + return m.Size() +} +func (m *CreateTable) XXX_DiscardUnknown() { + xxx_messageInfo_CreateTable.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateTable proto.InternalMessageInfo + +// DropTable is recorded when a table is dropped. +type DropTable struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected table. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The names of the views dropped as a result of a cascade operation. + CascadeDroppedViews []string `protobuf:"bytes,4,rep,name=cascade_dropped_views,json=cascadeDroppedViews,proto3" json:",omitempty"` +} + +func (m *DropTable) Reset() { *m = DropTable{} } +func (m *DropTable) String() string { return proto.CompactTextString(m) } +func (*DropTable) ProtoMessage() {} +func (*DropTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{10} +} +func (m *DropTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropTable.Merge(dst, src) +} +func (m *DropTable) XXX_Size() int { + return m.Size() +} +func (m *DropTable) XXX_DiscardUnknown() { + xxx_messageInfo_DropTable.DiscardUnknown(m) +} + +var xxx_messageInfo_DropTable proto.InternalMessageInfo + +// RenameTable is recorded when a table, sequence or view is renamed. +type RenameTable struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The old name of the affected table. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The new name of the affected table. + NewTableName string `protobuf:"bytes,4,opt,name=new_table_name,json=newTableName,proto3" json:",omitempty"` +} + +func (m *RenameTable) Reset() { *m = RenameTable{} } +func (m *RenameTable) String() string { return proto.CompactTextString(m) } +func (*RenameTable) ProtoMessage() {} +func (*RenameTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{11} +} +func (m *RenameTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RenameTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *RenameTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_RenameTable.Merge(dst, src) +} +func (m *RenameTable) XXX_Size() int { + return m.Size() +} +func (m *RenameTable) XXX_DiscardUnknown() { + xxx_messageInfo_RenameTable.DiscardUnknown(m) +} + +var xxx_messageInfo_RenameTable proto.InternalMessageInfo + +// TruncateTable is recorded when a table is truncated. +type TruncateTable struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected table. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` +} + +func (m *TruncateTable) Reset() { *m = TruncateTable{} } +func (m *TruncateTable) String() string { return proto.CompactTextString(m) } +func (*TruncateTable) ProtoMessage() {} +func (*TruncateTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{12} +} +func (m *TruncateTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TruncateTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *TruncateTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_TruncateTable.Merge(dst, src) +} +func (m *TruncateTable) XXX_Size() int { + return m.Size() +} +func (m *TruncateTable) XXX_DiscardUnknown() { + xxx_messageInfo_TruncateTable.DiscardUnknown(m) +} + +var xxx_messageInfo_TruncateTable proto.InternalMessageInfo + +// AlterTable is recorded when a table is altered. +type AlterTable struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected table. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The mutation ID for the asynchronous job that is processing the index update, if any. + MutationID uint32 `protobuf:"varint,4,opt,name=mutation_id,json=mutationId,proto3" json:",omitempty"` + // The names of the views dropped as a result of a cascade operation. + CascadeDroppedViews []string `protobuf:"bytes,5,rep,name=cascade_dropped_views,json=cascadeDroppedViews,proto3" json:",omitempty"` +} + +func (m *AlterTable) Reset() { *m = AlterTable{} } +func (m *AlterTable) String() string { return proto.CompactTextString(m) } +func (*AlterTable) ProtoMessage() {} +func (*AlterTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{13} +} +func (m *AlterTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterTable.Merge(dst, src) +} +func (m *AlterTable) XXX_Size() int { + return m.Size() +} +func (m *AlterTable) XXX_DiscardUnknown() { + xxx_messageInfo_AlterTable.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterTable proto.InternalMessageInfo + +// CommentOnColumn is recorded when a column is commented. +type CommentOnColumn struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the table containing the affected column. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The affected column. + ColumnName string `protobuf:"bytes,4,opt,name=column_name,json=columnName,proto3" json:",omitempty"` + // The new comment. + Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:",omitempty"` + // Set to true if the comment was removed entirely. + NullComment bool `protobuf:"varint,6,opt,name=null_comment,json=nullComment,proto3" json:",omitempty"` +} + +func (m *CommentOnColumn) Reset() { *m = CommentOnColumn{} } +func (m *CommentOnColumn) String() string { return proto.CompactTextString(m) } +func (*CommentOnColumn) ProtoMessage() {} +func (*CommentOnColumn) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{14} +} +func (m *CommentOnColumn) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommentOnColumn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommentOnColumn) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommentOnColumn.Merge(dst, src) +} +func (m *CommentOnColumn) XXX_Size() int { + return m.Size() +} +func (m *CommentOnColumn) XXX_DiscardUnknown() { + xxx_messageInfo_CommentOnColumn.DiscardUnknown(m) +} + +var xxx_messageInfo_CommentOnColumn proto.InternalMessageInfo + +// CommentOnTable is recorded when a database is commented. +type CommentOnDatabase struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected database. + DatabaseName string `protobuf:"bytes,3,opt,name=database_name,json=databaseName,proto3" json:",omitempty"` + // The new comment. + Comment string `protobuf:"bytes,4,opt,name=comment,proto3" json:",omitempty"` + // Set to true if the comment was removed entirely. + NullComment bool `protobuf:"varint,6,opt,name=null_comment,json=nullComment,proto3" json:",omitempty"` +} + +func (m *CommentOnDatabase) Reset() { *m = CommentOnDatabase{} } +func (m *CommentOnDatabase) String() string { return proto.CompactTextString(m) } +func (*CommentOnDatabase) ProtoMessage() {} +func (*CommentOnDatabase) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{15} +} +func (m *CommentOnDatabase) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommentOnDatabase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommentOnDatabase) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommentOnDatabase.Merge(dst, src) +} +func (m *CommentOnDatabase) XXX_Size() int { + return m.Size() +} +func (m *CommentOnDatabase) XXX_DiscardUnknown() { + xxx_messageInfo_CommentOnDatabase.DiscardUnknown(m) +} + +var xxx_messageInfo_CommentOnDatabase proto.InternalMessageInfo + +// CommentOnTable is recorded when a table is commented. +type CommentOnTable struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected table. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The new comment. + Comment string `protobuf:"bytes,4,opt,name=comment,proto3" json:",omitempty"` + // Set to true if the comment was removed entirely. + NullComment bool `protobuf:"varint,6,opt,name=null_comment,json=nullComment,proto3" json:",omitempty"` +} + +func (m *CommentOnTable) Reset() { *m = CommentOnTable{} } +func (m *CommentOnTable) String() string { return proto.CompactTextString(m) } +func (*CommentOnTable) ProtoMessage() {} +func (*CommentOnTable) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{16} +} +func (m *CommentOnTable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommentOnTable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommentOnTable) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommentOnTable.Merge(dst, src) +} +func (m *CommentOnTable) XXX_Size() int { + return m.Size() +} +func (m *CommentOnTable) XXX_DiscardUnknown() { + xxx_messageInfo_CommentOnTable.DiscardUnknown(m) +} + +var xxx_messageInfo_CommentOnTable proto.InternalMessageInfo + +// CommentOnIndex is recorded when an index is commented. +type CommentOnIndex struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the table containing the affected index. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The name of the affected index. + IndexName string `protobuf:"bytes,4,opt,name=index_name,json=indexName,proto3" json:",omitempty"` + // The new comment. + Comment string `protobuf:"bytes,5,opt,name=comment,proto3" json:",omitempty"` + // Set to true if the comment was removed entirely. + NullComment bool `protobuf:"varint,6,opt,name=null_comment,json=nullComment,proto3" json:",omitempty"` +} + +func (m *CommentOnIndex) Reset() { *m = CommentOnIndex{} } +func (m *CommentOnIndex) String() string { return proto.CompactTextString(m) } +func (*CommentOnIndex) ProtoMessage() {} +func (*CommentOnIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{17} +} +func (m *CommentOnIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommentOnIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommentOnIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommentOnIndex.Merge(dst, src) +} +func (m *CommentOnIndex) XXX_Size() int { + return m.Size() +} +func (m *CommentOnIndex) XXX_DiscardUnknown() { + xxx_messageInfo_CommentOnIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_CommentOnIndex proto.InternalMessageInfo + +// CreateIndex is recorded when an index is created. +type CreateIndex struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the table containing the new index. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The name of the new index. + IndexName string `protobuf:"bytes,4,opt,name=index_name,json=indexName,proto3" json:",omitempty"` + // The mutation ID for the asynchronous job that is processing the index update. + MutationID uint32 `protobuf:"varint,5,opt,name=mutation_id,json=mutationId,proto3" json:",omitempty"` +} + +func (m *CreateIndex) Reset() { *m = CreateIndex{} } +func (m *CreateIndex) String() string { return proto.CompactTextString(m) } +func (*CreateIndex) ProtoMessage() {} +func (*CreateIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{18} +} +func (m *CreateIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateIndex.Merge(dst, src) +} +func (m *CreateIndex) XXX_Size() int { + return m.Size() +} +func (m *CreateIndex) XXX_DiscardUnknown() { + xxx_messageInfo_CreateIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateIndex proto.InternalMessageInfo + +// DropIndex is recorded when an index is dropped. +type DropIndex struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the table containing the affected index. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The name of the affected index. + IndexName string `protobuf:"bytes,4,opt,name=index_name,json=indexName,proto3" json:",omitempty"` + // The mutation ID for the asynchronous job that is processing the index update. + MutationID uint32 `protobuf:"varint,5,opt,name=mutation_id,json=mutationId,proto3" json:",omitempty"` + // The names of the views dropped as a result of a cascade operation. + CascadeDroppedViews []string `protobuf:"bytes,6,rep,name=cascade_dropped_views,json=cascadeDroppedViews,proto3" json:"cascade_dropped_views,omitempty"` +} + +func (m *DropIndex) Reset() { *m = DropIndex{} } +func (m *DropIndex) String() string { return proto.CompactTextString(m) } +func (*DropIndex) ProtoMessage() {} +func (*DropIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{19} +} +func (m *DropIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropIndex.Merge(dst, src) +} +func (m *DropIndex) XXX_Size() int { + return m.Size() +} +func (m *DropIndex) XXX_DiscardUnknown() { + xxx_messageInfo_DropIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_DropIndex proto.InternalMessageInfo + +// AlterIndex is recorded when an index is altered. +type AlterIndex struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the table containing the affected index. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` + // The name of the affected index. + IndexName string `protobuf:"bytes,4,opt,name=index_name,json=indexName,proto3" json:",omitempty"` + // The mutation ID for the asynchronous job that is processing the index update. + MutationID uint32 `protobuf:"varint,5,opt,name=mutation_id,json=mutationId,proto3" json:",omitempty"` +} + +func (m *AlterIndex) Reset() { *m = AlterIndex{} } +func (m *AlterIndex) String() string { return proto.CompactTextString(m) } +func (*AlterIndex) ProtoMessage() {} +func (*AlterIndex) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{20} +} +func (m *AlterIndex) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterIndex) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterIndex.Merge(dst, src) +} +func (m *AlterIndex) XXX_Size() int { + return m.Size() +} +func (m *AlterIndex) XXX_DiscardUnknown() { + xxx_messageInfo_AlterIndex.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterIndex proto.InternalMessageInfo + +// CreateView is recorded when a view is created. +type CreateView struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the new view. + ViewName string `protobuf:"bytes,3,opt,name=view_name,json=viewName,proto3" json:",omitempty"` + // The name of the owner of the new view. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` + // The SQL selection clause used to define the view. + ViewQuery string `protobuf:"bytes,5,opt,name=view_query,json=viewQuery,proto3" json:",omitempty"` +} + +func (m *CreateView) Reset() { *m = CreateView{} } +func (m *CreateView) String() string { return proto.CompactTextString(m) } +func (*CreateView) ProtoMessage() {} +func (*CreateView) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{21} +} +func (m *CreateView) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateView) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateView) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateView.Merge(dst, src) +} +func (m *CreateView) XXX_Size() int { + return m.Size() +} +func (m *CreateView) XXX_DiscardUnknown() { + xxx_messageInfo_CreateView.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateView proto.InternalMessageInfo + +// DropView is recorded when a view is dropped. +type DropView struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected view. + ViewName string `protobuf:"bytes,3,opt,name=view_name,json=viewName,proto3" json:",omitempty"` + // The names of the views dropped as a result of a cascade operation. + CascadeDroppedViews []string `protobuf:"bytes,4,rep,name=cascade_dropped_views,json=cascadeDroppedViews,proto3" json:",omitempty"` +} + +func (m *DropView) Reset() { *m = DropView{} } +func (m *DropView) String() string { return proto.CompactTextString(m) } +func (*DropView) ProtoMessage() {} +func (*DropView) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{22} +} +func (m *DropView) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropView) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropView) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropView.Merge(dst, src) +} +func (m *DropView) XXX_Size() int { + return m.Size() +} +func (m *DropView) XXX_DiscardUnknown() { + xxx_messageInfo_DropView.DiscardUnknown(m) +} + +var xxx_messageInfo_DropView proto.InternalMessageInfo + +// CreateSequence is recorded when a sequence is created. +type CreateSequence struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the new sequence. + SequenceName string `protobuf:"bytes,3,opt,name=sequence_name,json=sequenceName,proto3" json:",omitempty"` + // The name of the owner for the new sequence. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *CreateSequence) Reset() { *m = CreateSequence{} } +func (m *CreateSequence) String() string { return proto.CompactTextString(m) } +func (*CreateSequence) ProtoMessage() {} +func (*CreateSequence) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{23} +} +func (m *CreateSequence) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateSequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateSequence) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateSequence.Merge(dst, src) +} +func (m *CreateSequence) XXX_Size() int { + return m.Size() +} +func (m *CreateSequence) XXX_DiscardUnknown() { + xxx_messageInfo_CreateSequence.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateSequence proto.InternalMessageInfo + +// DropSequence is recorded when a sequence is dropped. +type DropSequence struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected sequence. + SequenceName string `protobuf:"bytes,3,opt,name=sequence_name,json=sequenceName,proto3" json:",omitempty"` +} + +func (m *DropSequence) Reset() { *m = DropSequence{} } +func (m *DropSequence) String() string { return proto.CompactTextString(m) } +func (*DropSequence) ProtoMessage() {} +func (*DropSequence) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{24} +} +func (m *DropSequence) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropSequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropSequence) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropSequence.Merge(dst, src) +} +func (m *DropSequence) XXX_Size() int { + return m.Size() +} +func (m *DropSequence) XXX_DiscardUnknown() { + xxx_messageInfo_DropSequence.DiscardUnknown(m) +} + +var xxx_messageInfo_DropSequence proto.InternalMessageInfo + +// AlterSequence is recorded when a sequence is altered. +type AlterSequence struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected sequence. + SequenceName string `protobuf:"bytes,3,opt,name=sequence_name,json=sequenceName,proto3" json:",omitempty"` +} + +func (m *AlterSequence) Reset() { *m = AlterSequence{} } +func (m *AlterSequence) String() string { return proto.CompactTextString(m) } +func (*AlterSequence) ProtoMessage() {} +func (*AlterSequence) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{25} +} +func (m *AlterSequence) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterSequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterSequence) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterSequence.Merge(dst, src) +} +func (m *AlterSequence) XXX_Size() int { + return m.Size() +} +func (m *AlterSequence) XXX_DiscardUnknown() { + xxx_messageInfo_AlterSequence.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterSequence proto.InternalMessageInfo + +// CommonSchemaChangeDetails contains the fields common to all +// background schema changes. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +type CommonSchemaChangeEventDetails struct { + // The instance ID (not tenant ID) of the SQL server where the event + // was originated. + InstanceID int32 `protobuf:"varint,1,opt,name=instance_id,json=instanceId,proto3" json:",omitempty"` + // The primary object descriptor affected by the operation. Set to + // zero for operations that don't affect descriptors. + DescriptorID uint32 `protobuf:"varint,2,opt,name=descriptor_id,json=descriptorId,proto3" json:",omitempty"` + // The descriptor mutation that this schema change was processing. + MutationID uint32 `protobuf:"varint,3,opt,name=mutation_id,json=mutationId,proto3" json:",omitempty"` +} + +func (m *CommonSchemaChangeEventDetails) Reset() { *m = CommonSchemaChangeEventDetails{} } +func (m *CommonSchemaChangeEventDetails) String() string { return proto.CompactTextString(m) } +func (*CommonSchemaChangeEventDetails) ProtoMessage() {} +func (*CommonSchemaChangeEventDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{26} +} +func (m *CommonSchemaChangeEventDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonSchemaChangeEventDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommonSchemaChangeEventDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonSchemaChangeEventDetails.Merge(dst, src) +} +func (m *CommonSchemaChangeEventDetails) XXX_Size() int { + return m.Size() +} +func (m *CommonSchemaChangeEventDetails) XXX_DiscardUnknown() { + xxx_messageInfo_CommonSchemaChangeEventDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonSchemaChangeEventDetails proto.InternalMessageInfo + +// ReverseSchemaChange is recorded when an in-progress schema change +// encounters a problem and is reversed. +type ReverseSchemaChange struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSchemaChangeEventDetails `protobuf:"bytes,2,opt,name=sc,proto3,embedded=sc" json:""` + // The error encountered that caused the schema change to be reversed. + // The specific format of the error is variable and can change across releases without warning. + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:",omitempty"` + // The SQLSTATE code for the error. + SQLSTATE string `protobuf:"bytes,5,opt,name=sqlstate,proto3" json:",omitempty"` +} + +func (m *ReverseSchemaChange) Reset() { *m = ReverseSchemaChange{} } +func (m *ReverseSchemaChange) String() string { return proto.CompactTextString(m) } +func (*ReverseSchemaChange) ProtoMessage() {} +func (*ReverseSchemaChange) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{27} +} +func (m *ReverseSchemaChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ReverseSchemaChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *ReverseSchemaChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReverseSchemaChange.Merge(dst, src) +} +func (m *ReverseSchemaChange) XXX_Size() int { + return m.Size() +} +func (m *ReverseSchemaChange) XXX_DiscardUnknown() { + xxx_messageInfo_ReverseSchemaChange.DiscardUnknown(m) +} + +var xxx_messageInfo_ReverseSchemaChange proto.InternalMessageInfo + +// FinishSchemaChange is recorded when a previously initiated schema +// change has completed. +type FinishSchemaChange struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSchemaChangeEventDetails `protobuf:"bytes,2,opt,name=sc,proto3,embedded=sc" json:""` +} + +func (m *FinishSchemaChange) Reset() { *m = FinishSchemaChange{} } +func (m *FinishSchemaChange) String() string { return proto.CompactTextString(m) } +func (*FinishSchemaChange) ProtoMessage() {} +func (*FinishSchemaChange) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{28} +} +func (m *FinishSchemaChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinishSchemaChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *FinishSchemaChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinishSchemaChange.Merge(dst, src) +} +func (m *FinishSchemaChange) XXX_Size() int { + return m.Size() +} +func (m *FinishSchemaChange) XXX_DiscardUnknown() { + xxx_messageInfo_FinishSchemaChange.DiscardUnknown(m) +} + +var xxx_messageInfo_FinishSchemaChange proto.InternalMessageInfo + +// FinishSchemaChangeRollback is recorded when a previously +// initiated schema change rollback has completed. +type FinishSchemaChangeRollback struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSchemaChangeEventDetails `protobuf:"bytes,2,opt,name=sc,proto3,embedded=sc" json:""` +} + +func (m *FinishSchemaChangeRollback) Reset() { *m = FinishSchemaChangeRollback{} } +func (m *FinishSchemaChangeRollback) String() string { return proto.CompactTextString(m) } +func (*FinishSchemaChangeRollback) ProtoMessage() {} +func (*FinishSchemaChangeRollback) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{29} +} +func (m *FinishSchemaChangeRollback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinishSchemaChangeRollback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *FinishSchemaChangeRollback) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinishSchemaChangeRollback.Merge(dst, src) +} +func (m *FinishSchemaChangeRollback) XXX_Size() int { + return m.Size() +} +func (m *FinishSchemaChangeRollback) XXX_DiscardUnknown() { + xxx_messageInfo_FinishSchemaChangeRollback.DiscardUnknown(m) +} + +var xxx_messageInfo_FinishSchemaChangeRollback proto.InternalMessageInfo + +// CreateType is recorded when a user-defined type is created. +type CreateType struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the new type. + TypeName string `protobuf:"bytes,4,opt,name=type_name,json=typeName,proto3" json:",omitempty"` + // The name of the owner for the new type. + Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *CreateType) Reset() { *m = CreateType{} } +func (m *CreateType) String() string { return proto.CompactTextString(m) } +func (*CreateType) ProtoMessage() {} +func (*CreateType) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{30} +} +func (m *CreateType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateType) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateType.Merge(dst, src) +} +func (m *CreateType) XXX_Size() int { + return m.Size() +} +func (m *CreateType) XXX_DiscardUnknown() { + xxx_messageInfo_CreateType.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateType proto.InternalMessageInfo + +// DropType is recorded when a user-defined type is dropped. +type DropType struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected type. + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:",omitempty"` +} + +func (m *DropType) Reset() { *m = DropType{} } +func (m *DropType) String() string { return proto.CompactTextString(m) } +func (*DropType) ProtoMessage() {} +func (*DropType) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{31} +} +func (m *DropType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DropType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *DropType) XXX_Merge(src proto.Message) { + xxx_messageInfo_DropType.Merge(dst, src) +} +func (m *DropType) XXX_Size() int { + return m.Size() +} +func (m *DropType) XXX_DiscardUnknown() { + xxx_messageInfo_DropType.DiscardUnknown(m) +} + +var xxx_messageInfo_DropType proto.InternalMessageInfo + +// EventAlterType is recorded when a user-defined type is altered. +type AlterType struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected type. + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:",omitempty"` +} + +func (m *AlterType) Reset() { *m = AlterType{} } +func (m *AlterType) String() string { return proto.CompactTextString(m) } +func (*AlterType) ProtoMessage() {} +func (*AlterType) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{32} +} +func (m *AlterType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterType) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterType.Merge(dst, src) +} +func (m *AlterType) XXX_Size() int { + return m.Size() +} +func (m *AlterType) XXX_DiscardUnknown() { + xxx_messageInfo_AlterType.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterType proto.InternalMessageInfo + +// AlterTypeOwner is recorded when the owner of a user-defiend type is changed. +type AlterTypeOwner struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the affected type. + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:",omitempty"` + // The name of the new owner. + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:",omitempty"` +} + +func (m *AlterTypeOwner) Reset() { *m = AlterTypeOwner{} } +func (m *AlterTypeOwner) String() string { return proto.CompactTextString(m) } +func (*AlterTypeOwner) ProtoMessage() {} +func (*AlterTypeOwner) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{33} +} +func (m *AlterTypeOwner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AlterTypeOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *AlterTypeOwner) XXX_Merge(src proto.Message) { + xxx_messageInfo_AlterTypeOwner.Merge(dst, src) +} +func (m *AlterTypeOwner) XXX_Size() int { + return m.Size() +} +func (m *AlterTypeOwner) XXX_DiscardUnknown() { + xxx_messageInfo_AlterTypeOwner.DiscardUnknown(m) +} + +var xxx_messageInfo_AlterTypeOwner proto.InternalMessageInfo + +// RenameType is recorded when a user-defined type is renamed. +type RenameType struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The old name of the affected type. + TypeName string `protobuf:"bytes,3,opt,name=type_name,json=typeName,proto3" json:",omitempty"` + // The new name of the affected type. + NewTypeName string `protobuf:"bytes,4,opt,name=new_type_name,json=newTypeName,proto3" json:",omitempty"` +} + +func (m *RenameType) Reset() { *m = RenameType{} } +func (m *RenameType) String() string { return proto.CompactTextString(m) } +func (*RenameType) ProtoMessage() {} +func (*RenameType) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{34} +} +func (m *RenameType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RenameType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *RenameType) XXX_Merge(src proto.Message) { + xxx_messageInfo_RenameType.Merge(dst, src) +} +func (m *RenameType) XXX_Size() int { + return m.Size() +} +func (m *RenameType) XXX_DiscardUnknown() { + xxx_messageInfo_RenameType.DiscardUnknown(m) +} + +var xxx_messageInfo_RenameType proto.InternalMessageInfo + +// CommonZoneConfigDetails is common to zone config change events. +type CommonZoneConfigDetails struct { + // The target object of the zone config change. + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:",omitempty"` + // The applied zone config in YAML format. + Config string `protobuf:"bytes,2,opt,name=config,proto3" json:",omitempty"` + // The SQL representation of the applied zone config options. + Options []string `protobuf:"bytes,3,rep,name=options,proto3" json:",omitempty"` +} + +func (m *CommonZoneConfigDetails) Reset() { *m = CommonZoneConfigDetails{} } +func (m *CommonZoneConfigDetails) String() string { return proto.CompactTextString(m) } +func (*CommonZoneConfigDetails) ProtoMessage() {} +func (*CommonZoneConfigDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{35} +} +func (m *CommonZoneConfigDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonZoneConfigDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommonZoneConfigDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonZoneConfigDetails.Merge(dst, src) +} +func (m *CommonZoneConfigDetails) XXX_Size() int { + return m.Size() +} +func (m *CommonZoneConfigDetails) XXX_DiscardUnknown() { + xxx_messageInfo_CommonZoneConfigDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonZoneConfigDetails proto.InternalMessageInfo + +// SetZoneConfig is recorded when a zone config is changed. +type SetZoneConfig struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + CommonZoneConfigDetails `protobuf:"bytes,3,opt,name=config,proto3,embedded=config" json:""` +} + +func (m *SetZoneConfig) Reset() { *m = SetZoneConfig{} } +func (m *SetZoneConfig) String() string { return proto.CompactTextString(m) } +func (*SetZoneConfig) ProtoMessage() {} +func (*SetZoneConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{36} +} +func (m *SetZoneConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SetZoneConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *SetZoneConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetZoneConfig.Merge(dst, src) +} +func (m *SetZoneConfig) XXX_Size() int { + return m.Size() +} +func (m *SetZoneConfig) XXX_DiscardUnknown() { + xxx_messageInfo_SetZoneConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_SetZoneConfig proto.InternalMessageInfo + +// RemoveZoneConfig is recorded when a zone config is removed. +type RemoveZoneConfig struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + CommonZoneConfigDetails `protobuf:"bytes,3,opt,name=config,proto3,embedded=config" json:""` +} + +func (m *RemoveZoneConfig) Reset() { *m = RemoveZoneConfig{} } +func (m *RemoveZoneConfig) String() string { return proto.CompactTextString(m) } +func (*RemoveZoneConfig) ProtoMessage() {} +func (*RemoveZoneConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{37} +} +func (m *RemoveZoneConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RemoveZoneConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *RemoveZoneConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_RemoveZoneConfig.Merge(dst, src) +} +func (m *RemoveZoneConfig) XXX_Size() int { + return m.Size() +} +func (m *RemoveZoneConfig) XXX_DiscardUnknown() { + xxx_messageInfo_RemoveZoneConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_RemoveZoneConfig proto.InternalMessageInfo + +// CreateStatistics is recorded when statistics are collected for a +// table. +type CreateStatistics struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + // The name of the table for which the statistics were created. + TableName string `protobuf:"bytes,3,opt,name=table_name,json=tableName,proto3" json:",omitempty"` +} + +func (m *CreateStatistics) Reset() { *m = CreateStatistics{} } +func (m *CreateStatistics) String() string { return proto.CompactTextString(m) } +func (*CreateStatistics) ProtoMessage() {} +func (*CreateStatistics) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{38} +} +func (m *CreateStatistics) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CreateStatistics) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CreateStatistics) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateStatistics.Merge(dst, src) +} +func (m *CreateStatistics) XXX_Size() int { + return m.Size() +} +func (m *CreateStatistics) XXX_DiscardUnknown() { + xxx_messageInfo_CreateStatistics.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateStatistics proto.InternalMessageInfo + +// UnsafeUpsertDescriptor is recorded when a descriptor is written +// using crdb_internal.unsafe_upsert_descriptor(). +type UnsafeUpsertDescriptor struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + PreviousDescriptor string `protobuf:"bytes,3,opt,name=previous_descriptor,json=previousDescriptor,proto3" json:",omitempty"` + NewDescriptor string `protobuf:"bytes,4,opt,name=new_descriptor,json=newDescriptor,proto3" json:",omitempty"` + Force bool `protobuf:"varint,5,opt,name=force,proto3" json:",omitempty"` + ForceNotice string `protobuf:"bytes,6,opt,name=force_notice,json=forceNotice,proto3" json:",omitempty"` +} + +func (m *UnsafeUpsertDescriptor) Reset() { *m = UnsafeUpsertDescriptor{} } +func (m *UnsafeUpsertDescriptor) String() string { return proto.CompactTextString(m) } +func (*UnsafeUpsertDescriptor) ProtoMessage() {} +func (*UnsafeUpsertDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{39} +} +func (m *UnsafeUpsertDescriptor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnsafeUpsertDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *UnsafeUpsertDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnsafeUpsertDescriptor.Merge(dst, src) +} +func (m *UnsafeUpsertDescriptor) XXX_Size() int { + return m.Size() +} +func (m *UnsafeUpsertDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_UnsafeUpsertDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_UnsafeUpsertDescriptor proto.InternalMessageInfo + +// UnsafeDeleteDescriptor is recorded when a descriptor is written +// using crdb_internal.unsafe_delete_descriptor(). +// +// The fields of this event type are reserved and can change across +// patch releases without advance notice. +type UnsafeDeleteDescriptor struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + ParentID uint32 `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:",omitempty"` + ParentSchemaID uint32 `protobuf:"varint,4,opt,name=parent_schema_id,json=parentSchemaId,proto3" json:",omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:",omitempty"` + Force bool `protobuf:"varint,6,opt,name=force,proto3" json:",omitempty"` + ForceNotice string `protobuf:"bytes,7,opt,name=force_notice,json=forceNotice,proto3" json:",omitempty"` +} + +func (m *UnsafeDeleteDescriptor) Reset() { *m = UnsafeDeleteDescriptor{} } +func (m *UnsafeDeleteDescriptor) String() string { return proto.CompactTextString(m) } +func (*UnsafeDeleteDescriptor) ProtoMessage() {} +func (*UnsafeDeleteDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{40} +} +func (m *UnsafeDeleteDescriptor) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnsafeDeleteDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *UnsafeDeleteDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnsafeDeleteDescriptor.Merge(dst, src) +} +func (m *UnsafeDeleteDescriptor) XXX_Size() int { + return m.Size() +} +func (m *UnsafeDeleteDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_UnsafeDeleteDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_UnsafeDeleteDescriptor proto.InternalMessageInfo + +// UnsafeUpsertNamespaceEntry is recorded when a namespace entry is +// written using crdb_internal.unsafe_upsert_namespace_entry(). +// +// The fields of this event type are reserved and can change across +// patch releases without advance notice. +type UnsafeUpsertNamespaceEntry struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + ParentID uint32 `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:",omitempty"` + ParentSchemaID uint32 `protobuf:"varint,4,opt,name=parent_schema_id,json=parentSchemaId,proto3" json:",omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:",omitempty"` + PreviousID uint32 `protobuf:"varint,6,opt,name=previous_id,json=previousId,proto3" json:",omitempty"` + Force bool `protobuf:"varint,7,opt,name=force,proto3" json:",omitempty"` + FailedValidation bool `protobuf:"varint,8,opt,name=failed_validation,json=failedValidation,proto3" json:",omitempty"` + ValidationErrors string `protobuf:"bytes,9,opt,name=validation_errors,json=validationErrors,proto3" json:",omitempty"` +} + +func (m *UnsafeUpsertNamespaceEntry) Reset() { *m = UnsafeUpsertNamespaceEntry{} } +func (m *UnsafeUpsertNamespaceEntry) String() string { return proto.CompactTextString(m) } +func (*UnsafeUpsertNamespaceEntry) ProtoMessage() {} +func (*UnsafeUpsertNamespaceEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{41} +} +func (m *UnsafeUpsertNamespaceEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnsafeUpsertNamespaceEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *UnsafeUpsertNamespaceEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnsafeUpsertNamespaceEntry.Merge(dst, src) +} +func (m *UnsafeUpsertNamespaceEntry) XXX_Size() int { + return m.Size() +} +func (m *UnsafeUpsertNamespaceEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UnsafeUpsertNamespaceEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UnsafeUpsertNamespaceEntry proto.InternalMessageInfo + +// UnsafeDeleteNamespaceEntry is recorded when a namespace entry is +// written using crdb_internal.unsafe_delete_namespace_entry(). +// +// The fields of this event type are reserved and can change across +// patch releases without advance notice. +type UnsafeDeleteNamespaceEntry struct { + CommonEventDetails `protobuf:"bytes,1,opt,name=common,proto3,embedded=common" json:""` + CommonSQLEventDetails `protobuf:"bytes,2,opt,name=sql,proto3,embedded=sql" json:""` + ParentID uint32 `protobuf:"varint,3,opt,name=parent_id,json=parentId,proto3" json:",omitempty"` + ParentSchemaID uint32 `protobuf:"varint,4,opt,name=parent_schema_id,json=parentSchemaId,proto3" json:",omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:",omitempty"` + Force bool `protobuf:"varint,6,opt,name=force,proto3" json:",omitempty"` + ForceNotice string `protobuf:"bytes,7,opt,name=force_notice,json=forceNotice,proto3" json:",omitempty"` +} + +func (m *UnsafeDeleteNamespaceEntry) Reset() { *m = UnsafeDeleteNamespaceEntry{} } +func (m *UnsafeDeleteNamespaceEntry) String() string { return proto.CompactTextString(m) } +func (*UnsafeDeleteNamespaceEntry) ProtoMessage() {} +func (*UnsafeDeleteNamespaceEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_ddl_events_cab182f8bf2d2d83, []int{42} +} +func (m *UnsafeDeleteNamespaceEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnsafeDeleteNamespaceEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *UnsafeDeleteNamespaceEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnsafeDeleteNamespaceEntry.Merge(dst, src) +} +func (m *UnsafeDeleteNamespaceEntry) XXX_Size() int { + return m.Size() +} +func (m *UnsafeDeleteNamespaceEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UnsafeDeleteNamespaceEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UnsafeDeleteNamespaceEntry proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CreateDatabase)(nil), "cockroach.util.log.eventpb.CreateDatabase") + proto.RegisterType((*DropDatabase)(nil), "cockroach.util.log.eventpb.DropDatabase") + proto.RegisterType((*RenameDatabase)(nil), "cockroach.util.log.eventpb.RenameDatabase") + proto.RegisterType((*ConvertToSchema)(nil), "cockroach.util.log.eventpb.ConvertToSchema") + proto.RegisterType((*AlterDatabaseOwner)(nil), "cockroach.util.log.eventpb.AlterDatabaseOwner") + proto.RegisterType((*CreateSchema)(nil), "cockroach.util.log.eventpb.CreateSchema") + proto.RegisterType((*DropSchema)(nil), "cockroach.util.log.eventpb.DropSchema") + proto.RegisterType((*RenameSchema)(nil), "cockroach.util.log.eventpb.RenameSchema") + proto.RegisterType((*AlterSchemaOwner)(nil), "cockroach.util.log.eventpb.AlterSchemaOwner") + proto.RegisterType((*CreateTable)(nil), "cockroach.util.log.eventpb.CreateTable") + proto.RegisterType((*DropTable)(nil), "cockroach.util.log.eventpb.DropTable") + proto.RegisterType((*RenameTable)(nil), "cockroach.util.log.eventpb.RenameTable") + proto.RegisterType((*TruncateTable)(nil), "cockroach.util.log.eventpb.TruncateTable") + proto.RegisterType((*AlterTable)(nil), "cockroach.util.log.eventpb.AlterTable") + proto.RegisterType((*CommentOnColumn)(nil), "cockroach.util.log.eventpb.CommentOnColumn") + proto.RegisterType((*CommentOnDatabase)(nil), "cockroach.util.log.eventpb.CommentOnDatabase") + proto.RegisterType((*CommentOnTable)(nil), "cockroach.util.log.eventpb.CommentOnTable") + proto.RegisterType((*CommentOnIndex)(nil), "cockroach.util.log.eventpb.CommentOnIndex") + proto.RegisterType((*CreateIndex)(nil), "cockroach.util.log.eventpb.CreateIndex") + proto.RegisterType((*DropIndex)(nil), "cockroach.util.log.eventpb.DropIndex") + proto.RegisterType((*AlterIndex)(nil), "cockroach.util.log.eventpb.AlterIndex") + proto.RegisterType((*CreateView)(nil), "cockroach.util.log.eventpb.CreateView") + proto.RegisterType((*DropView)(nil), "cockroach.util.log.eventpb.DropView") + proto.RegisterType((*CreateSequence)(nil), "cockroach.util.log.eventpb.CreateSequence") + proto.RegisterType((*DropSequence)(nil), "cockroach.util.log.eventpb.DropSequence") + proto.RegisterType((*AlterSequence)(nil), "cockroach.util.log.eventpb.AlterSequence") + proto.RegisterType((*CommonSchemaChangeEventDetails)(nil), "cockroach.util.log.eventpb.CommonSchemaChangeEventDetails") + proto.RegisterType((*ReverseSchemaChange)(nil), "cockroach.util.log.eventpb.ReverseSchemaChange") + proto.RegisterType((*FinishSchemaChange)(nil), "cockroach.util.log.eventpb.FinishSchemaChange") + proto.RegisterType((*FinishSchemaChangeRollback)(nil), "cockroach.util.log.eventpb.FinishSchemaChangeRollback") + proto.RegisterType((*CreateType)(nil), "cockroach.util.log.eventpb.CreateType") + proto.RegisterType((*DropType)(nil), "cockroach.util.log.eventpb.DropType") + proto.RegisterType((*AlterType)(nil), "cockroach.util.log.eventpb.AlterType") + proto.RegisterType((*AlterTypeOwner)(nil), "cockroach.util.log.eventpb.AlterTypeOwner") + proto.RegisterType((*RenameType)(nil), "cockroach.util.log.eventpb.RenameType") + proto.RegisterType((*CommonZoneConfigDetails)(nil), "cockroach.util.log.eventpb.CommonZoneConfigDetails") + proto.RegisterType((*SetZoneConfig)(nil), "cockroach.util.log.eventpb.SetZoneConfig") + proto.RegisterType((*RemoveZoneConfig)(nil), "cockroach.util.log.eventpb.RemoveZoneConfig") + proto.RegisterType((*CreateStatistics)(nil), "cockroach.util.log.eventpb.CreateStatistics") + proto.RegisterType((*UnsafeUpsertDescriptor)(nil), "cockroach.util.log.eventpb.UnsafeUpsertDescriptor") + proto.RegisterType((*UnsafeDeleteDescriptor)(nil), "cockroach.util.log.eventpb.UnsafeDeleteDescriptor") + proto.RegisterType((*UnsafeUpsertNamespaceEntry)(nil), "cockroach.util.log.eventpb.UnsafeUpsertNamespaceEntry") + proto.RegisterType((*UnsafeDeleteNamespaceEntry)(nil), "cockroach.util.log.eventpb.UnsafeDeleteNamespaceEntry") +} +func (m *CreateDatabase) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateDatabase) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n1, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n2, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + if len(m.DatabaseName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.DatabaseName))) + i += copy(dAtA[i:], m.DatabaseName) + } + return i, nil +} + +func (m *DropDatabase) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropDatabase) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n3, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n4, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + if len(m.DatabaseName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.DatabaseName))) + i += copy(dAtA[i:], m.DatabaseName) + } + if len(m.DroppedSchemaObjects) > 0 { + for _, s := range m.DroppedSchemaObjects { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *RenameDatabase) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RenameDatabase) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n5, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n6, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + if len(m.DatabaseName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.DatabaseName))) + i += copy(dAtA[i:], m.DatabaseName) + } + if len(m.NewDatabaseName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.NewDatabaseName))) + i += copy(dAtA[i:], m.NewDatabaseName) + } + return i, nil +} + +func (m *ConvertToSchema) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConvertToSchema) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n7, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n8, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + if len(m.DatabaseName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.DatabaseName))) + i += copy(dAtA[i:], m.DatabaseName) + } + if len(m.NewDatabaseParent) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.NewDatabaseParent))) + i += copy(dAtA[i:], m.NewDatabaseParent) + } + return i, nil +} + +func (m *AlterDatabaseOwner) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterDatabaseOwner) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n9, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n10, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + if len(m.DatabaseName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.DatabaseName))) + i += copy(dAtA[i:], m.DatabaseName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *CreateSchema) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateSchema) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n11, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n12, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + if len(m.SchemaName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SchemaName))) + i += copy(dAtA[i:], m.SchemaName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *DropSchema) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropSchema) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n13, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n14, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + if len(m.SchemaName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SchemaName))) + i += copy(dAtA[i:], m.SchemaName) + } + return i, nil +} + +func (m *RenameSchema) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RenameSchema) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n15, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n15 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n16, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + if len(m.SchemaName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SchemaName))) + i += copy(dAtA[i:], m.SchemaName) + } + if len(m.NewSchemaName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.NewSchemaName))) + i += copy(dAtA[i:], m.NewSchemaName) + } + return i, nil +} + +func (m *AlterSchemaOwner) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterSchemaOwner) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n17, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n18, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n18 + if len(m.SchemaName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SchemaName))) + i += copy(dAtA[i:], m.SchemaName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *CreateTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateTable) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n19, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n20, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *DropTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropTable) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n21, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n22, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n22 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *RenameTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RenameTable) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n23, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n24, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.NewTableName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.NewTableName))) + i += copy(dAtA[i:], m.NewTableName) + } + return i, nil +} + +func (m *TruncateTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TruncateTable) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n25, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n26, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n26 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + return i, nil +} + +func (m *AlterTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterTable) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n27, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n28, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if m.MutationID != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.MutationID)) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + dAtA[i] = 0x2a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *CommentOnColumn) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommentOnColumn) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n29, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n30, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n30 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.ColumnName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ColumnName))) + i += copy(dAtA[i:], m.ColumnName) + } + if len(m.Comment) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Comment))) + i += copy(dAtA[i:], m.Comment) + } + if m.NullComment { + dAtA[i] = 0x30 + i++ + if m.NullComment { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *CommentOnDatabase) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommentOnDatabase) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n31, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n32, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n32 + if len(m.DatabaseName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.DatabaseName))) + i += copy(dAtA[i:], m.DatabaseName) + } + if len(m.Comment) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Comment))) + i += copy(dAtA[i:], m.Comment) + } + if m.NullComment { + dAtA[i] = 0x30 + i++ + if m.NullComment { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *CommentOnTable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommentOnTable) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n33, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n33 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n34, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n34 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.Comment) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Comment))) + i += copy(dAtA[i:], m.Comment) + } + if m.NullComment { + dAtA[i] = 0x30 + i++ + if m.NullComment { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *CommentOnIndex) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommentOnIndex) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n35, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n35 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n36, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n36 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.IndexName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.IndexName))) + i += copy(dAtA[i:], m.IndexName) + } + if len(m.Comment) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Comment))) + i += copy(dAtA[i:], m.Comment) + } + if m.NullComment { + dAtA[i] = 0x30 + i++ + if m.NullComment { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + return i, nil +} + +func (m *CreateIndex) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateIndex) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n37, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n37 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n38, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n38 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.IndexName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.IndexName))) + i += copy(dAtA[i:], m.IndexName) + } + if m.MutationID != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.MutationID)) + } + return i, nil +} + +func (m *DropIndex) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropIndex) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n39, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n39 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n40, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n40 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.IndexName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.IndexName))) + i += copy(dAtA[i:], m.IndexName) + } + if m.MutationID != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.MutationID)) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + dAtA[i] = 0x32 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *AlterIndex) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterIndex) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n41, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n41 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n42, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n42 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + if len(m.IndexName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.IndexName))) + i += copy(dAtA[i:], m.IndexName) + } + if m.MutationID != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.MutationID)) + } + return i, nil +} + +func (m *CreateView) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateView) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n43, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n43 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n44, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n44 + if len(m.ViewName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ViewName))) + i += copy(dAtA[i:], m.ViewName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + if len(m.ViewQuery) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ViewQuery))) + i += copy(dAtA[i:], m.ViewQuery) + } + return i, nil +} + +func (m *DropView) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropView) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n45, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n45 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n46, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n46 + if len(m.ViewName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ViewName))) + i += copy(dAtA[i:], m.ViewName) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *CreateSequence) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateSequence) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n47, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n47 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n48, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n48 + if len(m.SequenceName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SequenceName))) + i += copy(dAtA[i:], m.SequenceName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *DropSequence) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropSequence) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n49, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n49 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n50, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n50 + if len(m.SequenceName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SequenceName))) + i += copy(dAtA[i:], m.SequenceName) + } + return i, nil +} + +func (m *AlterSequence) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterSequence) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n51, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n51 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n52, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n52 + if len(m.SequenceName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SequenceName))) + i += copy(dAtA[i:], m.SequenceName) + } + return i, nil +} + +func (m *CommonSchemaChangeEventDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonSchemaChangeEventDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.InstanceID != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.InstanceID)) + } + if m.DescriptorID != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.DescriptorID)) + } + if m.MutationID != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.MutationID)) + } + return i, nil +} + +func (m *ReverseSchemaChange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ReverseSchemaChange) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n53, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n53 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSchemaChangeEventDetails.Size())) + n54, err := m.CommonSchemaChangeEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n54 + if len(m.Error) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Error))) + i += copy(dAtA[i:], m.Error) + } + if len(m.SQLSTATE) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.SQLSTATE))) + i += copy(dAtA[i:], m.SQLSTATE) + } + return i, nil +} + +func (m *FinishSchemaChange) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinishSchemaChange) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n55, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n55 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSchemaChangeEventDetails.Size())) + n56, err := m.CommonSchemaChangeEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n56 + return i, nil +} + +func (m *FinishSchemaChangeRollback) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinishSchemaChangeRollback) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n57, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n57 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSchemaChangeEventDetails.Size())) + n58, err := m.CommonSchemaChangeEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n58 + return i, nil +} + +func (m *CreateType) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateType) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n59, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n59 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n60, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n60 + if len(m.TypeName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TypeName))) + i += copy(dAtA[i:], m.TypeName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *DropType) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DropType) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n61, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n61 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n62, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n62 + if len(m.TypeName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TypeName))) + i += copy(dAtA[i:], m.TypeName) + } + return i, nil +} + +func (m *AlterType) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterType) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n63, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n63 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n64, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n64 + if len(m.TypeName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TypeName))) + i += copy(dAtA[i:], m.TypeName) + } + return i, nil +} + +func (m *AlterTypeOwner) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AlterTypeOwner) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n65, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n65 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n66, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n66 + if len(m.TypeName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TypeName))) + i += copy(dAtA[i:], m.TypeName) + } + if len(m.Owner) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Owner))) + i += copy(dAtA[i:], m.Owner) + } + return i, nil +} + +func (m *RenameType) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RenameType) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n67, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n67 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n68, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n68 + if len(m.TypeName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TypeName))) + i += copy(dAtA[i:], m.TypeName) + } + if len(m.NewTypeName) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.NewTypeName))) + i += copy(dAtA[i:], m.NewTypeName) + } + return i, nil +} + +func (m *CommonZoneConfigDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonZoneConfigDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Target) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Target))) + i += copy(dAtA[i:], m.Target) + } + if len(m.Config) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Config))) + i += copy(dAtA[i:], m.Config) + } + if len(m.Options) > 0 { + for _, s := range m.Options { + dAtA[i] = 0x1a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *SetZoneConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SetZoneConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n69, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n69 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n70, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n70 + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonZoneConfigDetails.Size())) + n71, err := m.CommonZoneConfigDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n71 + return i, nil +} + +func (m *RemoveZoneConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RemoveZoneConfig) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n72, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n72 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n73, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n73 + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonZoneConfigDetails.Size())) + n74, err := m.CommonZoneConfigDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n74 + return i, nil +} + +func (m *CreateStatistics) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CreateStatistics) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n75, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n75 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n76, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n76 + if len(m.TableName) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.TableName))) + i += copy(dAtA[i:], m.TableName) + } + return i, nil +} + +func (m *UnsafeUpsertDescriptor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeUpsertDescriptor) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n77, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n77 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n78, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n78 + if len(m.PreviousDescriptor) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.PreviousDescriptor))) + i += copy(dAtA[i:], m.PreviousDescriptor) + } + if len(m.NewDescriptor) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.NewDescriptor))) + i += copy(dAtA[i:], m.NewDescriptor) + } + if m.Force { + dAtA[i] = 0x28 + i++ + if m.Force { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.ForceNotice) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ForceNotice))) + i += copy(dAtA[i:], m.ForceNotice) + } + return i, nil +} + +func (m *UnsafeDeleteDescriptor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeDeleteDescriptor) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n79, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n79 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n80, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n80 + if m.ParentID != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.ParentID)) + } + if m.ParentSchemaID != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.ParentSchemaID)) + } + if len(m.Name) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Force { + dAtA[i] = 0x30 + i++ + if m.Force { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.ForceNotice) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ForceNotice))) + i += copy(dAtA[i:], m.ForceNotice) + } + return i, nil +} + +func (m *UnsafeUpsertNamespaceEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeUpsertNamespaceEntry) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n81, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n81 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n82, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n82 + if m.ParentID != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.ParentID)) + } + if m.ParentSchemaID != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.ParentSchemaID)) + } + if len(m.Name) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.PreviousID != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.PreviousID)) + } + if m.Force { + dAtA[i] = 0x38 + i++ + if m.Force { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if m.FailedValidation { + dAtA[i] = 0x40 + i++ + if m.FailedValidation { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.ValidationErrors) > 0 { + dAtA[i] = 0x4a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ValidationErrors))) + i += copy(dAtA[i:], m.ValidationErrors) + } + return i, nil +} + +func (m *UnsafeDeleteNamespaceEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnsafeDeleteNamespaceEntry) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonEventDetails.Size())) + n83, err := m.CommonEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n83 + dAtA[i] = 0x12 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.CommonSQLEventDetails.Size())) + n84, err := m.CommonSQLEventDetails.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n84 + if m.ParentID != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.ParentID)) + } + if m.ParentSchemaID != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(m.ParentSchemaID)) + } + if len(m.Name) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Force { + dAtA[i] = 0x30 + i++ + if m.Force { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } + if len(m.ForceNotice) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintDdlEvents(dAtA, i, uint64(len(m.ForceNotice))) + i += copy(dAtA[i:], m.ForceNotice) + } + return i, nil +} + +func encodeVarintDdlEvents(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *CreateDatabase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.DatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *DropDatabase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.DatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if len(m.DroppedSchemaObjects) > 0 { + for _, s := range m.DroppedSchemaObjects { + l = len(s) + n += 1 + l + sovDdlEvents(uint64(l)) + } + } + return n +} + +func (m *RenameDatabase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.DatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.NewDatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *ConvertToSchema) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.DatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.NewDatabaseParent) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *AlterDatabaseOwner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.DatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *CreateSchema) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SchemaName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *DropSchema) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SchemaName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *RenameSchema) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SchemaName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.NewSchemaName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *AlterSchemaOwner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SchemaName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *CreateTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *DropTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + l = len(s) + n += 1 + l + sovDdlEvents(uint64(l)) + } + } + return n +} + +func (m *RenameTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.NewTableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *TruncateTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *AlterTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.MutationID != 0 { + n += 1 + sovDdlEvents(uint64(m.MutationID)) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + l = len(s) + n += 1 + l + sovDdlEvents(uint64(l)) + } + } + return n +} + +func (m *CommentOnColumn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.ColumnName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Comment) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.NullComment { + n += 2 + } + return n +} + +func (m *CommentOnDatabase) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.DatabaseName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Comment) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.NullComment { + n += 2 + } + return n +} + +func (m *CommentOnTable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Comment) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.NullComment { + n += 2 + } + return n +} + +func (m *CommentOnIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.IndexName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Comment) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.NullComment { + n += 2 + } + return n +} + +func (m *CreateIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.IndexName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.MutationID != 0 { + n += 1 + sovDdlEvents(uint64(m.MutationID)) + } + return n +} + +func (m *DropIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.IndexName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.MutationID != 0 { + n += 1 + sovDdlEvents(uint64(m.MutationID)) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + l = len(s) + n += 1 + l + sovDdlEvents(uint64(l)) + } + } + return n +} + +func (m *AlterIndex) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.IndexName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.MutationID != 0 { + n += 1 + sovDdlEvents(uint64(m.MutationID)) + } + return n +} + +func (m *CreateView) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.ViewName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.ViewQuery) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *DropView) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.ViewName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if len(m.CascadeDroppedViews) > 0 { + for _, s := range m.CascadeDroppedViews { + l = len(s) + n += 1 + l + sovDdlEvents(uint64(l)) + } + } + return n +} + +func (m *CreateSequence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SequenceName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *DropSequence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SequenceName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *AlterSequence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.SequenceName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *CommonSchemaChangeEventDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.InstanceID != 0 { + n += 1 + sovDdlEvents(uint64(m.InstanceID)) + } + if m.DescriptorID != 0 { + n += 1 + sovDdlEvents(uint64(m.DescriptorID)) + } + if m.MutationID != 0 { + n += 1 + sovDdlEvents(uint64(m.MutationID)) + } + return n +} + +func (m *ReverseSchemaChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSchemaChangeEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.Error) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.SQLSTATE) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *FinishSchemaChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSchemaChangeEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + return n +} + +func (m *FinishSchemaChangeRollback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSchemaChangeEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + return n +} + +func (m *CreateType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TypeName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *DropType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TypeName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *AlterType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TypeName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *AlterTypeOwner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TypeName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *RenameType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TypeName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.NewTypeName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *CommonZoneConfigDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Target) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.Config) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if len(m.Options) > 0 { + for _, s := range m.Options { + l = len(s) + n += 1 + l + sovDdlEvents(uint64(l)) + } + } + return n +} + +func (m *SetZoneConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonZoneConfigDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + return n +} + +func (m *RemoveZoneConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonZoneConfigDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + return n +} + +func (m *CreateStatistics) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.TableName) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *UnsafeUpsertDescriptor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = len(m.PreviousDescriptor) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + l = len(m.NewDescriptor) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.Force { + n += 2 + } + l = len(m.ForceNotice) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *UnsafeDeleteDescriptor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + if m.ParentID != 0 { + n += 1 + sovDdlEvents(uint64(m.ParentID)) + } + if m.ParentSchemaID != 0 { + n += 1 + sovDdlEvents(uint64(m.ParentSchemaID)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.Force { + n += 2 + } + l = len(m.ForceNotice) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *UnsafeUpsertNamespaceEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + if m.ParentID != 0 { + n += 1 + sovDdlEvents(uint64(m.ParentID)) + } + if m.ParentSchemaID != 0 { + n += 1 + sovDdlEvents(uint64(m.ParentSchemaID)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.PreviousID != 0 { + n += 1 + sovDdlEvents(uint64(m.PreviousID)) + } + if m.Force { + n += 2 + } + if m.FailedValidation { + n += 2 + } + l = len(m.ValidationErrors) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func (m *UnsafeDeleteNamespaceEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommonEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + l = m.CommonSQLEventDetails.Size() + n += 1 + l + sovDdlEvents(uint64(l)) + if m.ParentID != 0 { + n += 1 + sovDdlEvents(uint64(m.ParentID)) + } + if m.ParentSchemaID != 0 { + n += 1 + sovDdlEvents(uint64(m.ParentSchemaID)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + if m.Force { + n += 2 + } + l = len(m.ForceNotice) + if l > 0 { + n += 1 + l + sovDdlEvents(uint64(l)) + } + return n +} + +func sovDdlEvents(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozDdlEvents(x uint64) (n int) { + return sovDdlEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CreateDatabase) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateDatabase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateDatabase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropDatabase) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropDatabase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropDatabase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DroppedSchemaObjects", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DroppedSchemaObjects = append(m.DroppedSchemaObjects, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RenameDatabase) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RenameDatabase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RenameDatabase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewDatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewDatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConvertToSchema) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConvertToSchema: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConvertToSchema: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewDatabaseParent", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewDatabaseParent = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterDatabaseOwner) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterDatabaseOwner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterDatabaseOwner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateSchema) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateSchema: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateSchema: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SchemaName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropSchema) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropSchema: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropSchema: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SchemaName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RenameSchema) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RenameSchema: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RenameSchema: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SchemaName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewSchemaName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewSchemaName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterSchemaOwner) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterSchemaOwner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterSchemaOwner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SchemaName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CascadeDroppedViews", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CascadeDroppedViews = append(m.CascadeDroppedViews, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RenameTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RenameTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RenameTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewTableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewTableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TruncateTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TruncateTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TruncateTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MutationID", wireType) + } + m.MutationID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MutationID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CascadeDroppedViews", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CascadeDroppedViews = append(m.CascadeDroppedViews, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommentOnColumn) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommentOnColumn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommentOnColumn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ColumnName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ColumnName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Comment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NullComment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NullComment = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommentOnDatabase) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommentOnDatabase: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommentOnDatabase: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DatabaseName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DatabaseName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Comment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NullComment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NullComment = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommentOnTable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommentOnTable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommentOnTable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Comment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NullComment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NullComment = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommentOnIndex) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommentOnIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommentOnIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IndexName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Comment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NullComment", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NullComment = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateIndex) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IndexName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MutationID", wireType) + } + m.MutationID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MutationID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropIndex) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IndexName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MutationID", wireType) + } + m.MutationID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MutationID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CascadeDroppedViews", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CascadeDroppedViews = append(m.CascadeDroppedViews, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterIndex) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterIndex: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterIndex: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IndexName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MutationID", wireType) + } + m.MutationID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MutationID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateView) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateView: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateView: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ViewName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ViewName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ViewQuery", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ViewQuery = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropView) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropView: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropView: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ViewName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ViewName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CascadeDroppedViews", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CascadeDroppedViews = append(m.CascadeDroppedViews, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateSequence) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateSequence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateSequence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequenceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequenceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropSequence) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropSequence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropSequence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequenceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequenceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterSequence) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterSequence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterSequence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequenceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SequenceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonSchemaChangeEventDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonSchemaChangeEventDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonSchemaChangeEventDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InstanceID", wireType) + } + m.InstanceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InstanceID |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DescriptorID", wireType) + } + m.DescriptorID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DescriptorID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MutationID", wireType) + } + m.MutationID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MutationID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ReverseSchemaChange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ReverseSchemaChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReverseSchemaChange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSchemaChangeEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSchemaChangeEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SQLSTATE", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SQLSTATE = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FinishSchemaChange) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinishSchemaChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinishSchemaChange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSchemaChangeEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSchemaChangeEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FinishSchemaChangeRollback) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinishSchemaChangeRollback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinishSchemaChangeRollback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSchemaChangeEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSchemaChangeEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateType) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DropType) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DropType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DropType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterType) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AlterTypeOwner) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AlterTypeOwner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AlterTypeOwner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RenameType) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RenameType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RenameType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TypeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TypeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewTypeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewTypeName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonZoneConfigDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonZoneConfigDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonZoneConfigDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Target = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SetZoneConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SetZoneConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetZoneConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonZoneConfigDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonZoneConfigDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RemoveZoneConfig) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RemoveZoneConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RemoveZoneConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonZoneConfigDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonZoneConfigDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CreateStatistics) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CreateStatistics: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CreateStatistics: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TableName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeUpsertDescriptor) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeUpsertDescriptor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeUpsertDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousDescriptor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PreviousDescriptor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewDescriptor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewDescriptor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Force = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ForceNotice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ForceNotice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeDeleteDescriptor) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeDeleteDescriptor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeDeleteDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentID", wireType) + } + m.ParentID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParentID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentSchemaID", wireType) + } + m.ParentSchemaID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParentSchemaID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Force = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ForceNotice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ForceNotice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeUpsertNamespaceEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeUpsertNamespaceEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeUpsertNamespaceEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentID", wireType) + } + m.ParentID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParentID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentSchemaID", wireType) + } + m.ParentSchemaID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParentSchemaID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousID", wireType) + } + m.PreviousID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PreviousID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Force = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FailedValidation", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.FailedValidation = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidationErrors", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidationErrors = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsafeDeleteNamespaceEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UnsafeDeleteNamespaceEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsafeDeleteNamespaceEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommonSQLEventDetails", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommonSQLEventDetails.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentID", wireType) + } + m.ParentID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParentID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentSchemaID", wireType) + } + m.ParentSchemaID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ParentSchemaID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Force = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ForceNotice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthDdlEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ForceNotice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDdlEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthDdlEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDdlEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthDdlEvents + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDdlEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipDdlEvents(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthDdlEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDdlEvents = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("util/log/eventpb/ddl_events.proto", fileDescriptor_ddl_events_cab182f8bf2d2d83) +} + +var fileDescriptor_ddl_events_cab182f8bf2d2d83 = []byte{ + // 1554 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5b, 0x5d, 0x6f, 0x1b, 0x45, + 0x17, 0xce, 0xae, 0xf3, 0x61, 0x1f, 0x7f, 0x34, 0xd9, 0xf4, 0xed, 0x6b, 0x45, 0xef, 0x6b, 0x87, + 0x55, 0x85, 0x82, 0xa0, 0x8e, 0xda, 0x42, 0x91, 0x8a, 0x0a, 0x6a, 0xec, 0x20, 0x19, 0x95, 0xb6, + 0x89, 0xdd, 0x0a, 0x7a, 0x63, 0x6d, 0x76, 0x27, 0xce, 0xd2, 0xf5, 0xce, 0x66, 0x77, 0x6c, 0x93, + 0x1f, 0x80, 0x84, 0x04, 0x42, 0xa8, 0x45, 0x08, 0x89, 0x1b, 0x24, 0x90, 0x90, 0xb8, 0x41, 0xe2, + 0x86, 0x1f, 0x00, 0x88, 0x5e, 0x00, 0xaa, 0xe0, 0xa6, 0x57, 0x56, 0xeb, 0x48, 0x54, 0xaa, 0x80, + 0x2b, 0x24, 0x6e, 0xd1, 0xcc, 0xec, 0xda, 0x9b, 0xf8, 0x23, 0xb1, 0x94, 0x5c, 0xec, 0x26, 0x77, + 0x8e, 0xe7, 0x39, 0x67, 0xf7, 0x3c, 0xe7, 0xcc, 0x33, 0x67, 0x66, 0x1c, 0x78, 0xaa, 0x4e, 0x74, + 0x63, 0xd1, 0xc0, 0xd5, 0x45, 0xd4, 0x40, 0x26, 0xb1, 0xd6, 0x16, 0x35, 0xcd, 0xa8, 0xb0, 0xcf, + 0x4e, 0xce, 0xb2, 0x31, 0xc1, 0xd2, 0x9c, 0x8a, 0xd5, 0xdb, 0x36, 0x56, 0xd4, 0x8d, 0x1c, 0x05, + 0xe7, 0x0c, 0x5c, 0xcd, 0xb9, 0xe0, 0xb9, 0x93, 0x55, 0x5c, 0xc5, 0x0c, 0xb6, 0x48, 0x3f, 0x71, + 0x8b, 0xb9, 0xff, 0xf7, 0x38, 0xf5, 0x3b, 0x94, 0xff, 0x12, 0x20, 0x95, 0xb7, 0x91, 0x42, 0x50, + 0x41, 0x21, 0xca, 0x9a, 0xe2, 0x20, 0xa9, 0x0c, 0x93, 0x2a, 0xae, 0xd5, 0xb0, 0x99, 0x16, 0xe6, + 0x85, 0x85, 0xf8, 0xb9, 0x5c, 0x6e, 0xf0, 0x43, 0x73, 0x79, 0x86, 0x5c, 0xa6, 0x7f, 0x15, 0x10, + 0x51, 0x74, 0xc3, 0x59, 0x4a, 0xdc, 0x6b, 0x65, 0xc7, 0xee, 0xb7, 0xb2, 0xc2, 0x93, 0x56, 0x76, + 0x6c, 0xd5, 0xf5, 0x25, 0xad, 0x40, 0xc4, 0xd9, 0x34, 0xd2, 0x22, 0x73, 0x79, 0x76, 0x6f, 0x97, + 0xa5, 0x95, 0x2b, 0x43, 0xbc, 0x52, 0x5f, 0xd2, 0x79, 0x48, 0x6a, 0xee, 0x4b, 0x57, 0x4c, 0xa5, + 0x86, 0xd2, 0x91, 0x79, 0x61, 0x21, 0xb6, 0x94, 0x7a, 0xd2, 0xca, 0xc2, 0x73, 0xb8, 0xa6, 0x13, + 0x54, 0xb3, 0xc8, 0xd6, 0x6a, 0xc2, 0x03, 0x5d, 0x55, 0x6a, 0x48, 0xfe, 0x46, 0x84, 0x44, 0xc1, + 0xc6, 0xd6, 0xd1, 0x08, 0x57, 0x2a, 0xc0, 0x29, 0xcd, 0xc6, 0x96, 0x85, 0xb4, 0x8a, 0xa3, 0x6e, + 0xa0, 0x9a, 0x52, 0xc1, 0x6b, 0x6f, 0x21, 0x95, 0x38, 0xe9, 0xf1, 0xf9, 0x48, 0x1f, 0xeb, 0x93, + 0x2e, 0xba, 0xc4, 0xc0, 0xd7, 0x38, 0x56, 0xfe, 0x4a, 0x84, 0xd4, 0x2a, 0xa2, 0x0f, 0x3d, 0x22, + 0xb4, 0x5d, 0x84, 0x19, 0x13, 0x35, 0x2b, 0x3b, 0x0d, 0xc7, 0xfb, 0x1a, 0x9e, 0x30, 0x51, 0xb3, + 0xe0, 0xaf, 0xb0, 0xaf, 0x45, 0x38, 0x91, 0xc7, 0x66, 0x03, 0xd9, 0xa4, 0x8c, 0x39, 0x8f, 0x21, + 0x67, 0xeb, 0x65, 0x98, 0xdd, 0xc1, 0x96, 0xa5, 0xd8, 0xc8, 0x24, 0x03, 0xf8, 0x9a, 0xf1, 0xf1, + 0x75, 0x9d, 0x01, 0xe5, 0x4f, 0x44, 0x90, 0x2e, 0x1b, 0x04, 0xd9, 0xde, 0xf7, 0xd7, 0x9a, 0x26, + 0xb2, 0x43, 0x4e, 0xda, 0x69, 0x98, 0xc0, 0x34, 0xcc, 0x01, 0x34, 0xf1, 0x41, 0xf9, 0x03, 0x11, + 0x12, 0x5c, 0x9f, 0x83, 0x56, 0x49, 0x8b, 0x10, 0x77, 0x15, 0x67, 0x08, 0x25, 0xc0, 0x21, 0x23, + 0x10, 0xf2, 0xbb, 0x00, 0x40, 0xf5, 0x3b, 0xec, 0x74, 0xc8, 0x9f, 0x89, 0x90, 0xe0, 0x9a, 0x1b, + 0xfa, 0xcc, 0x5f, 0x00, 0x2a, 0xa2, 0x15, 0xbf, 0x51, 0xff, 0x1a, 0x48, 0x9a, 0xa8, 0x59, 0xea, + 0x52, 0x74, 0x47, 0x84, 0x69, 0xa6, 0x1b, 0xee, 0x6a, 0x15, 0x2c, 0xd5, 0x38, 0xa4, 0x09, 0xf2, + 0x9e, 0x08, 0x71, 0xae, 0x18, 0x65, 0x65, 0xcd, 0x08, 0xd0, 0x42, 0x7d, 0x06, 0x80, 0xd0, 0x37, + 0x1e, 0x46, 0x47, 0x8c, 0x21, 0x46, 0x60, 0xe3, 0x4b, 0x11, 0x62, 0x54, 0x2e, 0xc2, 0xcd, 0xc5, + 0x12, 0xfc, 0x47, 0x55, 0x1c, 0x55, 0xd1, 0x50, 0xc5, 0xeb, 0xf6, 0x1a, 0x3a, 0x6a, 0x0e, 0x6a, + 0xf2, 0x66, 0x5d, 0x70, 0x81, 0x63, 0x6f, 0x52, 0xa8, 0xfc, 0xa9, 0x08, 0x71, 0xae, 0x37, 0xe1, + 0xe6, 0xea, 0x79, 0x48, 0x51, 0xb1, 0xf1, 0x99, 0xf4, 0x2f, 0xa0, 0x84, 0x89, 0x9a, 0x65, 0xcf, + 0x4a, 0x7e, 0x2c, 0x40, 0xb2, 0x6c, 0xd7, 0x4d, 0x35, 0xec, 0xf3, 0x4a, 0x7e, 0x2c, 0x02, 0x30, + 0x51, 0x0d, 0x77, 0x19, 0x5c, 0x82, 0x78, 0xad, 0x4e, 0x14, 0xa2, 0x63, 0xb3, 0xa2, 0x6b, 0xac, + 0x06, 0x92, 0x4b, 0xff, 0x6b, 0xb7, 0xb2, 0xf0, 0xba, 0xfb, 0x75, 0xb1, 0xb0, 0x5b, 0x8b, 0x3d, + 0x83, 0xa2, 0x36, 0x78, 0xc6, 0x4d, 0xec, 0x7f, 0xc6, 0xfd, 0xc3, 0x36, 0x0a, 0xb5, 0x1a, 0x32, + 0xc9, 0x35, 0x33, 0x8f, 0x8d, 0x7a, 0xcd, 0x0c, 0x2d, 0xdd, 0x8b, 0x10, 0x57, 0x59, 0x84, 0xc3, + 0xa6, 0x1c, 0x70, 0x08, 0x33, 0x58, 0x80, 0x29, 0x95, 0x73, 0x93, 0x9e, 0xe8, 0x0b, 0xf6, 0x86, + 0xa5, 0xb3, 0x90, 0x30, 0xeb, 0x86, 0x51, 0xf1, 0xe0, 0x93, 0xf3, 0xc2, 0x42, 0xb4, 0x07, 0x1e, + 0xa7, 0x18, 0x97, 0x6d, 0xf9, 0x17, 0x11, 0x66, 0x3a, 0xcc, 0x1f, 0x91, 0x2d, 0xad, 0x8f, 0xd0, + 0xf1, 0x03, 0x27, 0xf4, 0x07, 0x11, 0x52, 0x1d, 0x42, 0xc3, 0x2d, 0x1c, 0x87, 0xca, 0xe3, 0xdf, + 0x7e, 0x1e, 0x8b, 0xa6, 0x86, 0xde, 0x0e, 0x2d, 0x8f, 0x67, 0x00, 0x74, 0x1a, 0xe0, 0x30, 0x41, + 0x88, 0x31, 0xc4, 0xe1, 0xeb, 0xc1, 0x6f, 0x9d, 0x9e, 0xf9, 0x98, 0x73, 0x1f, 0xe7, 0xbb, 0xd6, + 0xc8, 0x89, 0xd1, 0xd6, 0x48, 0xf9, 0x9d, 0x08, 0xef, 0xbd, 0x8f, 0x39, 0x3d, 0x30, 0x4e, 0xa5, + 0x73, 0x83, 0xfa, 0x8e, 0x49, 0xda, 0x77, 0xf4, 0xef, 0x33, 0x7e, 0xf5, 0x3a, 0xba, 0xe3, 0x44, + 0x1c, 0x5c, 0x71, 0x7f, 0x2b, 0x02, 0x70, 0xc9, 0xa0, 0x24, 0x07, 0x87, 0xd4, 0x67, 0x21, 0x46, + 0x0b, 0x66, 0x18, 0xa7, 0x51, 0x0a, 0xd8, 0xff, 0x1e, 0x9b, 0x12, 0xcf, 0x5c, 0x6e, 0xd6, 0x91, + 0xbd, 0x35, 0x40, 0x9d, 0xd9, 0x43, 0x57, 0x28, 0x40, 0xfe, 0x42, 0x84, 0x28, 0xad, 0xcf, 0x10, + 0xf3, 0x76, 0x10, 0xfb, 0xf1, 0x8f, 0x44, 0xef, 0x66, 0xae, 0x84, 0x36, 0xeb, 0xc8, 0x54, 0x83, + 0xd5, 0xa0, 0x3a, 0xee, 0x4b, 0x0f, 0x6d, 0x50, 0x3d, 0xd0, 0x08, 0x07, 0x3a, 0x7f, 0x08, 0xfc, + 0xfe, 0xee, 0x68, 0x90, 0x22, 0xff, 0x29, 0x40, 0x92, 0x1f, 0x71, 0x1e, 0x8d, 0x78, 0xb7, 0x05, + 0xc8, 0xb8, 0x4f, 0x60, 0x07, 0x9f, 0xf9, 0x0d, 0xc5, 0xac, 0x22, 0xff, 0xa3, 0xa8, 0x70, 0xeb, + 0xa6, 0x43, 0x14, 0xea, 0x57, 0xd7, 0x18, 0x0b, 0x13, 0x5c, 0xb8, 0x8b, 0xee, 0xd7, 0xbd, 0xc2, + 0xed, 0x19, 0x14, 0x35, 0x29, 0x0f, 0x49, 0x0d, 0x39, 0xaa, 0xad, 0x5b, 0x04, 0xdb, 0xd4, 0x81, + 0xc8, 0x94, 0x3f, 0xd3, 0x6e, 0x65, 0x13, 0x85, 0xce, 0x40, 0x8f, 0x8b, 0x44, 0xd7, 0xa8, 0xa8, + 0xed, 0x5e, 0x3c, 0x22, 0x23, 0x2e, 0x1e, 0x9f, 0x8b, 0x30, 0xbb, 0x8a, 0x1a, 0xc8, 0x76, 0x90, + 0x3f, 0xcc, 0x43, 0xca, 0xed, 0x1b, 0x20, 0x3a, 0xaa, 0x9b, 0xda, 0x8b, 0xfb, 0x48, 0xed, 0x00, + 0xe2, 0x77, 0x79, 0x17, 0x1d, 0x95, 0x4e, 0x59, 0x64, 0xdb, 0x78, 0xe0, 0x94, 0x65, 0x83, 0xd2, + 0x05, 0x88, 0x3a, 0x9b, 0x86, 0x43, 0x14, 0x82, 0xdc, 0xd5, 0x61, 0xae, 0xdd, 0xca, 0x46, 0x4b, + 0x2b, 0x57, 0x4a, 0xe5, 0xcb, 0xe5, 0xe5, 0xdd, 0x2a, 0xea, 0x61, 0xe5, 0xef, 0x05, 0x90, 0x5e, + 0xd5, 0x4d, 0xdd, 0xd9, 0x08, 0x32, 0x49, 0xf2, 0x4f, 0x02, 0xcc, 0xf5, 0x86, 0xb1, 0x8a, 0x0d, + 0x63, 0x4d, 0x51, 0x6f, 0x07, 0x2e, 0x9c, 0x77, 0x3b, 0x8d, 0x4f, 0x79, 0xcb, 0x42, 0x81, 0x5a, + 0xc0, 0xc9, 0x96, 0x35, 0xf4, 0xc8, 0x37, 0x4a, 0x01, 0x3b, 0xd7, 0xa2, 0x89, 0x61, 0x6b, 0xd1, + 0x43, 0x81, 0x77, 0x32, 0x01, 0x26, 0x22, 0x32, 0x9c, 0x08, 0xf9, 0x91, 0x00, 0x31, 0x7e, 0x1a, + 0x1c, 0xde, 0x18, 0xdf, 0x17, 0x21, 0xd5, 0x89, 0x31, 0x60, 0x97, 0x88, 0xa3, 0x04, 0xba, 0xcf, + 0x0e, 0xeb, 0x63, 0x11, 0xc0, 0xbd, 0x08, 0x0a, 0x6d, 0xce, 0xa5, 0x73, 0x90, 0x64, 0xb7, 0x40, + 0x7b, 0x28, 0x42, 0xdc, 0x44, 0xcd, 0xb2, 0x57, 0x27, 0x77, 0x05, 0xf8, 0x2f, 0x7f, 0x9b, 0x5b, + 0xd8, 0x44, 0x79, 0x6c, 0xae, 0xeb, 0x55, 0xaf, 0x29, 0x79, 0x1a, 0x26, 0x89, 0x62, 0x57, 0x11, + 0x61, 0x2c, 0xf5, 0x3a, 0x72, 0x47, 0x29, 0x4e, 0x65, 0x86, 0x2c, 0xf4, 0x3e, 0x38, 0x3e, 0x2a, + 0x2d, 0xc0, 0x14, 0xb6, 0x68, 0xb7, 0xe0, 0xa4, 0x23, 0x7d, 0xf7, 0x0c, 0xde, 0xb0, 0x7c, 0x57, + 0x84, 0x64, 0x09, 0x91, 0xee, 0x2b, 0x05, 0x27, 0x63, 0x6f, 0x76, 0xc8, 0x88, 0x30, 0xaf, 0xe7, + 0xf7, 0xf6, 0xda, 0xc3, 0x7c, 0xef, 0xdb, 0xd2, 0x41, 0x5a, 0xc4, 0xd3, 0xab, 0xa8, 0x86, 0x1b, + 0xe8, 0x98, 0x98, 0x1d, 0xc4, 0x3c, 0x11, 0x60, 0xda, 0xdd, 0x56, 0xd2, 0x76, 0xd4, 0x21, 0xba, + 0xea, 0x84, 0xf6, 0x2e, 0xf3, 0x4e, 0x04, 0x4e, 0xdd, 0x30, 0x1d, 0x65, 0x1d, 0xdd, 0xb0, 0x1c, + 0x64, 0x93, 0x6e, 0x7f, 0x1f, 0x9c, 0x90, 0x5f, 0x81, 0x59, 0xcb, 0x46, 0x0d, 0x1d, 0xd7, 0x9d, + 0x4a, 0x77, 0x0f, 0x32, 0x20, 0x76, 0xc9, 0x83, 0xfa, 0x22, 0x7d, 0x81, 0x5f, 0x78, 0xfb, 0x6c, + 0x07, 0xff, 0xb8, 0xc6, 0x67, 0x76, 0x1a, 0x26, 0xd6, 0xb1, 0xad, 0xf2, 0x96, 0xbd, 0xf7, 0xfc, + 0x9c, 0x0f, 0x4a, 0x67, 0x21, 0xc1, 0x3e, 0x54, 0x4c, 0x4c, 0x74, 0x15, 0xb1, 0xc3, 0xf6, 0x3e, + 0x32, 0xca, 0x30, 0x57, 0x19, 0x44, 0xfe, 0xae, 0x93, 0x94, 0x02, 0x32, 0x10, 0x41, 0x41, 0x4c, + 0xca, 0x8b, 0x10, 0xe3, 0x3f, 0x72, 0xec, 0xee, 0xfe, 0xd8, 0x9e, 0x86, 0xff, 0xa0, 0xb1, 0x67, + 0xef, 0x17, 0xe5, 0xe0, 0xa2, 0x26, 0xbd, 0x06, 0xd3, 0xae, 0xa1, 0xfb, 0xdb, 0x9f, 0xce, 0xdd, + 0xf3, 0x7c, 0xbb, 0x95, 0x4d, 0x71, 0x7b, 0xde, 0x8d, 0xf7, 0x78, 0x49, 0x59, 0xfe, 0x51, 0x4d, + 0x92, 0x61, 0x9c, 0x4d, 0x83, 0xfe, 0x3d, 0x2a, 0x1b, 0xeb, 0x66, 0x71, 0x72, 0x94, 0x2c, 0x4e, + 0xed, 0x9d, 0xc5, 0x9f, 0xc7, 0x61, 0xce, 0x3f, 0xb5, 0xe8, 0x7c, 0x73, 0x2c, 0x45, 0x45, 0xcb, + 0x26, 0xb1, 0xb7, 0x8e, 0x33, 0x79, 0xe0, 0x99, 0xbc, 0x04, 0xf1, 0x8e, 0x0e, 0xe8, 0x1a, 0xcb, + 0xa7, 0x7b, 0xe4, 0x70, 0xdd, 0xfd, 0xba, 0xf7, 0xc8, 0xc1, 0x33, 0x28, 0x6a, 0xdd, 0x42, 0x98, + 0x1a, 0x56, 0x08, 0x2f, 0xc1, 0xcc, 0xba, 0xa2, 0x1b, 0x48, 0xab, 0x34, 0x14, 0x43, 0xd7, 0xd8, + 0x79, 0x45, 0x3a, 0xda, 0xd7, 0x62, 0x9a, 0x03, 0x6f, 0x76, 0x70, 0xd4, 0xb8, 0x6b, 0x55, 0x61, + 0x7b, 0x7f, 0x27, 0x1d, 0xeb, 0x1b, 0xd2, 0x74, 0x17, 0xb8, 0xcc, 0x70, 0xf2, 0x8f, 0x11, 0xaf, + 0x9e, 0xb8, 0x2a, 0x1c, 0xd7, 0x53, 0x40, 0x95, 0x61, 0xe9, 0x99, 0x7b, 0x8f, 0x32, 0x63, 0xf7, + 0xda, 0x19, 0xe1, 0x7e, 0x3b, 0x23, 0x3c, 0x68, 0x67, 0x84, 0x87, 0xed, 0x8c, 0xf0, 0xe1, 0x76, + 0x66, 0xec, 0xfe, 0x76, 0x66, 0xec, 0xc1, 0x76, 0x66, 0xec, 0xd6, 0x94, 0xcb, 0xea, 0xda, 0x24, + 0xfb, 0x27, 0x94, 0xf3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x6b, 0x91, 0x64, 0xfa, 0x32, + 0x00, 0x00, +} diff --git a/pkg/util/log/eventpb/ddl_events.proto b/pkg/util/log/eventpb/ddl_events.proto new file mode 100644 index 000000000000..600aae4baaba --- /dev/null +++ b/pkg/util/log/eventpb/ddl_events.proto @@ -0,0 +1,487 @@ +// Copyright 2020 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. + +syntax = "proto3"; +package cockroach.util.log.eventpb; +option go_package = "eventpb"; + +import "gogoproto/gogo.proto"; +import "util/log/eventpb/events.proto"; + +// CreateDatabase is recorded when a database is created. +message CreateDatabase { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the new database. + string database_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// DropDatabase is recorded when a database is dropped. +message DropDatabase { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected database. + string database_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The names of the schemas dropped by a cascade operation. + repeated string dropped_schema_objects = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// RenameDatabase is recorded when a database is renamed. +message RenameDatabase { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The old name of the affected database. + string database_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The new name of the affected database. + string new_database_name = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// ConvertToSchema is recorded when a database is converted to a schema. +message ConvertToSchema { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the database being converted to a schema. + string database_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the parent database for the new schema. + string new_database_parent = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// AlterDatabaseOwner is recorded when a database's owner is changed. +message AlterDatabaseOwner { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the database being affected. + string database_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the new owner. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + + +// CreateSchema is recorded when a schema is created. +message CreateSchema { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the new schema. + string schema_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the owner for the new schema. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// DropSchema is recorded when a schema is dropped. +message DropSchema { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected schema. + string schema_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// RenameSchema is recorded when a schema is renamed. +message RenameSchema { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The old name of the affected schema. + string schema_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The new name of the affected schema. + string new_schema_name = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// AlterSchemaOwner is recorded when a schema's owner is changed. +message AlterSchemaOwner { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected schema. + string schema_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the new owner. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CreateTable is recorded when a table is created. +message CreateTable { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the new table. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the owner for the new table. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// DropTable is recorded when a table is dropped. +message DropTable { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected table. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The names of the views dropped as a result of a cascade operation. + repeated string cascade_dropped_views = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// RenameTable is recorded when a table, sequence or view is renamed. +message RenameTable { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The old name of the affected table. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The new name of the affected table. + string new_table_name = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// TruncateTable is recorded when a table is truncated. +message TruncateTable { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected table. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// AlterTable is recorded when a table is altered. +message AlterTable { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected table. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The mutation ID for the asynchronous job that is processing the index update, if any. + uint32 mutation_id = 4 [(gogoproto.customname) = "MutationID", (gogoproto.jsontag) = ",omitempty"]; + // The names of the views dropped as a result of a cascade operation. + repeated string cascade_dropped_views = 5 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommentOnColumn is recorded when a column is commented. +message CommentOnColumn { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the table containing the affected column. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The affected column. + string column_name = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The new comment. + string comment = 5 [(gogoproto.jsontag) = ",omitempty"]; + // Set to true if the comment was removed entirely. + bool null_comment = 6 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommentOnTable is recorded when a database is commented. +message CommentOnDatabase { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected database. + string database_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The new comment. + string comment = 4 [(gogoproto.jsontag) = ",omitempty"]; + // Set to true if the comment was removed entirely. + bool null_comment = 6 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommentOnTable is recorded when a table is commented. +message CommentOnTable { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected table. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The new comment. + string comment = 4 [(gogoproto.jsontag) = ",omitempty"]; + // Set to true if the comment was removed entirely. + bool null_comment = 6 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommentOnIndex is recorded when an index is commented. +message CommentOnIndex { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the table containing the affected index. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the affected index. + string index_name = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The new comment. + string comment = 5 [(gogoproto.jsontag) = ",omitempty"]; + // Set to true if the comment was removed entirely. + bool null_comment = 6 [(gogoproto.jsontag) = ",omitempty"]; +} + + +// CreateIndex is recorded when an index is created. +message CreateIndex { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the table containing the new index. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the new index. + string index_name = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The mutation ID for the asynchronous job that is processing the index update. + uint32 mutation_id = 5 [(gogoproto.customname) = "MutationID", (gogoproto.jsontag) = ",omitempty"]; +} + +// DropIndex is recorded when an index is dropped. +message DropIndex { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the table containing the affected index. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the affected index. + string index_name = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The mutation ID for the asynchronous job that is processing the index update. + uint32 mutation_id = 5 [(gogoproto.customname) = "MutationID", (gogoproto.jsontag) = ",omitempty"]; + // The names of the views dropped as a result of a cascade operation. + repeated string cascade_dropped_views = 6; +} + +// AlterIndex is recorded when an index is altered. +message AlterIndex { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the table containing the affected index. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the affected index. + string index_name = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The mutation ID for the asynchronous job that is processing the index update. + uint32 mutation_id = 5 [(gogoproto.customname) = "MutationID", (gogoproto.jsontag) = ",omitempty"]; +} + + +// CreateView is recorded when a view is created. +message CreateView { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the new view. + string view_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the owner of the new view. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The SQL selection clause used to define the view. + string view_query = 5 [(gogoproto.jsontag) = ",omitempty"]; +} + +// DropView is recorded when a view is dropped. +message DropView { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected view. + string view_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The names of the views dropped as a result of a cascade operation. + repeated string cascade_dropped_views = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + + +// CreateSequence is recorded when a sequence is created. +message CreateSequence { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the new sequence. + string sequence_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the owner for the new sequence. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// DropSequence is recorded when a sequence is dropped. +message DropSequence { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected sequence. + string sequence_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// AlterSequence is recorded when a sequence is altered. +message AlterSequence { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected sequence. + string sequence_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommonSchemaChangeDetails contains the fields common to all +// background schema changes. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +message CommonSchemaChangeEventDetails { + // The instance ID (not tenant ID) of the SQL server where the event + // was originated. + int32 instance_id = 1 [(gogoproto.customname) = "InstanceID", (gogoproto.jsontag) = ",omitempty"]; + + // The primary object descriptor affected by the operation. Set to + // zero for operations that don't affect descriptors. + uint32 descriptor_id = 2 [(gogoproto.customname) = "DescriptorID", (gogoproto.jsontag) = ",omitempty"]; + + // The descriptor mutation that this schema change was processing. + uint32 mutation_id = 3 [(gogoproto.customname) = "MutationID", (gogoproto.jsontag) = ",omitempty"]; +} + + +// ReverseSchemaChange is recorded when an in-progress schema change +// encounters a problem and is reversed. +message ReverseSchemaChange { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSchemaChangeEventDetails sc = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The error encountered that caused the schema change to be reversed. + // The specific format of the error is variable and can change across releases without warning. + string error = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The SQLSTATE code for the error. + string sqlstate = 5 [(gogoproto.customname) = "SQLSTATE", (gogoproto.jsontag) = ",omitempty"]; +} + +// FinishSchemaChange is recorded when a previously initiated schema +// change has completed. +message FinishSchemaChange { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSchemaChangeEventDetails sc = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + +// FinishSchemaChangeRollback is recorded when a previously +// initiated schema change rollback has completed. +message FinishSchemaChangeRollback { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSchemaChangeEventDetails sc = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + + +// CreateType is recorded when a user-defined type is created. +message CreateType { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the new type. + string type_name = 4 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the owner for the new type. + string owner = 5 [(gogoproto.jsontag) = ",omitempty"]; +} + +// DropType is recorded when a user-defined type is dropped. +message DropType { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected type. + string type_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// EventAlterType is recorded when a user-defined type is altered. +message AlterType { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected type. + string type_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// AlterTypeOwner is recorded when the owner of a user-defiend type is changed. +message AlterTypeOwner { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the affected type. + string type_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The name of the new owner. + string owner = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// RenameType is recorded when a user-defined type is renamed. +message RenameType { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The old name of the affected type. + string type_name = 3 [(gogoproto.jsontag) = ",omitempty"]; + // The new name of the affected type. + string new_type_name = 4 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommonZoneConfigDetails is common to zone config change events. +message CommonZoneConfigDetails { + // The target object of the zone config change. + string target = 1 [(gogoproto.jsontag) = ",omitempty"]; + // The applied zone config in YAML format. + string config = 2 [(gogoproto.jsontag) = ",omitempty"]; + // The SQL representation of the applied zone config options. + repeated string options = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + +// SetZoneConfig is recorded when a zone config is changed. +message SetZoneConfig { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonZoneConfigDetails config = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + +// RemoveZoneConfig is recorded when a zone config is removed. +message RemoveZoneConfig { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonZoneConfigDetails config = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; +} + + +// CreateStatistics is recorded when statistics are collected for a +// table. +message CreateStatistics { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + // The name of the table for which the statistics were created. + string table_name = 3 [(gogoproto.jsontag) = ",omitempty"]; +} + + + +// UnsafeUpsertDescriptor is recorded when a descriptor is written +// using crdb_internal.unsafe_upsert_descriptor(). +message UnsafeUpsertDescriptor { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + string previous_descriptor = 3 [(gogoproto.jsontag) = ",omitempty"]; + string new_descriptor = 4 [(gogoproto.jsontag) = ",omitempty"]; + bool force = 5 [(gogoproto.jsontag) = ",omitempty"]; + string force_notice = 6 [(gogoproto.jsontag) = ",omitempty"]; +} + + +// UnsafeDeleteDescriptor is recorded when a descriptor is written +// using crdb_internal.unsafe_delete_descriptor(). +// +// The fields of this event type are reserved and can change across +// patch releases without advance notice. +message UnsafeDeleteDescriptor { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + uint32 parent_id = 3 [(gogoproto.customname) = "ParentID", (gogoproto.jsontag) = ",omitempty"]; + uint32 parent_schema_id = 4 [(gogoproto.customname) = "ParentSchemaID", (gogoproto.jsontag) = ",omitempty"]; + string name = 5 [(gogoproto.jsontag) = ",omitempty"]; + bool force = 6 [(gogoproto.jsontag) = ",omitempty"]; + string force_notice = 7 [(gogoproto.jsontag) = ",omitempty"]; +} + + +// UnsafeUpsertNamespaceEntry is recorded when a namespace entry is +// written using crdb_internal.unsafe_upsert_namespace_entry(). +// +// The fields of this event type are reserved and can change across +// patch releases without advance notice. +message UnsafeUpsertNamespaceEntry { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + uint32 parent_id = 3 [(gogoproto.customname) = "ParentID", (gogoproto.jsontag) = ",omitempty"]; + uint32 parent_schema_id = 4 [(gogoproto.customname) = "ParentSchemaID", (gogoproto.jsontag) = ",omitempty"]; + string name = 5 [(gogoproto.jsontag) = ",omitempty"]; + uint32 previous_id = 6 [(gogoproto.customname) = "PreviousID", (gogoproto.jsontag) = ",omitempty"]; + bool force = 7 [(gogoproto.jsontag) = ",omitempty"]; + bool failed_validation = 8 [(gogoproto.jsontag) = ",omitempty"]; + string validation_errors = 9 [(gogoproto.jsontag) = ",omitempty"]; +} + + +// UnsafeDeleteNamespaceEntry is recorded when a namespace entry is +// written using crdb_internal.unsafe_delete_namespace_entry(). +// +// The fields of this event type are reserved and can change across +// patch releases without advance notice. +message UnsafeDeleteNamespaceEntry { + CommonEventDetails common = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + CommonSQLEventDetails sql = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "", (gogoproto.embed) = true]; + uint32 parent_id = 3 [(gogoproto.customname) = "ParentID", (gogoproto.jsontag) = ",omitempty"]; + uint32 parent_schema_id = 4 [(gogoproto.customname) = "ParentSchemaID", (gogoproto.jsontag) = ",omitempty"]; + string name = 5 [(gogoproto.jsontag) = ",omitempty"]; + bool force = 6 [(gogoproto.jsontag) = ",omitempty"]; + string force_notice = 7 [(gogoproto.jsontag) = ",omitempty"]; +} + diff --git a/pkg/util/log/eventpb/events.go b/pkg/util/log/eventpb/events.go new file mode 100644 index 000000000000..67a6444781da --- /dev/null +++ b/pkg/util/log/eventpb/events.go @@ -0,0 +1,55 @@ +package eventpb + +import ( + "reflect" + "strings" +) + +// GetEventTypeName retrieves the system.eventlog type name for the given payload. +func GetEventTypeName(event EventPayload) string { + // This logic takes the type names and converts from CamelCase to snake_case. + typeName := reflect.TypeOf(event).Elem().Name() + var res strings.Builder + res.WriteByte(typeName[0] + 'a' - 'A') + for i := 1; i < len(typeName); i++ { + if typeName[i] >= 'A' && typeName[i] <= 'Z' { + res.WriteByte('_') + res.WriteByte(typeName[i] + 'a' - 'A') + } else { + res.WriteByte(typeName[i]) + } + } + return res.String() +} + +// EventPayload is implemented by CommonEventDetails. +type EventPayload interface { + CommonDetails() *CommonEventDetails +} + +// CommonDetails implements the EventWithCommonPayload interface. +func (m *CommonEventDetails) CommonDetails() *CommonEventDetails { return m } + +// EventWithCommonSQLPayload is implemented by CommonSQLEventDetails. +type EventWithCommonSQLPayload interface { + EventPayload + CommonSQLDetails() *CommonSQLEventDetails +} + +// CommonSQLDetails implements the EventWithCommonSQLPayload interface. +func (m *CommonSQLEventDetails) CommonSQLDetails() *CommonSQLEventDetails { return m } + +// EventWithCommonSchemaChangePayload is implemented by CommonSchemaChangeDetails. +type EventWithCommonSchemaChangePayload interface { + EventPayload + CommonSchemaChangeDetails() *CommonSchemaChangeEventDetails +} + +// CommonSchemaChangeDetails implements the EventWithCommonSchemaChangePayload interface. +func (m *CommonSchemaChangeEventDetails) CommonSchemaChangeDetails() *CommonSchemaChangeEventDetails { + return m +} + +var _ EventWithCommonSchemaChangePayload = (*FinishSchemaChange)(nil) +var _ EventWithCommonSchemaChangePayload = (*ReverseSchemaChange)(nil) +var _ EventWithCommonSchemaChangePayload = (*FinishSchemaChangeRollback)(nil) diff --git a/pkg/util/log/eventpb/events.pb.go b/pkg/util/log/eventpb/events.pb.go new file mode 100644 index 000000000000..ea5efc678130 --- /dev/null +++ b/pkg/util/log/eventpb/events.pb.go @@ -0,0 +1,653 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: util/log/eventpb/events.proto + +package eventpb + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// CommonEventDetails contains the fields common to all events. +// +// Notes: +// - the fields have jsontag ",..." to override the default +// JSON field name generated by the protobuf compiler. +// We want to keep the cased names for compatibility +// with system.eventlog. +// - likewise, the entire CommonEventDetails payload is marked +// as embedded and its json tag is removed in every event log +// message before, to ensure that it appears inline in JSON, again +// for compatibility with system.eventlog. +// +// Beware: because this is marked inline in the individual events, +// care must be taken to not reuse field identifiers across the +// message types, otherwise the JSON conversions cannot work. +type CommonEventDetails struct { + // The timestamp of the event. + Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,proto3,stdtime" json:",omitempty"` + // The type of the event. + EventType string `protobuf:"bytes,2,opt,name=event_type,json=eventType,proto3" json:",omitempty"` +} + +func (m *CommonEventDetails) Reset() { *m = CommonEventDetails{} } +func (m *CommonEventDetails) String() string { return proto.CompactTextString(m) } +func (*CommonEventDetails) ProtoMessage() {} +func (*CommonEventDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_events_927ca545c7be3481, []int{0} +} +func (m *CommonEventDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonEventDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommonEventDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonEventDetails.Merge(dst, src) +} +func (m *CommonEventDetails) XXX_Size() int { + return m.Size() +} +func (m *CommonEventDetails) XXX_DiscardUnknown() { + xxx_messageInfo_CommonEventDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonEventDetails proto.InternalMessageInfo + +// CommonSQLEventDetails contains the fields common to all +// SQL events. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +type CommonSQLEventDetails struct { + // A normalized copy of the SQL statement that triggered the event. + Statement string `protobuf:"bytes,1,opt,name=statement,proto3" json:",omitempty"` + // The user account that triggered the event. + User string `protobuf:"bytes,2,opt,name=user,proto3" json:",omitempty"` + // The instance ID (not tenant ID) of the SQL server where the event was originated. + InstanceID int32 `protobuf:"varint,3,opt,name=instance_id,json=instanceId,proto3" json:",omitempty"` + // The primary object descriptor affected by the operation. Set to zero for operations + // that don't affect descriptors. + DescriptorID uint32 `protobuf:"varint,4,opt,name=descriptor_id,json=descriptorId,proto3" json:",omitempty"` +} + +func (m *CommonSQLEventDetails) Reset() { *m = CommonSQLEventDetails{} } +func (m *CommonSQLEventDetails) String() string { return proto.CompactTextString(m) } +func (*CommonSQLEventDetails) ProtoMessage() {} +func (*CommonSQLEventDetails) Descriptor() ([]byte, []int) { + return fileDescriptor_events_927ca545c7be3481, []int{1} +} +func (m *CommonSQLEventDetails) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommonSQLEventDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (dst *CommonSQLEventDetails) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommonSQLEventDetails.Merge(dst, src) +} +func (m *CommonSQLEventDetails) XXX_Size() int { + return m.Size() +} +func (m *CommonSQLEventDetails) XXX_DiscardUnknown() { + xxx_messageInfo_CommonSQLEventDetails.DiscardUnknown(m) +} + +var xxx_messageInfo_CommonSQLEventDetails proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CommonEventDetails)(nil), "cockroach.util.log.eventpb.CommonEventDetails") + proto.RegisterType((*CommonSQLEventDetails)(nil), "cockroach.util.log.eventpb.CommonSQLEventDetails") +} +func (m *CommonEventDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonEventDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintEvents(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) + n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + if len(m.EventType) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintEvents(dAtA, i, uint64(len(m.EventType))) + i += copy(dAtA[i:], m.EventType) + } + return i, nil +} + +func (m *CommonSQLEventDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommonSQLEventDetails) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Statement) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintEvents(dAtA, i, uint64(len(m.Statement))) + i += copy(dAtA[i:], m.Statement) + } + if len(m.User) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintEvents(dAtA, i, uint64(len(m.User))) + i += copy(dAtA[i:], m.User) + } + if m.InstanceID != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintEvents(dAtA, i, uint64(m.InstanceID)) + } + if m.DescriptorID != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintEvents(dAtA, i, uint64(m.DescriptorID)) + } + return i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *CommonEventDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovEvents(uint64(l)) + l = len(m.EventType) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *CommonSQLEventDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Statement) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.User) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.InstanceID != 0 { + n += 1 + sovEvents(uint64(m.InstanceID)) + } + if m.DescriptorID != 0 { + n += 1 + sovEvents(uint64(m.DescriptorID)) + } + return n +} + +func sovEvents(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CommonEventDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonEventDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonEventDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EventType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommonSQLEventDetails) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommonSQLEventDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommonSQLEventDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Statement", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Statement = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InstanceID", wireType) + } + m.InstanceID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InstanceID |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DescriptorID", wireType) + } + m.DescriptorID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DescriptorID |= (uint32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthEvents + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipEvents(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("util/log/eventpb/events.proto", fileDescriptor_events_927ca545c7be3481) +} + +var fileDescriptor_events_927ca545c7be3481 = []byte{ + // 368 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4f, 0xab, 0x40, + 0x14, 0x86, 0x99, 0x7b, 0x7b, 0xef, 0x0d, 0xd3, 0xf6, 0x2e, 0x88, 0x9a, 0x86, 0xe8, 0x40, 0xba, + 0xc2, 0xa4, 0x42, 0xa2, 0x6b, 0x37, 0xb4, 0x2e, 0x48, 0x5c, 0x68, 0xed, 0xca, 0x4d, 0x43, 0x61, + 0x44, 0x22, 0x70, 0x08, 0x9c, 0x9a, 0xf4, 0x5f, 0x74, 0xe3, 0x7f, 0xea, 0xb2, 0xcb, 0xae, 0x50, + 0xe9, 0xce, 0xc4, 0xff, 0x60, 0x80, 0x7e, 0xa4, 0x7e, 0xac, 0x60, 0xe6, 0x3c, 0xef, 0x33, 0x6f, + 0x72, 0xe8, 0xd1, 0x18, 0xfd, 0xc0, 0x08, 0xc0, 0x33, 0xf8, 0x23, 0x8f, 0x30, 0x1e, 0x55, 0xdf, + 0x54, 0x8f, 0x13, 0x40, 0x90, 0x64, 0x07, 0x9c, 0x87, 0x04, 0x6c, 0xe7, 0x5e, 0x2f, 0x40, 0x3d, + 0x00, 0x4f, 0x5f, 0x81, 0xf2, 0x9e, 0x07, 0x1e, 0x94, 0x98, 0x51, 0xfc, 0x55, 0x09, 0x59, 0xf1, + 0x00, 0xbc, 0x80, 0x1b, 0xe5, 0x69, 0x34, 0xbe, 0x33, 0xd0, 0x0f, 0x79, 0x8a, 0x76, 0x18, 0x57, + 0x40, 0xfb, 0x89, 0x50, 0xa9, 0x0b, 0x61, 0x08, 0xd1, 0x45, 0x21, 0xea, 0x71, 0xb4, 0xfd, 0x20, + 0x95, 0xae, 0xa8, 0xb8, 0x21, 0x5b, 0x44, 0x25, 0x5a, 0xfd, 0x54, 0xd6, 0x2b, 0x97, 0xbe, 0x76, + 0xe9, 0x83, 0x35, 0x61, 0x1e, 0xcc, 0x32, 0x45, 0x78, 0xcb, 0x14, 0xda, 0x81, 0xd0, 0x47, 0x1e, + 0xc6, 0x38, 0x99, 0x3e, 0x2b, 0xa4, 0xbf, 0x95, 0x48, 0x27, 0x94, 0x96, 0x55, 0x87, 0x38, 0x89, + 0x79, 0xeb, 0x97, 0x4a, 0x34, 0xd1, 0xfc, 0xbf, 0x1b, 0xe9, 0x8b, 0x25, 0x31, 0x98, 0xc4, 0xbc, + 0xfd, 0x4e, 0xe8, 0x7e, 0xd5, 0xeb, 0xe6, 0xfa, 0x72, 0xa7, 0x5a, 0x87, 0x8a, 0x29, 0xda, 0xc8, + 0x43, 0x1e, 0x61, 0x59, 0xed, 0x1b, 0xcf, 0x06, 0x90, 0xda, 0xb4, 0x36, 0x4e, 0x79, 0xf2, 0xc3, + 0x83, 0xe5, 0x4c, 0x3a, 0xa7, 0x75, 0x3f, 0x4a, 0xd1, 0x8e, 0x1c, 0x3e, 0xf4, 0xdd, 0xd6, 0x6f, + 0x95, 0x68, 0x7f, 0xcc, 0xc3, 0x3c, 0x53, 0xa8, 0xb5, 0xba, 0xb6, 0x7a, 0x9f, 0x82, 0x74, 0x1d, + 0xb0, 0x5c, 0xa9, 0x4b, 0x9b, 0x2e, 0x4f, 0x9d, 0xc4, 0x8f, 0x11, 0x92, 0x42, 0x50, 0x53, 0x89, + 0xd6, 0x34, 0x59, 0x9e, 0x29, 0x8d, 0xde, 0x66, 0xf0, 0x45, 0xd1, 0xd8, 0x86, 0x2c, 0xd7, 0x3c, + 0x9e, 0xbd, 0x32, 0x61, 0x96, 0x33, 0x32, 0xcf, 0x19, 0x59, 0xe4, 0x8c, 0xbc, 0xe4, 0x8c, 0x4c, + 0x97, 0x4c, 0x98, 0x2f, 0x99, 0xb0, 0x58, 0x32, 0xe1, 0xf6, 0xdf, 0x6a, 0xd3, 0xa3, 0xbf, 0xe5, + 0x02, 0xce, 0x3e, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdd, 0xb9, 0x13, 0x27, 0x2d, 0x02, 0x00, 0x00, +} diff --git a/pkg/util/log/eventpb/events.proto b/pkg/util/log/eventpb/events.proto new file mode 100644 index 000000000000..8cad9f158fdf --- /dev/null +++ b/pkg/util/log/eventpb/events.proto @@ -0,0 +1,62 @@ +// Copyright 2020 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. + +syntax = "proto3"; +package cockroach.util.log.eventpb; +option go_package = "eventpb"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +// CommonEventDetails contains the fields common to all events. +// +// Notes: +// - the fields have jsontag ",..." to override the default +// JSON field name generated by the protobuf compiler. +// We want to keep the cased names for compatibility +// with system.eventlog. +// - likewise, the entire CommonEventDetails payload is marked +// as embedded and its json tag is removed in every event log +// message before, to ensure that it appears inline in JSON, again +// for compatibility with system.eventlog. +// +// Beware: because this is marked inline in the individual events, +// care must be taken to not reuse field identifiers across the +// message types, otherwise the JSON conversions cannot work. +message CommonEventDetails { + // The timestamp of the event. + google.protobuf.Timestamp timestamp = 1 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true, (gogoproto.jsontag) = ",omitempty"]; + // The type of the event. + string event_type = 2 [(gogoproto.jsontag) = ",omitempty"]; +} + +// CommonSQLEventDetails contains the fields common to all +// SQL events. +// +// As above, the field is marked inline in the events below to +// preserve compatibility with system.eventlog. Likewise, because this +// is marked inline in the individual events, care must be taken to +// not reuse field identifiers across the message types, otherwise the +// JSON conversions cannot work. +message CommonSQLEventDetails { + // A normalized copy of the SQL statement that triggered the event. + string statement = 1 [(gogoproto.jsontag) = ",omitempty"]; + + // The user account that triggered the event. + string user = 2 [(gogoproto.jsontag) = ",omitempty"]; + + // The instance ID (not tenant ID) of the SQL server where the event was originated. + int32 instance_id = 3 [(gogoproto.customname) = "InstanceID", (gogoproto.jsontag) = ",omitempty"]; + + // The primary object descriptor affected by the operation. Set to zero for operations + // that don't affect descriptors. + uint32 descriptor_id = 4 [(gogoproto.customname) = "DescriptorID" , (gogoproto.jsontag) = ",omitempty"]; +} + diff --git a/pkg/util/log/eventpb/events_test.go b/pkg/util/log/eventpb/events_test.go new file mode 100644 index 000000000000..30fe65e1a0b2 --- /dev/null +++ b/pkg/util/log/eventpb/events_test.go @@ -0,0 +1,16 @@ +package eventpb + +import ( + "encoding/json" + "testing" +) + +func TestEvents(t *testing.T) { + e := &EventCreateDatabase{CommonEventDetails{User: "hello"}} + b, err := json.Marshal(e) + if err != nil { + t.Fatal(err) + } + + t.Errorf("WOO %s", b) +} diff --git a/pkg/util/log/eventpb/gen.go b/pkg/util/log/eventpb/gen.go new file mode 100644 index 000000000000..172af40c1b95 --- /dev/null +++ b/pkg/util/log/eventpb/gen.go @@ -0,0 +1,273 @@ +// Copyright 2020 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. + +// +build ignore + +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "regexp" + "sort" + "strings" + "text/template" + + "github.com/cockroachdb/cockroach/pkg/cli/exit" + "github.com/cockroachdb/errors" + "github.com/cockroachdb/gostdlib/go/format" +) + +func main() { + if err := run(); err != nil { + fmt.Fprintln(os.Stderr, "ERROR:", err) + exit.WithCode(exit.UnspecifiedError()) + } +} + +type eventInfo struct { + Comment string + Type string + Fields []fieldInfo + InheritedFields []fieldInfo +} + +type fieldInfo struct { + Comment string + FieldType string + FieldName string +} + +func run() error { + if len(os.Args) < 3 { + return errors.Newf("usage: %s