Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

question about random order in CheckAndRecover function #798

Closed
yangeagle opened this issue Feb 8, 2019 · 1 comment
Closed

question about random order in CheckAndRecover function #798

yangeagle opened this issue Feb 8, 2019 · 1 comment
Assignees

Comments

@yangeagle
Copy link
Contributor

File: go/logic/topology_recovery.go
Function: CheckAndRecover
Code:

... ...
	// intentionally iterating entries in random order
	for i := range rand.Perm(len(replicationAnalysis)) {
               analysisEntry := replicationAnalysis[i]

... ....

The iterating order is always 0, 1, 2, ...

I guess the code should be like as below:

        for i, j := range rand.Perm(10){
                fmt.Println("i:",i, ", j:", j)
        }

output:

i: 0 , j: 9
i: 1 , j: 4
i: 2 , j: 2
i: 3 , j: 6
i: 4 , j: 8
i: 5 , j: 0
i: 6 , j: 3
i: 7 , j: 1
i: 8 , j: 7
i: 9 , j: 5

The variable j should be used.

@MOON-CLJ

@shlomi-noach
Copy link
Collaborator

Addressed by #800

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants