Skip to content

Commit 003e447

Browse files
committed
fix: dont call updateRouting recursively
1 parent 44f615d commit 003e447

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

routing.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,10 @@ func (db *Olric) updateRouting() {
311311
db.log.V(2).Printf("[ERROR] Failed to update routing table on cluster: %v", err)
312312
return
313313
}
314-
if changed := db.processOwnershipReports(reports); changed {
315-
db.log.V(2).Printf("[INFO] Updating routing table again to repair inconsistencies")
316-
db.updateRouting()
317-
}
314+
db.processOwnershipReports(reports)
318315
}
319316

320-
func (db *Olric) processOwnershipReports(reports map[discovery.Member]ownershipReport) bool {
317+
func (db *Olric) processOwnershipReports(reports map[discovery.Member]ownershipReport) {
321318
check := func(member discovery.Member, owners []discovery.Member) bool {
322319
for _, owner := range owners {
323320
if hostCmp(member, owner) {
@@ -327,13 +324,11 @@ func (db *Olric) processOwnershipReports(reports map[discovery.Member]ownershipR
327324
return false
328325
}
329326

330-
var changed bool
331327
ensureOwnership := func(member discovery.Member, partID uint64, part *partition) {
332328
owners := part.loadOwners()
333329
if check(member, owners) {
334330
return
335331
}
336-
changed = true
337332
// This section is protected by routingMtx against parallel writers.
338333
//
339334
// Copy owners and append the member to head
@@ -357,7 +352,6 @@ func (db *Olric) processOwnershipReports(reports map[discovery.Member]ownershipR
357352
ensureOwnership(member, partID, part)
358353
}
359354
}
360-
return changed
361355
}
362356

363357
func (db *Olric) processNodeEvent(event *discovery.ClusterEvent) {

0 commit comments

Comments
 (0)