etcd/etcdserver
Tobias Schottdorf c9491d7861 raft: clean up bootstrap
This is the first (maybe not last) step in cleaning up the bootstrap
code around StartNode.

Initializing a Raft group for the first time is awkward, since a
configuration has to be pulled from thin air. The way this is solved
today is unclean: The app is supposed to pass peers to StartNode(),
we add configuration changes for them to the log, immediately pretend
that they are applied, but actually leave them unapplied (to give the
app a chance to observe them, though if the app did decide to not apply
them things would really go off the rails), and then return control to
the app. The app will then process the initial Readys and as a result
the configuration will be persisted to disk; restarts of the node then
use RestartNode which doesn't take any peers.

The code that did this lived awkwardly in two places fairly deep down
the callstack, though it was really only necessary in StartNode(). This
commit refactors things to make this more obvious: only StartNode does
this dance now. In particular, RawNode does not support this at all any
more; it expects the app to set up its Storage correctly.

Future work may provide helpers to make this "preseeding" of the Storage
more user-friendly. It isn't entirely straightforward to do so since
the Storage interface doesn't provide the right accessors for this
purpose. Briefly speaking, we want to make sure that a non-bootstrapped
node can never catch up via the log so that we can implicitly use one
of the "skipped" log entries to represent the configuration change into
the bootstrap configuration. This is an invasive change that affects
all consumers of raft, and it is of lower urgency since the code (post
this commit) already encapsulates the complexity sufficiently.
2019-07-19 10:02:02 +02:00
..
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2016-05-12 20:49:40 -07:00
2019-06-05 10:51:21 +08:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-07-19 10:02:02 +02:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00
2019-05-28 15:39:35 -07:00