forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, the `utilccl` package would base64-decode the license from the settings representation every time it was needed, which was sufficient for its uses. However, recently there's been a need to check whether enterprise features are enabled in hot paths (e.g. with follower reads as seen in cockroachdb#62447), making the decoding cost too great. This patch adds `decodeCached()` which caches the decoded license, and uses it where appropriate. Release note: None
- Loading branch information
1 parent
0493be1
commit a07d92a
Showing
4 changed files
with
37 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ func TestLicense(t *testing.T) { | |
} | ||
} | ||
if err := check( | ||
lic, tc.checkTime, tc.checkCluster, tc.checkOrg, "", | ||
lic, tc.checkTime, tc.checkCluster, tc.checkOrg, "", true, | ||
); !testutils.IsError(err, tc.err) { | ||
t.Fatalf("%d: lic for %s to %s, checked by %s at %s.\n got %q", i, | ||
tc.grantedTo, tc.expiration, tc.checkCluster, tc.checkTime, err) | ||
|
@@ -108,7 +108,7 @@ func TestExpiredLicenseLanguage(t *testing.T) { | |
Type: licenseccl.License_Evaluation, | ||
ValidUntilUnixSec: 1, | ||
} | ||
err := check(lic, timeutil.Now(), uuid.MakeV4(), "", "RESTORE") | ||
err := check(lic, timeutil.Now(), uuid.MakeV4(), "", "RESTORE", true) | ||
expected := "Use of RESTORE requires an enterprise license. Your evaluation license expired on " + | ||
"January 1, 1970. If you're interested in getting a new license, please contact " + | ||
"[email protected] and we can help you out." | ||
|