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 decode the license from the the base64-encoded Protobuf representation in settings 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 `cluster.Settings.Cache` as a shared cache, and uses it to cache decoded licenses with a private key type. Release note: None
- Loading branch information
1 parent
0f424ea
commit a7c1f37
Showing
4 changed files
with
43 additions
and
28 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
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." | ||
|
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