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

Commit ded452d

Browse files
committed
Change uses of "master" to "coordinator"
As part of an effort to use more inclusive terminology, GPDB 7 is renaming the GPDB "master" to the "coordinator" and the "master" branch to "main", and any related code is to be changed as well. This commit adds new INCLUDE_COORDINATOR and EXCLUDE_COORDINATOR scopes as synonyms of the existing INCLUDE_MASTER and EXCLUDE_MASTER scopes, instead of renaming them, to maintain backwards compatibility for now. All internal usage of the term is updated, however.
1 parent 290c53a commit ded452d

File tree

3 files changed

+98
-91
lines changed

3 files changed

+98
-91
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,5 @@ set-prod:
6161
fly --target prod set-pipeline --check-creds \
6262
--pipeline=gp-common-go-libs \
6363
-c ci/pipeline.yml \
64-
--var=branch=master \
64+
--var=branch=main\
6565
--var=golang-version=${GOLANG_VERSION}

cluster/cluster.go

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ type SegConfig struct {
6262
* ON_SEGMENTS: Execute one command per segment.
6363
* ON_HOSTS: Execute one command per host.
6464
*
65-
* INCLUDE_MASTER: Include the master host or segment in the command list.
66-
* EXCLUDE_MASTER: Exclude the master host or segment from the command list.
65+
* INCLUDE_COORDINATOR: Include the coordinator host or segment in the command list.
66+
* EXCLUDE_COORDINATOR: Exclude the coordinator host or segment from the command list.
6767
*
6868
* ON_REMOTE: Execute each command on the specified remote segment/host.
69-
* ON_LOCAL: Execute all commands on the master host.
69+
* ON_LOCAL: Execute all commands on the coordinator host.
7070
*
7171
* INCLUDE_MIRRORS: Include mirror segments and hosts in the command list.
7272
* EXCLUDE_MIRRORS: Exclude mirror segments and hosts from the command list.
@@ -75,38 +75,45 @@ type SegConfig struct {
7575
* obtain a final scope, which has the following bitmask:
7676
*
7777
* /------- INCLUDE_MIRRORS (1) or EXCLUDE_MIRRORS (0)
78-
* |/------ INCLUDE_MASTER (1) or EXCLUDE_MASTER (0)
78+
* |/------ INCLUDE_COORDINATOR (1) or EXCLUDE_COORDINATOR (0)
7979
* ||/----- ON_LOCAL (1) or ON_REMOTE (0)
8080
* |||/---- ON_HOSTS (1) or ON_SEGMENTS (0)
8181
* ||||
8282
* vvvv
8383
* 0000
8484
*
85-
* For instance, to execute a command on all hosts including the master host,
86-
* you would pass a function the scope ON_HOSTS | INCLUDE_MASTER.
85+
* For instance, to execute a command on all hosts including the coordinator host,
86+
* you would pass a function the scope ON_HOSTS | INCLUDE_COORDINATOR.
8787
*
8888
* The default scope is 0000, to execute a command on all primary segments,
89-
* equivalent to ON_SEGMENTS | ON_REMOTE | EXCLUDE_MASTER | EXCLUDE_MIRRORS,
89+
* equivalent to ON_SEGMENTS | ON_REMOTE | EXCLUDE_COORDINATOR | EXCLUDE_MIRRORS,
9090
* though by convention only ON_SEGMENTS need be passed to a function.
9191
*
9292
* Technically, the four zero-valued constants are redundant, but are provided
9393
* so that function callers can specify whatever scope they feel is most clear
94-
* (e.g. using INCLUDE_MASTER vs. EXCLUDE_MASTER as the basic scopes instead of
94+
* (e.g. using INCLUDE_COORDINATOR vs. EXCLUDE_COORDINATOR as the basic scopes instead of
9595
* ON_SEGMENTS vs. ON_HOSTS if every ExecuteClusterCommand call is per-segment
96-
* and the utility includes the master in commands a good portion of the time.)
96+
* and the utility includes the coordinator in commands a good portion of the time.)
97+
*
98+
* In version 1.0.10, support for the COORDINATOR scope was added, as GPDB 7 uses
99+
* "coordinator" in place of "master". The MASTER scopes are left in place (and
100+
* identical to the COORDINATOR scopes) for backwards compatibility, but may be
101+
* deprecated in future.
97102
*/
98103

99104
type Scope uint8
100105

101106
const (
102-
ON_SEGMENTS Scope = 0
103-
ON_HOSTS Scope = 1
104-
EXCLUDE_MASTER Scope = 0
105-
INCLUDE_MASTER Scope = 1 << 1
106-
ON_REMOTE Scope = 0
107-
ON_LOCAL Scope = 1 << 2
108-
EXCLUDE_MIRRORS Scope = 0
109-
INCLUDE_MIRRORS Scope = 1 << 3
107+
ON_SEGMENTS Scope = 0
108+
ON_HOSTS Scope = 1
109+
EXCLUDE_COORDINATOR Scope = 0
110+
INCLUDE_COORDINATOR Scope = 1 << 1
111+
EXCLUDE_MASTER Scope = 0
112+
INCLUDE_MASTER Scope = 1 << 1
113+
ON_REMOTE Scope = 0
114+
ON_LOCAL Scope = 1 << 2
115+
EXCLUDE_MIRRORS Scope = 0
116+
INCLUDE_MIRRORS Scope = 1 << 3
110117
)
111118

112119
func scopeIsSegments(scope Scope) bool {
@@ -117,12 +124,12 @@ func scopeIsHosts(scope Scope) bool {
117124
return scope&ON_HOSTS == ON_HOSTS
118125
}
119126

120-
func scopeExcludesMaster(scope Scope) bool {
121-
return scope&INCLUDE_MASTER == EXCLUDE_MASTER
127+
func scopeExcludesCoordinator(scope Scope) bool {
128+
return scope&INCLUDE_COORDINATOR == EXCLUDE_COORDINATOR
122129
}
123130

124-
func scopeIncludesMaster(scope Scope) bool {
125-
return scope&INCLUDE_MASTER == INCLUDE_MASTER
131+
func scopeIncludesCoordinator(scope Scope) bool {
132+
return scope&INCLUDE_COORDINATOR == INCLUDE_COORDINATOR
126133
}
127134

128135
func scopeIsRemote(scope Scope) bool {
@@ -248,20 +255,20 @@ func (cluster *Cluster) GenerateCommandList(scope Scope, generator interface{})
248255
switch generateCommand := generator.(type) {
249256
case func(content int) []string:
250257
for _, content := range cluster.ContentIDs {
251-
if content == -1 && scopeExcludesMaster(scope) {
258+
if content == -1 && scopeExcludesCoordinator(scope) {
252259
continue
253260
}
254261
commands = append(commands, NewShellCommand(scope, content, "", generateCommand(content)))
255262
}
256263
case func(host string) []string:
257264
for _, host := range cluster.Hostnames {
258265
hostHasOneContent := len(cluster.GetContentsForHost(host)) == 1
259-
if host == cluster.GetHostForContent(-1, "p") && scopeExcludesMaster(scope) && hostHasOneContent {
260-
// Only exclude the master host if there are no local segments
266+
if host == cluster.GetHostForContent(-1, "p") && scopeExcludesCoordinator(scope) && hostHasOneContent {
267+
// Only exclude the coordinator host if there are no local segments
261268
continue
262269
}
263270
if host == cluster.GetHostForContent(-1, "m") && scopeExcludesMirrors(scope) && hostHasOneContent {
264-
// Only exclude the standby master host if there are no segments there
271+
// Only exclude the standby coordinator host if there are no segments there
265272
continue
266273
}
267274
commands = append(commands, NewShellCommand(scope, -2, host, generateCommand(host)))
@@ -349,8 +356,8 @@ func (executor *GPDBExecutor) ExecuteClusterCommand(scope Scope, commandList []S
349356
* to simplify execution of...
350357
* 1. shell commands directly on remote hosts via ssh.
351358
* - e.g. running an ls on all hosts
352-
* 2. shell commands on master to push to remote hosts.
353-
* - e.g. running multiple scps on master to push a file to all segments
359+
* 2. shell commands on coordinator to push to remote hosts.
360+
* - e.g. running multiple scps on coordinator to push a file to all segments
354361
*/
355362
func (cluster *Cluster) GenerateAndExecuteCommand(verboseMsg string, scope Scope, generator interface{}) *RemoteOutput {
356363
gplog.Verbose(verboseMsg)
@@ -386,7 +393,7 @@ func (cluster *Cluster) CheckClusterError(remoteOutput *RemoteOutput, finalErrMs
386393
func LogFatalClusterError(errMessage string, scope Scope, numErrors int) {
387394
str := " on"
388395
if scopeIsLocal(scope) {
389-
str += " master for"
396+
str += " coordinator for" // No good way to toggle "coordinator" vs. "master" here based on version, so default to "coordinator"
390397
}
391398
errMessage += str
392399

0 commit comments

Comments
 (0)