1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00

broadcast an event on election of cleanup leader

Signed-off-by: Oshank Kumar <okumar@redhat.com>
This commit is contained in:
Oshank Kumar
2019-02-28 12:48:54 +05:30
committed by Kaushal M
parent 829f22ac31
commit 994aaa0489

View File

@@ -6,9 +6,11 @@ import (
"sync"
"time"
"github.com/gluster/glusterd2/glusterd2/events"
"github.com/gluster/glusterd2/glusterd2/gdctx"
"github.com/gluster/glusterd2/glusterd2/store"
"github.com/gluster/glusterd2/glusterd2/transactionv2"
"github.com/gluster/glusterd2/pkg/api"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/clientv3/concurrency"
@@ -133,6 +135,7 @@ func (c *CleanupHandler) StartElecting() {
log.Info("node got elected as cleanup leader")
c.Lock()
defer c.Unlock()
events.Broadcast(newCleanupLeaderEvent())
c.isLeader = true
}
@@ -170,6 +173,15 @@ func StopCleanupLeader() {
}
}
func newCleanupLeaderEvent() *api.Event {
data := map[string]string{
"peer.id": gdctx.MyUUID.String(),
"peer.name": gdctx.HostName,
}
return events.New("cleanup leader elected", data, true)
}
func init() {
expVar := expvar.Get("txn")
if expVar == nil {