Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Add Participant which is non-embedded-etcd version of Member.
Rename Member to the EmbeddedEtcdMember.
Add Member interface which defines the behavior of a member particpating in an election regardless of concrete mechanism behind.
Decouple embedded etcd from TSO AllocatorManager, GlobalTSOAllocator and LocalTSOAllocator.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Refactor the GRPC and HTTP Server start logic.
It refers to DGraph https://github.com/binshi-bing/dgraph/blob/cbec2309413a9b17d407b3417300f719381b36d7/dgraph/cmd/zero/run.go#L318-L319 and cmux example https://github.com/soheilhy/cmux/blob/5ec6847320e53b5fee0ab9a4757b56625a946c85/example/example_test.go#L108.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Add TSO primary/leader election loop and adjust config with default values.
Changes:
1. Add TSO primary/leader election loop
2. Add tso.Config.Adjust() to adjust config with default values if they're not in configuration file or passed from commandline.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Handle feedbacks
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Update defaultListenAddr = 127.0.0.1:3379 and defaultHTTPGracefulShutdownTimeout = 5 * time.Second
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
rebase master
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Handle feedbacks
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Update the key for keyspace group primary election (e.g., /pd/microservice/tso/keyspace-group-00000/primary)
The entire key is in the format of "/pd/microservice/tso/keyspace-group-XXXXX/primary" in which XXXXX is 5 digits integer with leading zeros.
For example, the key for keyspace group 0 primary election is "/pd/microservice/tso/keyspace-group-00000/primary"
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Update the format of the key for keyspace group primary electio to "/pd/<cluster-id>/microservice/tso/keyspace-group-XXXXX/primary".
For now we use 0 as the default cluster id.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Refactor log when grpc/http server stops serving
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Handle feedback -- move Member interface to pkg/tso to keep the just-right visibility
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Add unique name/id for Compaign Election and fix a bug in Primary Election loop.
Passed HA/Failure test on local box.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Set cluster id to default value 0 for now to satisfy the cluster id verification between the client and the server side.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Add TSO Server Start/Stop Unittest.
Signed-off-by: Bin Shi <binshi.bing@gmail.com>