Commit Graph

85 Commits

Author SHA1 Message Date
Zhe Wu 37e026366c
Merge pull request #9119 from halfprice/zhewu/add-txn-server-initialization-event-1
Add event for txn server initialization and a warning for TLog slow catching up
2023-01-11 22:00:53 -08:00
Zhe Wu 087d37d10b Add event for txn server initialization and a warning for TLog slow catching up 2023-01-11 10:02:06 -08:00
Nim Wijetunga 114eb4a3a6
Resolver uses Encryption DB Config (#9002)
Resolver uses encryption DB config
2023-01-10 17:11:14 -08:00
Nim Wijetunga d4cbe20d5f
Cluster Controller uses DB Config (#8992)
CC uses db config for encryption
2023-01-09 12:17:36 -05:00
Lukas Joswiak e2752aea05 Fix issue where recoveries could thrash between regions 2023-01-06 15:20:30 -08:00
Nim Wijetunga 3a238d638a
Commit Proxy uses Encryption DB Config (#8911)
* add encryption db config

* address pr comments

* address pr comments

* add comments

* cp uses db config

* remove includes

* fix tests

* fix tests

* modify comment

* add encryption enabled method

* modify simulation

* Trigger Build

* change commit proxy encrypt mode fetching

* address pr comments

* address pr comments

* Trigger Build

* Trigger Build

* Trigger Build

* Trigger Build
2022-12-12 21:23:55 -08:00
FoundationDB CI 86d6106dc1
format source code after switch to clang 15 2022-12-08 17:26:45 +00:00
Lukas Joswiak 38972b199a Fix issue where the versions on seed storage servers decreased
Seed storage servers are recruited as the intial set of storage servers
when a database is first created. They function a little bit differently
than normal, and do not set an initial version like storages normally do
when they get recruited (typically equal to the recovery version).

Version correction is a feature where versions advance in sync with the
clock, and are equal across FDB clusters. To allow different FDB
clusters to have matching versions, they must share the same base
version. This defaults to the Unix epoch, and clusters with the version
epoch enabled will have a current version equal to the number of
microseconds since the Unix epoch.

When the version epoch is enabled on a cluster, it causes a one time
jump from the clusters current version to the version based on the
epoch. After a recovery, the recovery version sent to storages should
have advanced by a significant amount.

The recovery path contained a `BUGGIFY` to randomly advance the recovery
version in simulation, testing the version epoch being enabled.
However, it was also advancing the version during an initial recovery,
when the seed storage servers are recruited. If a set of storage
servers were recruited as seed servers, but another recovery occurred
before the bootstrap process was complete, the randomly selected version
increase could be smaller during the second recovery than during the
first. This could cause the initial set of seed servers to think they
should be at a version larger than what the cluuster was actually at.

The fix contained in this commit is to only cause a random version jump
when the recovery is occuring on an existing database, and not when it
is recruiting seed storages.

This commit fixes an issue found in simulation, reproducible with:

Commit: 93dc4bfeb9
Test: fast/DataLossRecovery.toml
Seed: 3101495991
Buggify: on
Compiler: clang
2022-12-07 15:03:21 -08:00
Nim Wijetunga 97713cadff
Update Encryption Mode DB Config Values (#8839)
* add encryption db config

* address pr comments

* address pr comments

* add comments

* add comment

* modify check

* change condition

* address pr comments

* simplify check

* address pr comments
2022-11-22 16:33:59 -08:00
Ata E Husain Bohra a7d123643d
Extend Tlog persistentStorage to persist encryption state (#8344)
* Extend Tlog persistentStorage to persist encryption state

Description

 diff-3: Address review comment.
 diff-2: Extend ClusterController endpoints to allow query
         cluster's encryptionAtRest status
         Update Tlog recovery to ensure on-disk encryption
         status matches with cluster's cstate persisted
         encryptionAtRest
 diff-1: Store encryptionAtRestMode state in Coordinators

Major changes proposed are:
1. Extend TLog persistentStorage to persist encryption state
2. Encryption state persisted is derived from corresponding
db-config and relevant SERVER_KNOBS. In near future, knobs
shall be removed.
3. On TLog startup, the persisted encryption state is compared
against cluster configuration, if mismatch, the TLog is killed
and not allowed to rejoin the cluster.

Testing

devRunCorrectness - 100K
2022-11-03 11:16:50 -07:00
Lukas Joswiak 9d3c3b1efe Remove cluster ID logic from individual roles
The logic to determine the validity of a process joining a cluster now
belongs on the worker and the cluster controller. It is no longer
restricted to tlogs and storages, but instead applies to all processes
(even stateless ones).
2022-10-27 13:56:13 -07:00
Xiaoge Su ab0f827058 configurationMonitor does not need to check watch reference count 2022-10-27 12:42:05 -07:00
Xiaoge Su 639afbe62c Cancel watch when the key is not being waited
Currently, there is a cyclic reference situation in

    DatabaseContext -> WatchMetadata -> watchStorageServerResp ->
    DatabaseContext

If there is a watch created in the DatabaseContext, even the
corresponding wait ACTOR is cancelled, the WatchMetadata will still hold
a reference to watchStorageServerResp ACTOR, which holds a reference to
DatabaseContext.

In this situation, any DatabaseContext who held a watch will not be
automatically destructed since its reference count will never reduce to
0 until the watch value is changed. Every time the cluster recoveries,
several watches are created, and when the cluster restarts, the
DatabaseContext which not being used, will not be able to destructed due
to these watches.

With this patch, each wait to the watch will be counted. Either the
watch is triggered or cancelled, the corresponding count will be
reduced. If a watch is not being waited, the watch will be cancelled,
effectively reduce the reference count of DatabaseContext. This will
hopefully fix the issue mentioned above.

The code is tested by 1) Manually change the number of logs of a local
cluster, see the cluster recovery and previous DatabaseContext being
destructed; 2) 100K joshua run, with 1 failure, the same test will fail
on the current git main branch.
2022-10-27 12:42:05 -07:00
Jingyu Zhou a8391caf23 Revert "Data loss protection v2" 2022-10-20 18:09:58 -05:00
Lukas Joswiak 72bc89cf39 Remove cluster ID logic from individual roles
The logic to determine the validity of a process joining a cluster now
belongs on the worker and the cluster controller. It is no longer
restricted to tlogs and storages, but instead applies to all processes
(even stateless ones).
2022-10-18 21:37:42 -07:00
Yi Wu ac6aaf3785
encryption: fix some data not being encrypted (#8403)
Changes:
1. Change `isEncryptionOpSupported` to not check against `clientDBInfo.isEncryptionEnabled`, but instead against ENABLE_ENCRYPTION server knob. The problem with clientDBInfo is before its being broadcast to the workers, its content is uninitialized, during which some data (e.g. item 2) is not getting encrypted when they should.
2. Fix CommitProxy not encrypting metadata mutations which are recovered from txnStateStore
3. Fix KeyValueStoreMemory (thus TxnStateStore) partial transaction coming from recovery is not encrypted
4. new CODE_PROBE for the above fixes
5. Logging changes
2022-10-12 14:18:56 -07:00
Markus Pilman ea1325a552
Merge pull request #8319 from sfc-gh-tclinkenbeard/add-rare-code-probe-annotation
Add `rare` code probe decoration
2022-10-07 09:39:00 -06:00
Jon Fu 299b1b32e2 create new tracking key for metacluster traces 2022-10-05 12:08:36 -07:00
Jon Fu 30902da0d2 trackLatest on recovery event 2022-10-05 11:57:41 -07:00
Jon Fu 461e42bfe1 restructure updater code and add capacity check in metacluster management workload 2022-09-29 16:24:02 -07:00
Jon Fu e26be7a099 Merge branch 'main' of github.com:apple/foundationdb into metacluster-status 2022-09-29 11:37:50 -07:00
Jon Fu 6357ad1750 pass info through cc data to populate in status 2022-09-28 16:18:44 -07:00
Jon Fu 0fa462fca9 initial commit to trace metacluster metrics 2022-09-26 15:56:45 -07:00
Evan Tschannen 86c27754fb
Fixed a bug where rollbackVersion >= data->storageVersion() (#8290)
* fix: the log router could see popped() versions between recoveredAt and the recovery txn version which cause remote tlogs to be stopped at a version in this range, which causes storage servers to read at versions in this range

* fix: a spurious correctness bug resulted from the consistency check running during a recovery
2022-09-26 09:19:53 -07:00
sfc-gh-tclinkenbeard 985958c260 Add rare code probe decoration 2022-09-25 15:28:32 -07:00
A.J. Beamon 4fd64630e8 Convert literal string ref instances to use _sr suffix 2022-09-19 11:35:58 -07:00
sfc-gh-tclinkenbeard 82adc1e856 Make g_simulator a pointer 2022-09-15 09:00:33 -07:00
Lukas Joswiak 249ff2b2fd Fix configuration database unit tests 2022-09-13 16:53:54 -07:00
Lukas Joswiak 74ac617a34 Add support for changing coordinators to the configuration database
Configuration database data lives on the coordinators. When a change
coordinators command is issued, the data must be sent to the new
coordinators to keep the database consistent.
2022-09-13 16:53:54 -07:00
Jingyu Zhou 89c4b2e5c4 Use event holder 2022-08-31 21:48:44 -07:00
Jingyu Zhou ee5fd71320 Add back RecoveryAvailable trace event for status 2022-08-31 14:50:07 -07:00
Nim Wijetunga 6d0b20b07a Merge branch 'main' of github.com:sfc-gh-nwijetunga/foundationdb into nim/refactor-encryption-flag
* 'main' of github.com:sfc-gh-nwijetunga/foundationdb: (32 commits)
  Store rocksdb::DBOptions and rocksdb::ColumnFamilyOptions to (#7766)
  Update CONTRIBUTING.md
  Update tests/rare/SpecificUnitTests.toml
  fix ASAN OOM problem
  Update CONTRIBUTING.md
  Write tracing and ALP special key errors as JSON
  Fix: the static tenant map in the Java tester was being accessed concurrently from multiple threads. Make it a concurrent map. (#7805)
  Run clang-format
  Print SIGNAL output to stdout
  Print to stderr only upon errors
  Testing upgrades to a future version of FDB (#7780)
  Flush gcov coverage upon SIGTERM
  Report the unit tests being run in test harness
  Fix a bug in a storage wiggler unit test where some servers were added with too recent a timestamp
  Fix undefined behavior in versioned btree test due to integer overflow
  When a transaction operation gets an unknown tenant error, it needs to reset the tenant ID so it can be updated in the next tenant lookup request.
  Don't buggify max tenants per cluster globally; instead buggify it in specific tests
  Remove non-existing unittest
  Add unit tests to the correctness package
  Add comment to INetwork
  ...
2022-08-08 22:07:05 -07:00
Vaidas Gasiunas 79571dd2b4
Testing upgrades to a future version of FDB (#7780)
* Enable configuring the next future protocol version as the current protocol version in FDB client, fdbserver, and fdbcli

* Auto format python files used in upgrade tests

* Add a test for upgrading to a future FDB version

* Emphasize that the options for using future protocol version are intended for test purposes only

* Make the global variable for current protocol version visible only locally

* Refactirng to avoid using currentProtocolVersion() in static intialization

* Update go bindings
2022-08-08 17:29:49 +02:00
Nim Wijetunga 369494ab19 merge 2022-08-05 18:52:39 -07:00
Nim Wijetunga 8d591fc5e7 address pr comments 2022-08-02 10:51:41 -07:00
Nim Wijetunga af6db42b1b temp 2022-08-01 15:19:21 -07:00
A.J. Beamon a69164d160 Merge branch 'main' into feature-metacluster 2022-07-29 11:53:06 -07:00
A.J. Beamon 279296c29f Merge branch 'tenant-metadata-change' into feature-metacluster
# Conflicts:
#	fdbclient/SystemData.cpp
#	fdbclient/Tenant.cpp
#	fdbclient/include/fdbclient/SystemData.h
#	fdbclient/include/fdbclient/Tenant.h
#	fdbclient/include/fdbclient/TenantManagement.actor.h
#	fdbserver/TenantCache.actor.cpp
#	fdbserver/storageserver.actor.cpp
#	fdbserver/workloads/TenantManagementWorkload.actor.cpp
2022-07-20 09:18:27 -07:00
Lukas Joswiak c357a90b30 Ensure change coordinators request came from same generation proxy
There was a rare but possible issue where a change coordinators request
could be in flight, but reading `\xff/coordinators` would return the old
set of coordinators, even though a previous attempt to write it returned
`commit_unknown_result`. This happened if there was an unrelated
recovery between setting `\xff/coordinators` and the updated
coordinators reaching each machine. The `commit_unknown_result` caused
by this recovery meant the change coordinators retry loop would read
`\xff/coordinators`, but since the request was ongoing it would read the
old set of coordinators. The fix is to have the cluster controller
ignore any change coordinators request from an old generation, meaning
when the retry loop reads the old coordiantors from `\xff/coordinators`,
it is guaranteed that the in progress change coordinators message will
be rejected when arriving at the cluster controller.
2022-07-19 17:44:48 -07:00
Markus Pilman 1de37afd52
Make TEST macros C++ only (#7558)
* proof of concept

* use code-probe instead of test

* code probe working on gcc

* code probe implemented

* renamed TestProbe to CodeProbe

* fixed refactoring typo

* support filtered output

* print probes at end of simulation

* fix missed probes print

* fix deduplication

* Fix refactoring issues

* revert bad refactor

* make sure file paths are relative

* fix more wrong refactor changes
2022-07-19 13:15:51 -07:00
A.J. Beamon 078d0d92ee Use key-backed types for metacluster state 2022-07-14 13:36:59 -07:00
A.J. Beamon b9cc5389b1 Undo some changes that aren't needed 2022-07-07 14:48:36 -07:00
A.J. Beamon 1519f24f77 Merge branch 'main' into feature-metacluster 2022-07-07 09:35:40 -07:00
Sreenath Bodagala a84112d30b - Propagate the locality of the primary region from ClusterController
to the sequencer, rather than deriving it from "MasterInterface" on
the sequencer (which is not correct).
2022-07-06 11:57:06 +00:00
A.J. Beamon aea4d802c6 Merge branch 'main' into feature-metacluster 2022-06-30 15:08:09 -07:00
Dan Lambright 98b18e3a18
Remove code obsoleted by commit c48d5690 (#7499) 2022-06-30 12:16:23 -04:00
A.J. Beamon e1a93988ef Merge branch 'main' into feature-metacluster 2022-06-28 14:58:07 -07:00
A.J. Beamon 9f3819752f Change the command to create a metacluster from using 'configure tenant_mode=management' to 'metacluster create <NAME>'. Distribute this name to all processes in a metacluster. Eliminate the tenant mode entirely from metacluster clusters, instead relying on a metacluster registration key. 2022-06-22 12:15:43 -07:00
Yi Wu 6246664006
Support encrypting TxnStateStore (#7253)
Adding encryption support for TxnStateStore. It is done by supporting encryption. for KeyValueStoreMemory. The encryption is currently done on operation level when the operations are being write to the underlying log file. See inline comment for the encrypted data format.

This PR depends on #7252. It is part of the effort to support TLog encryption #6942.
2022-06-14 13:26:32 -07:00
Jingyu Zhou b2fded5c51 CC sends recovery txn version during TLog recruitment
This simplifies the logic for TLog to wait for recovery txn before replying
back to peeks.
2022-05-24 14:57:55 -07:00