Skip to content

Conversation

@DarrylWong
Copy link
Contributor

@DarrylWong DarrylWong commented Nov 3, 2025

In #156581, we started setting allow_unsafe_internals unconditionally for roachtests. However, there are a few edge cases where we can't set this. Namely when using psql to connect to a postgres database where the CRDB only parameter does not exist.

Fixes: #156702
Fixes: #156703
Fixes: #156706

Release note: none

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@DarrylWong DarrylWong marked this pull request as ready for review November 3, 2025 18:35
@DarrylWong DarrylWong requested a review from a team as a code owner November 3, 2025 18:35
@DarrylWong DarrylWong requested review from herkolategan and srosenberg and removed request for a team November 3, 2025 18:35

// Construct a connection URL to server i.
url := serverUrls[server-1]
url := fmt.Sprintf("{pgurl:%d}", server-1)
Copy link
Collaborator

@herkolategan herkolategan Nov 5, 2025

Choose a reason for hiding this comment

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

Should this not be just fmt.Sprintf("{pgurl:%d}", server), and not server-1, since I think expanders start from 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good catch, I was confused why the test didn't fail in this case, but it looks like it was "saved" by:

		if i == expectedLeaseholder {
			continue
		}

where expectedLeaseholder = 1

This test uses a pgurl as part of a shell command,
so it needs to be escaped to avoid any stray ampersands.
We sometimes need to construct pgurls for psql or postgres dbs
which don't support this CRDB only parameter.
@DarrylWong DarrylWong force-pushed the fix_unsafe_internals branch from 4fdcd7a to 8913ec0 Compare November 5, 2025 15:58
}

// Silence unused warning.
var _ = (&clusterImpl{}).InternalPGUrl
Copy link
Member

Choose a reason for hiding this comment

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

Good riddance.


// Construct a connection URL to server i.
url := serverUrls[server-1]
url := fmt.Sprintf("{pgurl:%d}", server)
Copy link
Member

Choose a reason for hiding this comment

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

Nice.

@DarrylWong
Copy link
Contributor Author

TFTRs

bors r=herkolategan, srosenberg

@craig craig bot merged commit 6708f9d into cockroachdb:master Nov 6, 2025
23 of 24 checks passed
@craig
Copy link
Contributor

craig bot commented Nov 6, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

4 participants