etcd: Rewrite embed etcd implementation

This is a giant cleanup of the etcd code. The earlier version was
written when I was less experienced with golang.

This is still not perfect, and does contain some races, but at least
it's a decent base to start from. The automatic elastic clustering
should be considered an experimental feature. If you need a more
battle-tested cluster, then you should manage etcd manually and point
mgmt at your existing cluster.
This commit is contained in:
James Shubin
2018-05-05 17:35:08 -04:00
parent fb275d9537
commit a5842a41b2
56 changed files with 5459 additions and 2654 deletions

View File

@@ -0,0 +1,27 @@
#!/bin/bash
. "$(dirname "$0")/../util.sh"
# run empty graphs, we're just testing etcd clustering
$TIMEOUT "$MGMT" run --no-pgp --tmp-prefix empty &
pid1=$!
sleep 15s # let it startup
# run a second one that should conflict because a server is already running...
$TIMEOUT "$MGMT" run --no-pgp --tmp-prefix empty &
pid2=$!
wait $pid2
e=$?
if [ $e -eq 0 ]; then
echo "second mgmt exited successfully when error was expected"
exit 1
fi
if [ $e -ne 1 ]; then
echo "second mgmt exited with unexpected error of $e"
exit $e
fi
$(kill -SIGINT $pid1)& # send ^C to exit 1st mgmt
wait $pid1 # get exit status
# if pid1 exits because of a timeout, then it blocked, and this is a bug!
exit $?