Commit Graph

3006 Commits

Author SHA1 Message Date
sfc-gh-tclinkenbeard 2134fa9a0c Merge remote-tracking branch 'origin/main' into global-tag-throttling3 2022-06-28 19:51:41 -07:00
sfc-gh-tclinkenbeard 086e4bff06 Merge remote-tracking branch 'origin/main' into global-tag-throttling3 2022-06-28 10:18:13 -07:00
Markus Pilman 20e7371036 some Linux fixes 2022-06-28 08:51:13 -06:00
Markus Pilman d31fb30f57 fdbclient compiling 2022-06-27 18:31:05 -06:00
Markus Pilman 88af6b403f fdbrpc compiling 2022-06-27 18:11:55 -06:00
Markus Pilman 03d913a1de Flow compiling 2022-06-27 17:05:55 -06:00
Markus Pilman e35633149c
Merge pull request #7447 from sfc-gh-mpilman/bugfixes/cmake-disallow-illegal-cross-module-includes
enforce include modularization in cmake
2022-06-24 22:42:18 -06:00
Markus Pilman a47ed89018 Linux fixes and addressed review comments 2022-06-23 20:52:13 -06:00
Markus Pilman de48e90276 fdbserver is now compiling 2022-06-23 18:45:26 -06:00
Markus Pilman 8af056e7b0 fdbclient now compiling 2022-06-23 18:05:36 -06:00
Markus Pilman 10e478dfc3 Flow is compiling 2022-06-23 16:35:19 -06:00
Markus Pilman d35445a868 enforce include modularization in cmake 2022-06-23 14:37:35 -06:00
sfc-gh-tclinkenbeard 840dac1fa3 Merge remote-tracking branch 'origin/main' into global-tag-throttling3 2022-06-22 22:17:33 -07:00
A.J. Beamon 485df52b0f Add check to avoid using memcpy with an invalid data pointer 2022-06-22 15:57:47 -07:00
Lukas Joswiak 88557d9169 Simplify function call when transaction is null 2022-06-22 14:50:17 -07:00
Lukas Joswiak 4c2bb0b44e Fix undefined behavior from accessing field of uninitialized object 2022-06-22 14:50:17 -07:00
sfc-gh-tclinkenbeard 2391e58fb2 Merge remote-tracking branch 'origin/main' into global-tag-throttling3 2022-06-21 10:09:15 -07:00
Andrew Noyes 83aceb216c
Use absl::GetStackTrace for slow task profiler (#7374)
* Make SlowTask workload runnable in joshua

* Remove SignalSafeUnwind, and use absl::GetStackTrace for slow task profiler
2022-06-15 14:53:52 -07:00
Andrew Noyes 0fea3fb731
Save a bunch of copies in the trace thread (#7392)
Currently, a std::string is copied unnecessarily for every key and value
in a trace event.

This actually showed up in a jemalloc heap profile while I was
investigating something unrelated. I was surprised to see it since these
allocations should have a very short lifetime.
2022-06-15 12:29:15 -07:00
Ata E Husain Bohra 8808d93813
Fix bugs in EncyrptKeyProxy actor (#7388)
Description

Major changes include:
1. GetEncryptByKeyIds cache elements can expire.
2. Update iterator after erasing an element during refresh encryption keys
   operation.

Testing

EncryptKeyProxyTest
2022-06-14 21:22:25 -07:00
Junhyun Shim ed91ab5d54
Work around flow trace's data race bug (#7237)
* Work around flow trace's data race bug

BaseTraceEvent::setNetworkThread() and flushTraceFile[()|Void()]
has a long-standing race condition for traceEventThrottlerCache global
when flushTraceFileVoid() is not called from the network thread.

This race dates back to 2017 (commit hash 80e5fecfe2),
so before the race itself is fixed, work around the problem.

* Remove call to flushTraceFileVoid() from MkCertCli

* Apply clang format
2022-06-14 12:09:34 +02:00
Renxuan Wang 839af5701e
Fix bug in resolveTCPEndpoint() when hostname resolving fails. (#7375)
* Close trace file when error happens in runNetwork().

* Improve the bestCount algorithm in getLeader().

In the current implementation, if the nominees are [0,1], the chosen leader will be 1, which is an exception to other cases and our expectation that if 2 nominees have the same frequency, the one with lower id will be the leader.

* Remove unnecessary new statement.

stream will never be a nullptr.

* Move self->dnsCache out of lambda capture.

Member variables are not capture by default, thus, `host` and `service` are not captured. This somehow successfully compile, but throws std::bad_alloc or basic_string::_S_create exceptions when we call `host+":"+service` in dnsCache.remove().

* Revert unintended change.

* Address comments.
2022-06-13 20:24:30 -07:00
Trevor Clinkenbeard 6bed046148
Merge pull request #7352 from sfc-gh-xwang/feature/ddtxn
[DD testability enhancement] Create IDDTxnProcessor and simple refactoring
2022-06-13 16:01:13 -07:00
Xiaoge Su 5a2804e04b
fixup! Fix the XmlTraceLogFormatter (#7322)
* fixup! Fix the XmlTraceLogFormatter

The original escape process uses a `loop` while the code is actually not
an ACTOR. So the actorcompiler is not reacting. This causes the escape
not escaping the XML fields properly.

* fixup! Reformat source
2022-06-13 13:38:17 -07:00
Xiaoxi Wang ea2edebbeb comment out store tuple 2022-06-13 13:36:19 -07:00
Ata E Husain Bohra a5d91fe18a
KmsConnector implementation to support KMS driven CipherKey TTL (#7334)
* KmsConnector implementation to support KMS driven CipherKey TTL

Description

KMS CipherKeys can be of two types:
1. Revocable CipherKeys: having a finite lifetime, after which the CipherKey
shouldn't be used by the FDB.
2. Non-revocable CipherKeys: ciphers are not revocable, however, FDB would
still want to refresh ciphers to support KMS cipher rotation feature.

Patch proposes following change to incorporate support for above defined cipher-key
types:
1. Extend KmsConnector response to include optional 'refreshAfter' & 'expireAfter'
time intervals. EncryptKeyProxy (EKP) cache would define corresponding absolute refresh &
expiry timestamp for a given cipherKey. On an event of transient KMS connectivity outage,
a caller of EKP API for a non-revocable key should continue using cached cipherKey until
it expires.
2. Simplify KmsConnector API arena handling by using VectorRef to represent component
structs and manage associated memory allocation/lifetime.

Testing

1. EncryptKeyProxyTest
2. RESTKmsConnectorTest
3. SimKmsConnectorTest

* KmsConnector implementation to support KMS driven CipherKey TTL

Description

  diff-1: Set expireTS for baseCipherId indexed cache

KMS CipherKeys can be of two types:
1. Revocable CipherKeys: having a finite lifetime, after which the CipherKey
shouldn't be used by the FDB.
2. Non-revocable CipherKeys: ciphers are not revocable, however, FDB would
still want to refresh ciphers to support KMS cipher rotation feature.

Patch proposes following change to incorporate support for above defined cipher-key
types:
1. Extend KmsConnector response to include optional 'refreshAfter' & 'expireAfter'
time intervals. EncryptKeyProxy (EKP) cache would define corresponding absolute refresh &
expiry timestamp for a given cipherKey. On an event of transient KMS connectivity outage,
a caller of EKP API for a non-revocable key should continue using cached cipherKey until
it expires.
2. Simplify KmsConnector API arena handling by using VectorRef to represent component
structs and manage associated memory allocation/lifetime.

Testing

1. EncryptKeyProxyTest
2. RESTKmsConnectorTest
3. SimKmsConnectorTest

* KmsConnector implementation to support KMS driven CipherKey TTL

Description

  diff-2: Fix Valgrind issues discovered runnign tests
  diff-1: Set expireTS for baseCipherId indexed cache

KMS CipherKeys can be of two types:
1. Revocable CipherKeys: having a finite lifetime, after which the CipherKey
shouldn't be used by the FDB.
2. Non-revocable CipherKeys: ciphers are not revocable, however, FDB would
still want to refresh ciphers to support KMS cipher rotation feature.

Patch proposes following change to incorporate support for above defined cipher-key
types:
1. Extend KmsConnector response to include optional 'refreshAfter' & 'expireAfter'
time intervals. EncryptKeyProxy (EKP) cache would define corresponding absolute refresh &
expiry timestamp for a given cipherKey. On an event of transient KMS connectivity outage,
a caller of EKP API for a non-revocable key should continue using cached cipherKey until
it expires.
2. Simplify KmsConnector API arena handling by using VectorRef to represent component
structs and manage associated memory allocation/lifetime.

Testing

1. EncryptKeyProxyTest
2. RESTKmsConnectorTest
3. SimKmsConnectorTest

* KmsConnector implementation to support KMS driven CipherKey TTL

Description

  diff-3: Address review comment
  diff-2: Fix Valgrind issues discovered runnign tests
  diff-1: Set expireTS for baseCipherId indexed cache

KMS CipherKeys can be of two types:
1. Revocable CipherKeys: having a finite lifetime, after which the CipherKey
shouldn't be used by the FDB.
2. Non-revocable CipherKeys: ciphers are not revocable, however, FDB would
still want to refresh ciphers to support KMS cipher rotation feature.

Patch proposes following change to incorporate support for above defined cipher-key
types:
1. Extend KmsConnector response to include optional 'refreshAfter' & 'expireAfter'
time intervals. EncryptKeyProxy (EKP) cache would define corresponding absolute refresh &
expiry timestamp for a given cipherKey. On an event of transient KMS connectivity outage,
a caller of EKP API for a non-revocable key should continue using cached cipherKey until
it expires.
2. Simplify KmsConnector API arena handling by using VectorRef to represent component
structs and manage associated memory allocation/lifetime.

Testing

1. EncryptKeyProxyTest
2. RESTKmsConnectorTest
3. SimKmsConnectorTest
2022-06-13 13:25:01 -07:00
Andrew Noyes 38db712e7a
Make ASAN arena aware (#7336) 2022-06-13 13:24:02 -07:00
sfc-gh-tclinkenbeard df71a49bf6 Merge remote-tracking branch 'origin/main' into global-tag-throttling3 2022-06-13 10:03:10 -07:00
Ray Jenkins c45abc7c32
Add TRACING_SPAN_ATTRIBUTES_ENABLED Knob, default false. (#7354)
* Add TRACING_SPAN_ATTRIBUTES_ENABLED Knob, default false.

In order to prevent accidental leakage of PII to external tracing collector services,
we've added a knob to prevent additional attributes to be added to spans unless explicitly
enabled by the user.

* Enable span attributes knob for unit tests.
2022-06-13 11:37:09 -05:00
Steve Atherton 90bb3a7f8c
Merge pull request #7341 from sfc-gh-satherton/net2-react-perf-fix
Performance bug fix: reactor.react() is called too often.
2022-06-09 17:55:07 -07:00
Xiaoxi Wang 7ee6808ebd solve compiler warning 2022-06-09 14:32:24 -07:00
Xiaoxi Wang e5aa5fef22 merge upstream/main 2022-06-09 12:17:27 -07:00
Xiaoxi Wang 6ab12ea971 add storeTuple and unit test; refactor getSourceServersForRange 2022-06-09 12:16:12 -07:00
Robert Barabas 8606923da2
Arm64 related build fixes (#7319)
* Add missing include

* Fix open call on arm64

* Bump up doctest to 2.4.8
2022-06-08 11:20:27 -07:00
Markus Pilman d141347500
Merge pull request #7282 from Doxense/fix-windows-tests
Fix windows tests
2022-06-08 08:18:47 -06:00
Yi Wu bbf8cb4b02
GetEncryptCipherKeys helper function and misc encryption changes (#7252)
Adding GetEncryptCipherKeys and GetLatestCipherKeys helper actors, which encapsulate cipher key fetch logic: getting cipher keys from local BlobCipherKeyCache, and on cache miss fetch from EKP (encrypt key proxy). These helper actors also handles the case if EKP get shutdown in the middle, they listen on ServerDBInfo to wait for new EKP start and send new request there instead.

The PR also have other misc changes:
* EKP is by default started in simulation regardless of. ENABLE_ENCRYPTION knob, so that in restart tests, if ENABLE_ENCRYPTION is switch from on to off after restart, encrypted data will still be able to be read.
* API tweaks for BlobCipher
* Adding a ENABLE_TLOG_ENCRYPTION knob which will be used in later PRs. The knob should normally be consistent with ENABLE_ENCRYPTION knob, but could be used to disable TLog encryption alone.

This PR is split out from #6942.
2022-06-07 21:00:13 -07:00
Steve Atherton 697aa6cc32 Performance bug fix: reactor.react() is called too often. 2022-06-07 17:53:40 -07:00
Hao Fu e7fa8e9f6f
Add versionstamp support in tuple (#7293)
Tuple in C++ needs to support Versionstamp.
2022-06-02 17:44:10 -07:00
Ata E Husain Bohra b66509eff0
Make EncryptKeyServer and KmsConnector API to be 'tenant' name aware (#7215)
Description

Major changes proposed include:
1. Update EncryptKeyServer APIs to be tenant aware.
2. Update KmsConnector APIs to be tenant aware

Client of above APIs such as: CP, SS and BlobWorker need to supply
encryption domain info that includes: tenantId and tenantName

Testing

1. Update EncryptKeyProxyTest
2. Update RESTKmsConnectorTest
3. Update SimKmsConnectorTest
2022-06-02 11:55:50 -07:00
Junhyun Shim 3e79735b2f
Authz JWT support (#7279)
* Add JWT support to TokenSign

* Encapsulate OpenSSL public/private key type

Type-safe passing around of keys without having to DER/PEM-serialize
(OpenSSL doesn't have distinct types for public and private key)

* Apply Clang format

* Add verify benchmark for JWT and FlatBuffers token

* Unit test base64url::{encode, decode}

* Make all payload fields optional

Let user code validate non-signature fields

* Make all payload fields optional

Completely defer field check to user code

* Move rapidjson from fdbclient to contrib

* Make fdbrpc's rapidjson linkage private

Currently only sources include them.

* Modify rapidjson path in apiversioner.py

* Algorithm::Unknown > Algorithm::UNKNOWN
2022-06-02 13:22:50 +02:00
sfc-gh-tclinkenbeard 29ebcdbfa9 Merge remote-tracking branch 'origin/main' into global-tag-throttling3 2022-05-31 14:53:51 -07:00
Mohamed Oulmahdi 26ad8bc184 Format 2022-05-31 14:17:41 +02:00
Vaidas Gasiunas 4d6ec7663f Close file at the end of runNetwork rather than in stopNetwork in order to avoid a race condition,
also in order to continue tracing the pending network thread activity.
Poll event throttler only in the network thread in order to avoid a race condition.
2022-05-31 13:59:09 +02:00
Mohamed Oulmahdi 81e81c6799 Fix atomicPath and abspath for Windows 2022-05-31 12:01:39 +02:00
Mohamed Oulmahdi 541ff206f3 Use \n instead of \r\n in log formatters 2022-05-31 11:59:21 +02:00
Xiaoxi Wang 5bea02cfde
Merge pull request #6686 from sfc-gh-xwang/readaware
Read-aware Data Distributor (default disabled)
2022-05-26 11:05:03 -07:00
Renxuan Wang cd2a575e02
Move the resolve of coordinator hostname from getCoordinatorProtocol() to getClusterProtocolImpl(). (#7245)
* Move the resolve of coordinator hostname from getCoordinatorProtocol() to getClusterProtocolImpl().

* Guard DNS Cache behind a knob.
2022-05-26 09:45:54 -07:00
Xiaoxi Wang 5816890dfc Merge branch 'main' of https://github.com/apple/foundationdb into readaware 2022-05-25 14:48:28 -07:00
Xiaoxi Wang 4cbec5c742
Merge branch 'apple:main' into features/debug-macro 2022-05-24 09:12:39 -07:00
Xiaoxi Wang fd35fde481 Merge branch 'main' of https://github.com/apple/foundationdb into readaware 2022-05-23 15:09:03 -07:00