-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
roachprod: create geo-distributed clusters with extra nodes placed at…
… the end Prior to this change, roachprod would create geo-distributed clusters by placing nodes in AZs in contiguous chunks. If the number of total nodes was not evenly divisible by the number of regions, the first regions would be allocated one additional node. This allocation pattern is rarely desirable. A user will commonly allocate a single extra node as a load generator and would generally like that load node to be the final node and for that final node to be the extra node. This changes the allocation where the extra nodes are placed in the same regions as before but are given node indices at the end rather than with the other nodes in their region. After this change a cluster created with `roachprod create $CLUSTER -n 7 --geo` will look like: ``` ajwerner-test-roachprod-gce: [gce] 12h47m58s remaining ajwerner-test-roachprod-gce-0001 ajwerner-test-roachprod-gce-0001.us-east1-b.cockroach-ephemeral 10.142.0.70 34.74.58.108 ajwerner-test-roachprod-gce-0002 ajwerner-test-roachprod-gce-0002.us-east1-b.cockroach-ephemeral 10.142.0.5 35.237.74.155 ajwerner-test-roachprod-gce-0003 ajwerner-test-roachprod-gce-0003.us-west1-b.cockroach-ephemeral 10.138.0.99 35.199.159.104 ajwerner-test-roachprod-gce-0004 ajwerner-test-roachprod-gce-0004.us-west1-b.cockroach-ephemeral 10.138.0.100 35.197.94.83 ajwerner-test-roachprod-gce-0005 ajwerner-test-roachprod-gce-0005.europe-west2-b.cockroach-ephemeral 10.154.15.237 35.230.143.190 ajwerner-test-roachprod-gce-0006 ajwerner-test-roachprod-gce-0006.europe-west2-b.cockroach-ephemeral 10.154.15.236 35.234.156.121 ajwerner-test-roachprod-gce-0007 ajwerner-test-roachprod-gce-0007.us-east1-b.cockroach-ephemeral 10.142.0.33 35.185.62.76 ``` Instead of the previous: ``` ajwerner-test-old: [gce] 12h19m21s remaining ajwerner-test-old-0001 ajwerner-test-old-0001.us-east1-b.cockroach-ephemeral 10.142.0.139 34.74.150.216 ajwerner-test-old-0002 ajwerner-test-old-0002.us-east1-b.cockroach-ephemeral 10.142.0.140 34.73.154.246 ajwerner-test-old-0003 ajwerner-test-old-0003.us-east1-b.cockroach-ephemeral 10.142.0.141 35.243.176.131 ajwerner-test-old-0004 ajwerner-test-old-0004.us-west1-b.cockroach-ephemeral 10.138.0.71 34.83.16.1 ajwerner-test-old-0005 ajwerner-test-old-0005.us-west1-b.cockroach-ephemeral 10.138.0.60 34.83.78.172 ajwerner-test-old-0006 ajwerner-test-old-0006.europe-west2-b.cockroach-ephemeral 10.154.15.200 35.234.148.191 ajwerner-test-old-0007 ajwerner-test-old-0007.europe-west2-b.cockroach-ephemeral 10.154.15.199 35.242.179.144 ``` Release note: None
- Loading branch information
Showing
10 changed files
with
234 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2018 The Cockroach Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
// implied. See the License for the specific language governing | ||
// permissions and limitations under the License. See the AUTHORS file | ||
// for names of contributors. | ||
|
||
package vm | ||
|
||
import ( | ||
"strconv" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestZonePlacement(t *testing.T) { | ||
for i, c := range []struct { | ||
numZones, numNodes int | ||
expected []int | ||
}{ | ||
{1, 1, []int{0}}, | ||
{1, 2, []int{0, 0}}, | ||
{2, 4, []int{0, 0, 1, 1}}, | ||
{2, 5, []int{0, 0, 1, 1, 0}}, | ||
{3, 11, []int{0, 0, 0, 1, 1, 1, 2, 2, 2, 0, 1}}, | ||
} { | ||
t.Run(strconv.Itoa(i), func(t *testing.T) { | ||
assert.EqualValues(t, c.expected, ZonePlacement(c.numZones, c.numNodes)) | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.