Feature: Support Leader Election API for databend-meta
Summary If there exists some background query nodes as a cluster, they are required to election a leader to retrieve and distribute a task, for now we have already implemented table lock, and we could implement leader election based on it.
Ref: https://shreemaan-abhishek.hashnode.dev/microservice-leader-election-using-etcd
The election process described in the ref is exactly same as the traditional etcd-locking algorithm, and has no much differences from our table lock.
IMHO you can just reuse table lock for leader election.
Another relating issue is to provide ephemeral node by meta-service:
- #8103
So that when a election/locking client crash, the lock node(or election key) will be removed automatically.