Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: Fix SHOW ZONE CONFIGURATIONS with very long constraints #69470

Merged
merged 1 commit into from
Aug 29, 2021

Conversation

ajstorm
Copy link
Collaborator

@ajstorm ajstorm commented Aug 27, 2021

Previously, in the presence of very long constraints fields, SHOW ZONE
CONFIGURATIONS would output the constraints with \n characters mixed in. This
was due to the fact that the yaml.v2 library contained an 80 character line
limit. We recently pulled in some commits to our fork of the yaml library which
allows the line length to be configurable. With that change, we can now
configure the line length to be unlimited in the case where we're showing the
zone configuration, and get around the ugliness of the \n characters.

Release note (sql change): Fixes a bug in SHOW ZONE CONFIGURATIONS where long
constraints fields may show \n characters.

Release justification: Low risk change to existing functionality.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajstorm and @rafiss)


pkg/sql/show_zone_config.go, line 178 at r1 (raw file):

// zoneConfigToSQL pretty prints a zone configuration as a SQL string.
func zoneConfigToSQL(zs *tree.ZoneSpecifier, zone *zonepb.ZoneConfig) (string, error) {
	yaml.FutureLineWrap()

nit: comment


pkg/sql/logictest/logic.go, line 687 at r1 (raw file):

	},
	{
		name:              "multiregion-3node-3superlongregions",

Do we anticipate using this configuration for any other tests? I'm not sure what the rule of thumb is when adding these one off configurations vs. writing a test that just uses a test cluster.

Copy link
Collaborator Author

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani and @rafiss)


pkg/sql/show_zone_config.go, line 178 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

nit: comment

Good call. Added.


pkg/sql/logictest/logic.go, line 687 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Do we anticipate using this configuration for any other tests? I'm not sure what the rule of thumb is when adding these one off configurations vs. writing a test that just uses a test cluster.

I was thinking that we might want to down the road, but I wanted to get this small test in first to confirm that the specific case I was hoping to address is covered.

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajstorm, @arulajmani, and @rafiss)


pkg/sql/logictest/logic.go, line 687 at r1 (raw file):

Previously, ajstorm (Adam Storm) wrote…

I was thinking that we might want to down the road, but I wanted to get this small test in first to confirm that the specific case I was hoping to address is covered.

That makes sense. I'd have a mild preference for making these "real" looking region names and having (say) 9 different regions in the configuration. Then, we could hit the character limit by adding more regions to the database instead. Such a configuration seems more generally useful as well.

Copy link
Collaborator Author

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani and @rafiss)


pkg/sql/logictest/logic.go, line 687 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

That makes sense. I'd have a mild preference for making these "real" looking region names and having (say) 9 different regions in the configuration. Then, we could hit the character limit by adding more regions to the database instead. Such a configuration seems more generally useful as well.

Fair point, but in the interest of expediency, I'll put this one off until we expand the scope of the test cases.

Copy link
Collaborator Author

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TFTR!

bors r=arulajmani

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani and @rafiss)

@craig
Copy link
Contributor

craig bot commented Aug 27, 2021

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Aug 27, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 27, 2021

This PR was included in a batch that was canceled, it will be automatically retried

@ajstorm
Copy link
Collaborator Author

ajstorm commented Aug 27, 2021

Have to be away from the computer tonight and all day tomorrow and don't want this to prevent others from merging (on the off chance that this hits issues). Cancelling for now and will try to catch a train on Sunday. Good luck fellow borsers!

bors r-

@craig
Copy link
Contributor

craig bot commented Aug 27, 2021

Canceled.

@ajstorm
Copy link
Collaborator Author

ajstorm commented Aug 29, 2021

bors r=arulajmani

@craig
Copy link
Contributor

craig bot commented Aug 29, 2021

Merge conflict.

Previously, in the presence of very long constraints fields, SHOW ZONE
CONFIGURATIONS would output the constraints with `\n` characters mixed in. This
was due to the fact that the yaml.v2 library contained an 80 character line
limit. We recently pulled in some commits to our fork of the yaml library which
allows the line length to be configurable. With that change, we can now
configure the line length to be unlimited in the case where we're showing the
zone configuration, and get around the ugliness of the `\n` characters.

Release note (sql change): Fixes a bug in SHOW ZONE CONFIGURATIONS where long
constraints fields may show `\n` characters.

Release justification: Low risk change to existing functionality.
@ajstorm
Copy link
Collaborator Author

ajstorm commented Aug 29, 2021

bors r=arulajmani

@craig
Copy link
Contributor

craig bot commented Aug 29, 2021

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants