Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
66735: sql: add datadriven tests for multiregion tables r=arulajmani a=pawalt

Previously, we only had datadriven tests for GLOBAL tables.
This patch adds datadriven tests for REGIONAL BY TABLE tables.

Release note: None

68017: bazel: bazelfy logging documentation r=rail a=rickystewart

In doing so, I also noticed a couple generated `.go` files that weren't
yet bazelfied, so I took care of them too.

Closes #65812.

Release note: None

68078: bazel: add build target for generated bnf's r=rail a=rickystewart

Closes #65815.

Release note: None

68189: streamingccl: fix double close in test feed source r=miretskiy a=adityamaru

Previously, the close implementation of channelFeedSource
closed the `eventCh` as a means of shutting down the client.
This seems wrong since the client is the "owner" of this
channel and should be the only one responsible for closing
it. In cases where the method `consumeUntil` hit an error
(max wait timeout in our case) we would close the eventCh
as part of calling channelFeedSource's Close(), and we would
attempt a double close in the sinkless client itself.

This change switches to cancelling the sinkless client's
context to indicate to the client that it should shutdown.

I was not able to reproduce this error (5000 stress runs),
but I bumped the timeout from 10 seconds to 20 seconds
based on stack traces in the failed builds.

Fixes: #68168
Fixes: #67592

Release note: None

Co-authored-by: Peyton Walters <[email protected]>
Co-authored-by: Ricky Stewart <[email protected]>
Co-authored-by: Aditya Maru <[email protected]>
  • Loading branch information
4 people committed Jul 28, 2021
5 parents c4702ef + b50d297 + 45e72b7 + 9152842 + 080f904 commit dbd4e53
Show file tree
Hide file tree
Showing 15 changed files with 951 additions and 112 deletions.
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:exclude pkg/sql/schemachanger/scop/mutation_visitor_generated.go
# gazelle:exclude pkg/sql/schemachanger/scop/validation_visitor_generated.go
# gazelle:exclude pkg/util/log/channel/channel_generated.go
# gazelle:exclude pkg/util/log/eventpb/eventlog_channels_generated.go
# gazelle:exclude pkg/util/log/eventpb/json_encode_generated.go
# gazelle:exclude pkg/util/log/log_channels_generated.go
# gazelle:exclude pkg/util/log/severity/severity_generated.go
# gazelle:exclude pkg/util/timeutil/lowercase_timezones_generated.go
Expand Down
49 changes: 49 additions & 0 deletions docs/generated/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//pkg/util/log/eventpb:PROTOS.bzl", _EVENTPB_PROTO_LOCATIONS = "EVENTPB_PROTO_LOCATIONS")

genrule(
name = "gen-logging-md",
srcs = [
Expand All @@ -12,3 +14,50 @@ genrule(
"//pkg/util/log/gen",
],
)

genrule(
name = "gen-logsinks-md",
srcs = [
"//pkg/util/log/logconfig:config.go",
],
outs = ["logsinks.md"],
cmd = """
$(location //pkg/util/log/logconfig:gen) < $(location //pkg/util/log/logconfig:config.go) > $(location logsinks.md)
""",
exec_tools = [
"//pkg/util/log/logconfig:gen",
],
)

genrule(
name = "gen-eventlog-md",
srcs = [
"//pkg/util/log/eventpb:cluster_events.proto",
"//pkg/util/log/eventpb:ddl_events.proto",
"//pkg/util/log/eventpb:events.proto",
"//pkg/util/log/eventpb:health_events.proto",
"//pkg/util/log/eventpb:job_events.proto",
"//pkg/util/log/eventpb:misc_sql_events.proto",
"//pkg/util/log/eventpb:privilege_events.proto",
"//pkg/util/log/eventpb:role_events.proto",
"//pkg/util/log/eventpb:session_events.proto",
"//pkg/util/log/eventpb:sql_audit_events.proto",
"//pkg/util/log/eventpb:zone_events.proto",
],
outs = ["eventlog.md"],
cmd = """
$(location //pkg/util/log/eventpb:gen) eventlog.md \
{} \
>$(location eventlog.md)
""".format(_EVENTPB_PROTO_LOCATIONS),
exec_tools = [
"//pkg/util/log/eventpb:gen",
],
)

genrule(
name = "gen-logformats-md",
outs = ["logformats.md"],
cmd = "$(location //pkg/cmd/docgen) logformats $(location logformats.md)",
exec_tools = ["//pkg/cmd/docgen"],
)
6 changes: 1 addition & 5 deletions docs/generated/sql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ genrule(
"window_functions.md",
],
cmd = """
$(location //pkg/cmd/docgen) functions . --quiet
mv aggregates.md $(location aggregates.md)
mv functions.md $(location functions.md)
mv operators.md $(location operators.md)
mv window_functions.md $(location window_functions.md)
$(location //pkg/cmd/docgen) functions $(RULEDIR) --quiet
""",
exec_tools = ["//pkg/cmd/docgen"],
)
239 changes: 239 additions & 0 deletions docs/generated/sql/bnf/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
genrule(
name = "bnf",
srcs = ["//pkg/sql/parser:sql.y"],
outs = [
"abort_stmt.bnf",
"add_column.bnf",
"add_constraint.bnf",
"alter_column.bnf",
"alter_database_add_region_stmt.bnf",
"alter_database_drop_region.bnf",
"alter_database_owner.bnf",
"alter_database_primary_region.bnf",
"alter_database_stmt.bnf",
"alter_database_survival_goal_stmt.bnf",
"alter_database_to_schema_stmt.bnf",
"alter_ddl_stmt.bnf",
"alter_default_privileges_stmt.bnf",
"alter_index_partition_by.bnf",
"alter_index_stmt.bnf",
"alter_partition_stmt.bnf",
"alter_primary_key.bnf",
"alter_range_stmt.bnf",
"alter_rename_view_stmt.bnf",
"alter_role_stmt.bnf",
"alter_scatter_index_stmt.bnf",
"alter_scatter_stmt.bnf",
"alter_schema.bnf",
"alter_sequence.bnf",
"alter_sequence_options_stmt.bnf",
"alter_sequence_owner_stmt.bnf",
"alter_sequence_set_schema_stmt.bnf",
"alter_stmt.bnf",
"alter_table.bnf",
"alter_table_locality_stmt.bnf",
"alter_table_owner_stmt.bnf",
"alter_table_partition_by.bnf",
"alter_table_set_schema_stmt.bnf",
"alter_table_stmt.bnf",
"alter_type.bnf",
"alter_view.bnf",
"alter_view_owner_stmt.bnf",
"alter_view_set_schema_stmt.bnf",
"alter_zone_database_stmt.bnf",
"alter_zone_index_stmt.bnf",
"alter_zone_partition_stmt.bnf",
"alter_zone_range_stmt.bnf",
"alter_zone_table_stmt.bnf",
"analyze_stmt.bnf",
"backup.bnf",
"begin_stmt.bnf",
"begin_transaction.bnf",
"cancel_job.bnf",
"cancel_query.bnf",
"cancel_session.bnf",
"cancel_stmt.bnf",
"check_column_level.bnf",
"check_table_level.bnf",
"close_cursor_stmt.bnf",
"col_qualification.bnf",
"column_def.bnf",
"comment.bnf",
"commit_transaction.bnf",
"copy_from_stmt.bnf",
"create_as_col_qual_list.bnf",
"create_as_constraint_def.bnf",
"create_changefeed_stmt.bnf",
"create_database_stmt.bnf",
"create_ddl_stmt.bnf",
"create_extension_stmt.bnf",
"create_index_interleaved_stmt.bnf",
"create_index_stmt.bnf",
"create_inverted_index_stmt.bnf",
"create_replication_stream_stmt.bnf",
"create_role_stmt.bnf",
"create_schedule_for_backup_stmt.bnf",
"create_schema_stmt.bnf",
"create_sequence_stmt.bnf",
"create_stats_stmt.bnf",
"create_stmt.bnf",
"create_table_as_stmt.bnf",
"create_table_partition_by.bnf",
"create_table_stmt.bnf",
"create_type.bnf",
"create_view_stmt.bnf",
"deallocate_stmt.bnf",
"default_value_column_level.bnf",
"delete_stmt.bnf",
"discard_stmt.bnf",
"drop_column.bnf",
"drop_constraint.bnf",
"drop_database.bnf",
"drop_ddl_stmt.bnf",
"drop_index.bnf",
"drop_owned_by_stmt.bnf",
"drop_role_stmt.bnf",
"drop_schedule_stmt.bnf",
"drop_schema.bnf",
"drop_sequence_stmt.bnf",
"drop_stmt.bnf",
"drop_table.bnf",
"drop_type.bnf",
"drop_view.bnf",
"execute_stmt.bnf",
"experimental_audit.bnf",
"explain_analyze_stmt.bnf",
"explain_stmt.bnf",
"explainable_stmt.bnf",
"export_stmt.bnf",
"family_def.bnf",
"for_locking.bnf",
"foreign_key_column_level.bnf",
"foreign_key_table_level.bnf",
"generic_set.bnf",
"grant_stmt.bnf",
"import_csv.bnf",
"import_dump.bnf",
"import_into.bnf",
"index_def.bnf",
"insert_rest.bnf",
"insert_stmt.bnf",
"interleave.bnf",
"iso_level.bnf",
"joined_table.bnf",
"like_table_option_list.bnf",
"limit_clause.bnf",
"not_null_column_level.bnf",
"offset_clause.bnf",
"on_conflict.bnf",
"opt_frame_clause.bnf",
"opt_interleave.bnf",
"opt_locality.bnf",
"opt_persistence_temp_table.bnf",
"opt_with_storage_parameter_list.bnf",
"pause_job.bnf",
"pause_schedule.bnf",
"pause_stmt.bnf",
"preparable_stmt.bnf",
"prepare_stmt.bnf",
"primary_key_column_level.bnf",
"primary_key_table_level.bnf",
"reassign_owned_by_stmt.bnf",
"refresh_materialized_views.bnf",
"release_savepoint.bnf",
"rename_column.bnf",
"rename_constraint.bnf",
"rename_database.bnf",
"rename_index.bnf",
"rename_sequence.bnf",
"rename_table.bnf",
"reset_csetting_stmt.bnf",
"reset_session_stmt.bnf",
"reset_stmt.bnf",
"restore.bnf",
"resume_job.bnf",
"resume_schedule.bnf",
"resume_stmt.bnf",
"revoke_stmt.bnf",
"rollback_transaction.bnf",
"row_source_extension_stmt.bnf",
"savepoint_stmt.bnf",
"scrub_database_stmt.bnf",
"scrub_stmt.bnf",
"scrub_table_stmt.bnf",
"select_clause.bnf",
"select_stmt.bnf",
"set_cluster_setting.bnf",
"set_csetting_stmt.bnf",
"set_exprs_internal.bnf",
"set_operation.bnf",
"set_rest_more.bnf",
"set_session_stmt.bnf",
"set_transaction.bnf",
"set_transaction_stmt.bnf",
"set_var.bnf",
"show_backup.bnf",
"show_cluster_setting.bnf",
"show_columns_stmt.bnf",
"show_constraints.bnf",
"show_constraints_stmt.bnf",
"show_create_stmt.bnf",
"show_databases_stmt.bnf",
"show_enums.bnf",
"show_grants_stmt.bnf",
"show_index.bnf",
"show_indexes.bnf",
"show_jobs.bnf",
"show_keys.bnf",
"show_locality.bnf",
"show_locality_stmt.bnf",
"show_partitions_stmt.bnf",
"show_range_for_row_stmt.bnf",
"show_ranges_stmt.bnf",
"show_regions.bnf",
"show_roles_stmt.bnf",
"show_savepoint_status.bnf",
"show_schedules.bnf",
"show_schemas.bnf",
"show_sequences.bnf",
"show_session_stmt.bnf",
"show_sessions.bnf",
"show_statements.bnf",
"show_stats.bnf",
"show_survival_goal_stmt.bnf",
"show_tables.bnf",
"show_trace.bnf",
"show_transaction.bnf",
"show_transactions_stmt.bnf",
"show_types_stmt.bnf",
"show_users_stmt.bnf",
"show_var.bnf",
"show_zone_stmt.bnf",
"simple_select_clause.bnf",
"sort_clause.bnf",
"split_index_at.bnf",
"split_table_at.bnf",
"stmt.bnf",
"stmt_block.bnf",
"table_clause.bnf",
"table_constraint.bnf",
"table_ref.bnf",
"transaction_stmt.bnf",
"truncate_stmt.bnf",
"unique_column_level.bnf",
"unique_table_level.bnf",
"unsplit_index_at.bnf",
"unsplit_table_at.bnf",
"update_stmt.bnf",
"upsert_stmt.bnf",
"use_stmt.bnf",
"validate_constraint.bnf",
"values_clause.bnf",
"window_definition.bnf",
"with_clause.bnf",
],
cmd = """
$(location //pkg/cmd/docgen) grammar bnf $(RULEDIR) --quiet --addr $(location //pkg/sql/parser:sql.y)
""",
exec_tools = ["//pkg/cmd/docgen"],
)
Loading

0 comments on commit dbd4e53

Please sign in to comment.