Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit range over processes to DC #1264

Closed
johscheuer opened this issue Jun 26, 2022 · 0 comments
Closed

Limit range over processes to DC #1264

johscheuer opened this issue Jun 26, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@johscheuer
Copy link
Member

What would you like to be added/changed?

We have multiple places where we iterate over all processes from the cluster status and convert that information in a map or another structure that will be used later. I think it makes sense to filter processes and only include processes that have a matching DC ID:

// Only include processes that are managed by this instance of the FoundationDBCluster
if cluster.Spec.DataCenter != p.Locality[fdbv1beta2.FDBLocalityDCIDKey] {
    continue
}

If cluster.Spec.DataCenter is unset it will compare two empty strings which will also match. This would have that for HA clusters we don' have to allocate additional memory for unused information.

A simple grep revealed those places where we use. the cluster status information (I removed all test files):

$ rg -g '!*_test.go' -i 'status.Cluster.Processes'
controllers/choose_removals.go
63:     for _, process := range status.Cluster.Processes {

controllers/admin_client_mock.go
207:                    status.Cluster.Processes[fmt.Sprintf("%s-%d", pod.Name, processIndex)] = fdbv1beta2.FoundationDBStatusProcessInfo{
230:                    status.Cluster.Processes[processGroup.ProcessGroupID] = fdbv1beta2.FoundationDBStatusProcessInfo{

controllers/change_coordinators.go
125:    candidates := make([]localityInfo, 0, len(status.Cluster.Processes))
126:    for _, process := range status.Cluster.Processes {

controllers/update_status.go
98:     for _, process := range databaseStatus.Cluster.Processes {

controllers/bounce_processes.go
59:     addressMap := make(map[string][]fdbv1beta2.ProcessAddress, len(status.Cluster.Processes))
60:     for _, process := range status.Cluster.Processes {
224:    addresses := make([]fdbv1beta2.ProcessAddress, 0, len(databaseStatus.Cluster.Processes))
225:    for _, process := range databaseStatus.Cluster.Processes {

controllers/cluster_controller.go
617:    for _, process := range status.Cluster.Processes {

internal/foundationdb_status.go
32:     for _, pInfo := range status.Cluster.Processes {

internal/removals/remove.go
89:     for _, p := range status.Cluster.Processes {

fdbclient/admin_client.go
356:    for _, process := range status.Cluster.Processes {

kubectl-fdb/cmd/exclusion_status.go
166:            for _, process := range status.Cluster.Processes {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants