Skip to content

Commit

Permalink
roachtest: use updated update_tenant_resource_limits signature in 24.3+
Browse files Browse the repository at this point in the history
The function signature of update_tenant_resource_limits was changed
in v24.2.1 to deprecate the args "as_of" and "as_of_consumed_tokens".
Since serverless currently only uses the `tenant_id` overload and
not the `tenant_name` overload like we do in mixedversion, the args
were removed completely from the latter.

This breaks backwards compatibility so this change selectively omits
the removed args if the version is 24.2.1+.
  • Loading branch information
DarrylWong committed Dec 10, 2024
1 parent 46e8e0f commit 55fcf6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/roachtestutil/mixedversion/mixedversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ var (
// would *not* make the tenant auto upgrade.
tenantSupportsAutoUpgradeVersion = clusterupgrade.MustParseVersion("v24.2.0-alpha.00000000")

// updateTenantResourceLimitsDeprecatedArgsVersion is the lowest version
// after which the "as_of" and "as_of_consumed_tokens" arguments were removed when
// using the `tenant_name` overload.
updateTenantResourceLimitsDeprecatedArgsVersion = clusterupgrade.MustParseVersion("v24.2.1")

// Catch divergences between `stepFunc` and `Run`'s signature in
// `singleStepProtocol` at compile time.
_ = func() stepFunc {
Expand Down
9 changes: 8 additions & 1 deletion pkg/cmd/roachtest/roachtestutil/mixedversion/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,17 @@ func (s disableRateLimitersStep) Run(
// to outright disable the tenant rate limiter. Instead, we instead set the tenant's
// resource limits to an arbitrarily high value.
stmt = fmt.Sprintf(
"SELECT crdb_internal.update_tenant_resource_limits('%s', %v, %v, %d, now(), 0);",
"SELECT crdb_internal.update_tenant_resourcet_limits('%s', %v, %v, %d, now(), 0);",
s.virtualClusterName, availableTokens, refillRate, maxBurstTokens,
)

if h.System.FromVersion.AtLeast(updateTenantResourceLimitsDeprecatedArgsVersion) {
stmt = fmt.Sprintf(
"SELECT crdb_internal.update_tenant_resource_limits('%s', %v, %v, %d);",
s.virtualClusterName, availableTokens, refillRate, maxBurstTokens,
)
}

return h.System.Exec(rng, stmt)
}

Expand Down

0 comments on commit 55fcf6b

Please sign in to comment.