612 Commits

Author SHA1 Message Date
Jingyu Zhou
05e63bc703
Fix orphaned storage server due to force recovery (#6914)
* Fix orphaned storage server due to force recovery

The force recovery can roll back the transaction that adds a storage server.
However, the storage server may now at version B > A, the recovery version.
As a result, its peek to buddy TLog won't return TLogPeekReply::popped to
trigger its exit, and instead getting a higher version C > B back. To the
storage server, this means the message is empty, thus not removing itself and
keeps peeking.

The fix is to instead of using recovery version as the popped version for the
SS, we use the recovery transaction version, which is the first transaction
after the recovery. Force recovery bumps this version to a much higher version
than the SS's version. So the TLog would set TLogPeekReply::popped to trigger
the storage server exit.

* Fix tlog peek to disallow return empty message between recoveredAt and recovery txn version

This contract today is not explicitly set and can cause storage server to fail
with assertion "rollbackVersion >= data->storageVersion()". This is because if
such an empty version is returned, SS may advance its storage version to a
value larger than the rollback version set in the recovery transaction.

The fix is to block peek reply until recovery transaction has been received.

* Move recoveryTxnReceived to be per LogData

This is because a shared TLog can have a first generation TLog which is already
setting the promise, thus later generations won't wait for the recovery version.
For the current generation, all peeks need to wait, while for older generations,
there is no need to wait (by checking if they are stopped).

* For initial commit, poppedVersion needs to be at least 2

To get rid of the previous unsuccessful recovery's recruited seed
storage servers.
2022-05-02 17:17:37 -07:00
Evan Tschannen
442d2b34c7
fix: pops which were ignored during a snapshot would not be replayed on the proper tlogs within a shared tlog (#6892) 2022-04-19 16:57:41 -07:00
Dan Lambright
e43fde16ec formatting 2022-04-08 17:28:16 -04:00
Dan Lambright
62975f87d1 Formatting 2022-04-08 15:04:46 -04:00
Dan Lambright
5bdc525353
Merge branch 'main' into vv 2022-04-08 13:16:04 -04:00
Xiaoxi Wang
d25fc4db34 add ASSERT_WE_THINK 2022-04-07 09:21:50 -07:00
Xiaoxi Wang
20fee3dd06 check pseudo locality before pop 2022-04-05 23:48:18 -07:00
Jingyu Zhou
cfcf0f152c Merge branch 'main-4a085fc84' into vv
Fix Conflicts:
	fdbclient/NativeAPI.actor.cpp
	fdbserver/ClusterRecovery.actor.cpp
	fdbserver/MasterInterface.h
	fdbserver/masterserver.actor.cpp
	flow/error_definitions.h
2022-03-30 22:28:06 -07:00
Jingyu Zhou
e9659b5dd4 Merge branch 'master-PR-6500' into vv
Fix Conflicts:
	fdbclient/CommitProxyInterface.h
	fdbclient/NativeAPI.actor.cpp
	fdbserver/masterserver.actor.cpp
2022-03-30 14:53:49 -07:00
sfc-gh-tclinkenbeard
a71099471b Update copyright header dates 2022-03-21 13:36:23 -07:00
Dan Lambright
2bbace3c89 Fix tLogServer.actor.cpp 2022-02-25 16:35:24 -05:00
A.J. Beamon
250a88e682 Enforce that trace event suppression calls happen first when using trace event call chaining. Fix various instances where we weren't following this requirement. 2022-02-24 12:25:52 -08:00
Dan Lambright
9e5f6d8214 Fix clang format 2022-02-24 12:33:25 -05:00
Dan Lambright
8cc9a5af1a Rebase 02/23 2022-02-23 14:23:28 -05:00
Zhe Wu
e07ae6fdb9 Address comments 2022-02-16 15:28:56 -08:00
Zhe Wu
9da735c38e Batch empty peek reply 2022-02-16 15:28:56 -08:00
Dan Lambright
9544379cdf rebase 2022-01-20 11:12:33 -05:00
Dan Lambright
1b0a1ac221 Do not recover different versions for the same key across tLogs 2022-01-12 13:27:53 -05:00
Ata E Husain Bohra
936bf5336a
Revert "Revert "Refactor: ClusterController driving cluster-recovery state machine" (#6191)
* Revert "Revert "Refactor: ClusterController driving cluster-recovery state machine""

Major changes includes:
1. Re-revert Sequencer refactor commits listed below (in listed order):
1.a. This reverts commit bb17e194d9c9888e203421290959bd7f2c075d7f.
1.b. This reverts commit d174bb2e06bff01157d16c652073536c54d17f7f.
1.c. This reverts commit 30b05b469c87d9b526b427751c211fb5cf7ff9cd.

2. Update Status.actor to track ClusterController interface to track
   recovery status.
3. Introduce a ServerKnob to define "cluster recovery trace event"
   prefix; for now keeping it as "Master", however, it should allow
   smooth transition to "Cluster" prefix as it seems more appropriate.
2022-01-06 12:15:51 -08:00
Dan Lambright
49e89571fa Set recoverAt to max(all tlogs rv) for recovered (crashed) tLogs in UNICAST mode. 2022-01-04 12:27:20 -05:00
Aaron Molitor
30b05b469c Revert "Refactor: ClusterController driving cluster-recovery state machine"
This reverts commit dfe9d184ff5dd66bdbbc5b984688ac3ebb15b901.
2021-12-24 11:25:51 -08:00
Aaron Molitor
d174bb2e06 Revert "Refactor: ClusterController driving cluster-recovery state machine"
This reverts commit abd2959702b0027ab23b8d42d8082b79c3b197f3.
2021-12-24 11:25:51 -08:00
Ata E Husain Bohra
abd2959702 Refactor: ClusterController driving cluster-recovery state machine
diff-1: Address Jingyu's review comments

At present, cluster recovery process consists of following steps:
1. ClusterController clusterWatchDatabase actor recruits
   master/sequencer process.
2. Sequencer process implements the cluster recovery state machine,
   responsible to recruit all other processes as well restore the
   cluster state.

Patch proposes a scheme where the cluster recovery state machine
is implemented and driven by the ClusterController process instead
of the Sequencer process.

Advantages of the scheme could be:
1. Simplified design where ClusterController recruits "sequencer"
   process like other worker processes compared to current scheme
   where "sequencer" process gets special treatment. In newer scheme
   sequencer is responsible for maintaining/providing
   "committed version" (as expected).
2. ClusterController is responsible for worker processes recruitment,
   the sequencer though orchestrating the recovery state machine, it
   need to reachout to the ClusterController for recruiting worker
   processes etc.

NOTE:
Patch has moved the recovery state machine code from
'sequencer' -> 'cluster-controller' process, however, necessary
updates were done for both functionality as well as performance
improvement reasons.

Next Steps:
Cluster recovery documentation will be updated in near future.
2021-12-22 14:06:27 -08:00
Ata E Husain Bohra
dfe9d184ff Refactor: ClusterController driving cluster-recovery state machine
At present, cluster recovery process consists of following steps:
1. ClusterController clusterWatchDatabase actor recruits
   master/sequencer process.
2. Sequencer process implements the cluster recovery state machine,
   responsible to recruit all other processes as well restore the
   cluster state.

Patch proposes a scheme where the cluster recovery state machine
is implemented and driven by the ClusterController process instead
of the Sequencer process.

Advantages of the scheme could be:
1. Simplified design where ClusterController recruits "sequencer"
   process like other worker processes compared to current scheme
   where "sequencer" process gets special treatment. In newer scheme
   sequencer is responsible for maintaining/providing
   "committed version" (as expected).
2. ClusterController is responsible for worker processes recruitment,
   the sequencer though orchestrating the recovery state machine, it
   need to reachout to the ClusterController for recruiting worker
   processes etc.

NOTE:
Patch has moved the recovery state machine code from
'sequencer' -> 'cluster-controller' process, however, necessary
updates were done for both functionality as well as performance
improvement reasons.

Next Steps:
Cluster recovery documentation will be updated in near future.
2021-12-22 14:06:27 -08:00
Dan Lambright
9f4ac866cd Avoid context switch between appending version list and updating dv
Port PR 6117 (Resolver saves shardChanged in recent state transactions)
2021-12-13 13:02:32 -05:00
Dan Lambright
0222d8669d fix simulation failures 2021-12-10 09:56:21 -05:00
Evan Tschannen
e3819dad7c fix: If a removed tlog never attempted a queue commit, the update storage loop could get stuck waiting for queueCommittingVersion to advance 2021-11-25 09:55:01 -08:00
Evan Tschannen
964d0209ca
Merge pull request #5637 from sfc-gh-ljoswiak/features/data-loss-prevention
Data loss protection when joining new cluster
2021-11-15 15:26:32 -08:00
Dan Lambright
4979ccb889 commits recovered if written to every tlog minus failure tolerance. 2021-11-12 12:10:04 -05:00
Lukas Joswiak
e4c3f886da Fix recovery issue 2021-11-10 16:15:13 -08:00
Dan Lambright
0f99ad582b first cut unicast recovery 2021-11-10 12:31:16 -05:00
Sreenath Bodagala
1ec238b8b4 - Address a review comment 2021-11-09 20:46:42 +00:00
Lukas Joswiak
15e0d5b29f Add explicit transaction options when reading cluster ID 2021-11-09 12:29:49 -08:00
Lukas Joswiak
74cf64fe0f Sync cluster ID through ServerDBInfo 2021-11-09 12:29:48 -08:00
Lukas Joswiak
4640045243 Fix rare simulation failures
When partitions appear before a cluster has fully recovered, it was
possible to have different tlogs persist different cluster IDs because
they were involved in different partitions. This would affect recovery
when a quorum was eventually reached. The solution to this is to avoid
persisting the cluster ID before a cluster has fully recovered, to make
sure all nodes agree on the cluster ID.
2021-11-09 12:29:48 -08:00
Lukas Joswiak
3988b11fd6 Cleanup 2021-11-09 12:29:48 -08:00
Lukas Joswiak
aa3383f0e3 Exclude when joining new cluster 2021-11-09 12:29:48 -08:00
Lukas Joswiak
3e2c65bb11 Allow tlog to join another cluster but retain its data 2021-11-09 12:29:48 -08:00
Lukas Joswiak
30867750b5 Add protection against storage and tlog data deletion when joining a new cluster 2021-11-09 12:29:47 -08:00
Sreenath Bodagala
26ac1529fa - Unblock any waiting peeks before stopping a tlog. 2021-11-09 17:22:50 +00:00
Markus Pilman
7df059570a Make sure unit tests are run often enough 2021-11-08 15:43:32 -07:00
Dan Lambright
05a1419ba0 Fix corner-case where poppedVersion races with wait on new mutations in tLog 2021-11-03 11:32:31 -04:00
Dan Lambright
befe1993c4 fix conflict on rebase 2021-10-29 12:25:26 -04:00
Sreenath Bodagala
2bf54fda90 - Address review comments 2021-10-28 20:06:11 +00:00
Sreenath Bodagala
4503b0a347 - Capture metrics about empty/non-empty peeks done by storage servers 2021-10-26 14:37:46 +00:00
Evan Tschannen
c615279807
Merge pull request #5720 from sfc-gh-ljoswiak/fixes/recovery-failure-fix
Fix possible recovery hang
2021-10-25 12:35:31 -07:00
Evan Tschannen
f1158371a7 Merge branch 'master' of https://github.com/apple/foundationdb into feature-range-feed
# Conflicts:
#	flow/error_definitions.h
2021-10-21 00:55:12 -07:00
Lukas Joswiak
120d99e941 Fix a recovery hang that could occur when a new recovery was started during the existing recovery 2021-10-19 17:37:14 -07:00
sfc-gh-tclinkenbeard
9e06b6e6e3 Make IClosable interface const-correct 2021-10-18 13:40:47 -07:00
Dan Lambright
23062b892e Calculate tpcv on resolvers 2021-10-15 16:40:00 -04:00