databend icon indicating copy to clipboard operation
databend copied to clipboard

Feature: Support Leader Election API for databend-meta

Open ZhiHanZ opened this issue 2 years ago • 1 comments

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

ZhiHanZ avatar May 24 '23 07:05 ZhiHanZ

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.

drmingdrmer avatar Jun 16 '23 14:06 drmingdrmer