MCPcopy
hub / github.com/dgraph-io/dgraph / snapshotPeriodically

Method snapshotPeriodically

dgraph/cmd/zero/raft.go:845–860  ·  view source on GitHub ↗
(closer *z.Closer)

Source from the content-addressed store, hash-verified

843}
844
845func (n *node) snapshotPeriodically(closer *z.Closer) {
846 defer closer.Done()
847 ticker := time.Tick(time.Minute)
848
849 for {
850 select {
851 case <-ticker:
852 if err := n.calculateAndProposeSnapshot(); err != nil {
853 glog.Errorf("While calculateAndProposeSnapshot: %v", err)
854 }
855
856 case <-closer.HasBeenClosed():
857 return
858 }
859 }
860}
861
862// calculateAndProposeSnapshot works by tracking Alpha group leaders' checkpoint timestamps. It then
863// finds the minimum checkpoint ts across these groups, say Tmin. And then, iterates over Zero Raft

Callers 1

RunMethod · 0.95

Calls 3

DoneMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected