parent
e8e5e5b818
commit
b7764a58a9
|
@ -11,8 +11,6 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gopkg.in/mgo.v2/bson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -108,7 +106,7 @@ type ReplSetMember struct {
|
||||||
Name string `bson:"name"`
|
Name string `bson:"name"`
|
||||||
State int64 `bson:"state"`
|
State int64 `bson:"state"`
|
||||||
StateStr string `bson:"stateStr"`
|
StateStr string `bson:"stateStr"`
|
||||||
OptimeDate *bson.MongoTimestamp `bson:"optimeDate"`
|
OptimeDate time.Time `bson:"optimeDate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// WiredTiger stores information related to the WiredTiger storage engine.
|
// WiredTiger stores information related to the WiredTiger storage engine.
|
||||||
|
@ -712,9 +710,9 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if me.OptimeDate != nil && master.OptimeDate != nil && me.State == 2 {
|
if me.State == 2 {
|
||||||
// MongoTimestamp type is int64 where the first 32bits are the unix timestamp
|
// OptimeDate.Unix() type is int64
|
||||||
lag := int64(*master.OptimeDate>>32 - *me.OptimeDate>>32)
|
lag := master.OptimeDate.Unix() - me.OptimeDate.Unix()
|
||||||
if lag < 0 {
|
if lag < 0 {
|
||||||
returnVal.ReplLag = 0
|
returnVal.ReplLag = 0
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue