Apply suggestions from code review
Co-authored-by: A.J. Beamon <aj.beamon@snowflake.com> Co-authored-by: Junhyun Shim <junhyun.shim@snowflake.com>
This commit is contained in:
parent
a2ef5dc72a
commit
f268265d96
|
@ -3649,7 +3649,7 @@ ACTOR Future<Void> watchStorageServerResp(int64_t tenantId, Key key, Database cx
|
|||
|
||||
ACTOR Future<Void> sameVersionDiffValue(Database cx, Reference<WatchParameters> parameters) {
|
||||
state ReadYourWritesTransaction tr(
|
||||
cx, parameters->tenant.name.present() ? parameters->tenant.name.get() : Optional<TenantName>());
|
||||
cx, parameters->tenant.name.castTo<TenantName>());
|
||||
loop {
|
||||
try {
|
||||
if (!parameters->tenant.name.present()) {
|
||||
|
|
|
@ -40,7 +40,7 @@ bool TokenCacheImpl::validate(TenantNameRef name, StringRef token) {
|
|||
auto sig = authz::jwt::signaturePart(token);
|
||||
auto cachedEntry = cache.get(sig);
|
||||
double currentTime = g_network->timer();
|
||||
NetworkAddress peer = FlowTransport::transport().loadedEndpoint(UID()).getPrimaryAddress();
|
||||
NetworkAddress peer = FlowTransport::transport().currentDeliveryPeerAddress();
|
||||
|
||||
if (cachedEntry.has_value()) {
|
||||
auto& entry = cachedEntry.get();
|
||||
|
@ -49,6 +49,8 @@ bool TokenCacheImpl::validate(TenantNameRef name, StringRef token) {
|
|||
throw permission_denied();
|
||||
}
|
||||
if (entry.tenants.count(name) == 0) {
|
||||
TraceEvent(SevWarn, "TenantTokenMismatch").detail("From", peer).detail("Tenant", name.toString());
|
||||
throw permission_denied();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* TenantManagement.actor.cpp
|
||||
* CreateTenant.actor.cpp
|
||||
*
|
||||
* This source file is part of the FoundationDB open source project
|
||||
*
|
||||
|
|
|
@ -69,7 +69,7 @@ struct CycleWorkload : TestWorkload, CycleMembers<MultiTenancy> {
|
|||
ASSERT(g_network->isSimulated());
|
||||
auto k = g_simulator.authKeys.begin();
|
||||
this->tenant = getOption(options, "tenant"_sr, "CycleTenant"_sr);
|
||||
// make it confortably longer than the timeout of the workload
|
||||
// make it comfortably longer than the timeout of the workload
|
||||
auto currentTime = uint64_t(lround(g_network->timer()));
|
||||
this->token.algorithm = authz::Algorithm::ES256;
|
||||
this->token.issuedAtUnixTime = currentTime;
|
||||
|
|
Loading…
Reference in New Issue