Add a sysview call to determine if a mount is local. (#3899)

This is useful for deciding when to run upgrade logic, e.g. if on a
performance secondary but local it's fine to run.
This commit is contained in:
Jeff Mitchell
2018-02-02 18:17:12 -05:00
committed by GitHub
parent feb47cbf7f
commit 3d7d2a01dd
6 changed files with 237 additions and 129 deletions

View File

@@ -39,6 +39,10 @@ type SystemView interface {
// despite known slowdowns.
CachingDisabled() bool
// When run from a system view attached to a request, indicates whether the
// request is affecting a local mount or not
LocalMount() bool
// ReplicationState indicates the state of cluster replication
ReplicationState() consts.ReplicationState
@@ -63,6 +67,7 @@ type StaticSystemView struct {
CachingDisabledVal bool
Primary bool
EnableMlock bool
LocalMountVal bool
ReplicationStateVal consts.ReplicationState
}
@@ -86,6 +91,10 @@ func (d StaticSystemView) CachingDisabled() bool {
return d.CachingDisabledVal
}
func (d StaticSystemView) LocalMount() bool {
return d.LocalMountVal
}
func (d StaticSystemView) ReplicationState() consts.ReplicationState {
return d.ReplicationStateVal
}