From 5169616b162b7ff9f7970c9432d3d61dcbe0a389 Mon Sep 17 00:00:00 2001 From: Junhyun Shim Date: Wed, 27 Jul 2022 00:22:50 +0200 Subject: [PATCH] Fix unresolved merge conflicts --- fdbclient/BlobGranuleFiles.cpp | 6 +++--- fdbclient/NativeAPI.actor.cpp | 5 +++-- fdbrpc/TokenCache.cpp | 20 ++++++++++---------- fdbserver/BlobWorker.actor.cpp | 2 +- fdbserver/workloads/CreateTenant.actor.cpp | 3 ++- flow/CompressionUtils.cpp | 4 ++-- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/fdbclient/BlobGranuleFiles.cpp b/fdbclient/BlobGranuleFiles.cpp index 3db1ae95a2..5e0c316c17 100644 --- a/fdbclient/BlobGranuleFiles.cpp +++ b/fdbclient/BlobGranuleFiles.cpp @@ -1393,7 +1393,7 @@ const EncryptCipherRandomSalt encryptSalt = deterministicRandom()->randomUInt64( Standalone getBaseCipher() { Standalone baseCipher = makeString(AES_256_KEY_LENGTH); - generateRandomData(mutateString(baseCipher), baseCipher.size()); + deterministicRandom()->randomBytes(mutateString(baseCipher), baseCipher.size()); return baseCipher; } @@ -1413,7 +1413,7 @@ BlobGranuleCipherKeysCtx getCipherKeysCtx(Arena& arena) { cipherKeysCtx.headerCipherKey.baseCipher = StringRef(arena, encryptBaseCipher); cipherKeysCtx.ivRef = makeString(AES_256_IV_LENGTH, arena); - generateRandomData(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH); + deterministicRandom()->randomBytes(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH); return cipherKeysCtx; } @@ -2232,4 +2232,4 @@ TEST_CASE("/blobgranule/files/granuleReadUnitTest") { } return Void(); -} \ No newline at end of file +} diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index b543ca6357..c8dc0905e8 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -5957,7 +5957,7 @@ ACTOR static Future commitDummyTransaction(Reference trS } else { tr.trState->skipTenantPrefixAndIdResolution = true; tr.trState->tenantId = trState->tenantId; - TEST(true); // Commit of a dummy transaction in tenant keyspace + CODE_PROBE(true, "Commit of a dummy transaction in tenant keyspace"); } tr.setOption(FDBTransactionOptions::CAUSAL_WRITE_RISKY); tr.setOption(FDBTransactionOptions::LOCK_AWARE); @@ -6149,7 +6149,8 @@ ACTOR static Future tryCommit(Reference trState, applyTenantPrefix(req, locationInfo.tenantEntry.prefix); tenantPrefix = locationInfo.tenantEntry.prefix; } - TEST(trState->skipTenantPrefixAndIdResolution); // Tenant prefix/id resolution skipped for dummy transaction + CODE_PROBE(trState->skipTenantPrefixAndIdResolution, + "Tenant prefix/id resolution skipped for dummy transaction"); req.tenantInfo = trState->getTenantInfo(); startTime = now(); state Optional commitID = Optional(); diff --git a/fdbrpc/TokenCache.cpp b/fdbrpc/TokenCache.cpp index 33e951d0b0..41f118aa2d 100644 --- a/fdbrpc/TokenCache.cpp +++ b/fdbrpc/TokenCache.cpp @@ -162,7 +162,7 @@ bool TokenCacheImpl::validateAndAdd(double currentTime, StringRef token, Network Arena arena; authz::jwt::TokenRef t; if (!authz::jwt::parseToken(arena, t, token)) { - TEST(true); // Token can't be parsed + CODE_PROBE(true, "Token can't be parsed"); TraceEvent(SevWarn, "InvalidToken") .detail("From", peer) .detail("Reason", "ParseError") @@ -171,31 +171,31 @@ bool TokenCacheImpl::validateAndAdd(double currentTime, StringRef token, Network } auto key = FlowTransport::transport().getPublicKeyByName(t.keyId); if (!key.present()) { - TEST(true); // Token referencing non-existing key + CODE_PROBE(true, "Token referencing non-existing key"); TRACE_INVALID_PARSED_TOKEN("UnknownKey", t); return false; } else if (!t.expiresAtUnixTime.present()) { - TEST(true); // Token has no expiration time + CODE_PROBE(true, "Token has no expiration time"); TRACE_INVALID_PARSED_TOKEN("NoExpirationTime", t); return false; } else if (double(t.expiresAtUnixTime.get()) <= currentTime) { - TEST(true); // Expired token + CODE_PROBE(true, "Expired token"); TRACE_INVALID_PARSED_TOKEN("Expired", t); return false; } else if (!t.notBeforeUnixTime.present()) { - TEST(true); // Token has no not-before field + CODE_PROBE(true, "Token has no not-before field"); TRACE_INVALID_PARSED_TOKEN("NoNotBefore", t); return false; } else if (double(t.notBeforeUnixTime.get()) > currentTime) { - TEST(true); // Tokens not-before is in the future + CODE_PROBE(true, "Tokens not-before is in the future"); TRACE_INVALID_PARSED_TOKEN("TokenNotYetValid", t); return false; } else if (!t.tenants.present()) { - TEST(true); // Token with no tenants + CODE_PROBE(true, "Token with no tenants"); TRACE_INVALID_PARSED_TOKEN("NoTenants", t); return false; } else if (!authz::jwt::verifyToken(token, key.get())) { - TEST(true); // Token with invalid signature + CODE_PROBE(true, "Token with invalid signature"); TRACE_INVALID_PARSED_TOKEN("InvalidSignature", t); return false; } else { @@ -227,7 +227,7 @@ bool TokenCacheImpl::validate(TenantNameRef name, StringRef token) { auto& entry = cachedEntry.get(); if (entry->expirationTime < currentTime) { - TEST(true); // Read expired token from cache + CODE_PROBE(true, "Found expired token in cache"); TraceEvent(SevWarn, "InvalidToken").detail("From", peer).detail("Reason", "ExpiredInCache"); return false; } @@ -239,7 +239,7 @@ bool TokenCacheImpl::validate(TenantNameRef name, StringRef token) { } } if (!tenantFound) { - TEST(true); // Valid token doesn't reference tenant + CODE_PROBE(true, "Valid token doesn't reference tenant"); TraceEvent(SevWarn, "TenantTokenMismatch").detail("From", peer).detail("Tenant", name.toString()); return false; } diff --git a/fdbserver/BlobWorker.actor.cpp b/fdbserver/BlobWorker.actor.cpp index 568c12ebef..0fa2166dea 100644 --- a/fdbserver/BlobWorker.actor.cpp +++ b/fdbserver/BlobWorker.actor.cpp @@ -314,7 +314,7 @@ ACTOR Future getLatestGranuleCipherKeys(ReferencerandomBytes(mutateString(cipherKeysCtx.ivRef), AES_256_IV_LENGTH); if (BG_ENCRYPT_COMPRESS_DEBUG) { TraceEvent(SevDebug, "GetLatestGranuleCipherKey") diff --git a/fdbserver/workloads/CreateTenant.actor.cpp b/fdbserver/workloads/CreateTenant.actor.cpp index 0e835007e5..624ebce177 100644 --- a/fdbserver/workloads/CreateTenant.actor.cpp +++ b/fdbserver/workloads/CreateTenant.actor.cpp @@ -46,7 +46,8 @@ struct CreateTenantWorkload : TestWorkload { ACTOR static Future _setup(CreateTenantWorkload* self, Database db) { try { - TenantMapEntry entry = wait(TenantAPI::createTenant(db.getReference(), self->tenant)); + Optional entry = wait(TenantAPI::createTenant(db.getReference(), self->tenant)); + ASSERT(entry.present()); } catch (Error& e) { TraceEvent(SevError, "TenantCreationFailed").error(e); if (e.code() == error_code_actor_cancelled) { diff --git a/flow/CompressionUtils.cpp b/flow/CompressionUtils.cpp index 3e7c4dbe94..c829cafc16 100644 --- a/flow/CompressionUtils.cpp +++ b/flow/CompressionUtils.cpp @@ -98,7 +98,7 @@ TEST_CASE("/CompressionUtils/noCompression") { Arena arena; const int size = deterministicRandom()->randomInt(512, 1024); Standalone uncompressed = makeString(size); - generateRandomData(mutateString(uncompressed), size); + deterministicRandom()->randomBytes(mutateString(uncompressed), size); Standalone compressed = CompressionUtils::compress(CompressionFilter::NONE, uncompressed, arena); ASSERT_EQ(compressed.compare(uncompressed), 0); @@ -116,7 +116,7 @@ TEST_CASE("/CompressionUtils/gzipCompression") { Arena arena; const int size = deterministicRandom()->randomInt(512, 1024); Standalone uncompressed = makeString(size); - generateRandomData(mutateString(uncompressed), size); + deterministicRandom()->randomBytes(mutateString(uncompressed), size); Standalone compressed = CompressionUtils::compress(CompressionFilter::GZIP, uncompressed, arena); ASSERT_NE(compressed.compare(uncompressed), 0);