MCPcopy Create free account
hub / github.com/couchbase/cbft / run

Method run

version.go:118–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116}
117
118func (vt *clusterVersionTracker) run() {
119 found := int32(1)
120 ev, err := getEffectiveClusterVersion(vt.server)
121 if err != nil {
122 log.Printf("version: getEffectiveClusterVersion, err: %v", err)
123 }
124
125 vt.clusterVersion = ev
126
127 if vt.version == ev {
128 log.Printf("version: matching clusterCompatibility"+
129 " version: %d found", ev)
130 atomic.StoreInt32(&vt.found, found)
131 return
132 }
133
134 // monitor the effective cluster version until it matches the app version.
135 ticker := time.NewTicker(time.Minute)
136 defer ticker.Stop()
137
138 for {
139 select {
140 case <-ticker.C:
141 ev, err := getEffectiveClusterVersion(vt.server)
142 if err != nil {
143 log.Printf("version: getEffectiveClusterVersion, err: %v", err)
144 continue
145 }
146
147 vt.clusterVersion = ev
148
149 if vt.version != ev {
150 continue
151 }
152
153 log.Printf("version: matching clusterCompatibility"+
154 " version: %d found", ev)
155
156 atomic.StoreInt32(&vt.found, found)
157 return
158 }
159 }
160}
161
162// clusterCompatibleForVersion checks whether a compatible cluster found
163// If not, then it checks whether the current cluster compatibility

Callers 1

Calls 1

Tested by

no test coverage detected