-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue in distributing queries when running query schedulers in ri…
…ng mode
- Loading branch information
1 parent
01f0ded
commit 4148dd2
Showing
9 changed files
with
481 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package scheduler | ||
|
||
import ( | ||
"github.com/grafana/dskit/ring" | ||
) | ||
|
||
func (rm *RingManager) OnRingInstanceRegister(_ *ring.BasicLifecycler, ringDesc ring.Desc, instanceExists bool, instanceID string, instanceDesc ring.InstanceDesc) (ring.InstanceState, ring.Tokens) { | ||
// When we initialize the index gateway instance in the ring we want to start from | ||
// a clean situation, so whatever is the state we set it JOINING, while we keep existing | ||
// tokens (if any) or the ones loaded from file. | ||
var tokens []uint32 | ||
if instanceExists { | ||
tokens = instanceDesc.GetTokens() | ||
} | ||
|
||
takenTokens := ringDesc.GetTokens() | ||
newTokens := ring.GenerateTokens(ringNumTokens-len(tokens), takenTokens) | ||
|
||
// Tokens sorting will be enforced by the parent caller. | ||
tokens = append(tokens, newTokens...) | ||
|
||
return ring.JOINING, tokens | ||
} | ||
|
||
func (rm *RingManager) OnRingInstanceTokens(_ *ring.BasicLifecycler, _ ring.Tokens) {} | ||
func (rm *RingManager) OnRingInstanceStopping(_ *ring.BasicLifecycler) {} | ||
func (rm *RingManager) OnRingInstanceHeartbeat(_ *ring.BasicLifecycler, _ *ring.Desc, _ *ring.InstanceDesc) { | ||
} |
Oops, something went wrong.