MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / initLeaderId

Method initLeaderId

store/engine/postgresql/postgresql.go:279–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277}
278
279func (p *Postgresql) initLeaderId() error {
280 var leaderId string
281 query := "SELECT leaderID FROM locks WHERE name = $1"
282 row := p.db.QueryRow(query, p.electPath)
283 err := row.Scan(&leaderId)
284 if errors.Is(err, sql.ErrNoRows) {
285 p.leaderID = ""
286 return nil
287 }
288 if err != nil {
289 return err
290 }
291 p.leaderID = leaderId
292 return nil
293}
294
295func (p *Postgresql) Close() error {
296 close(p.quitCh)

Callers 1

NewFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected