1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

code: replace 'master' with 'leader' where appropriate.

Leader already is the more widely used terminology, but a few places
didn't get the message.

Author: Andres Freund
Reviewed-By: David Steele
Discussion: https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue@alap3.anarazel.de
This commit is contained in:
Andres Freund
2020-06-14 14:22:47 -07:00
parent 5e7bbb5286
commit e07633646a
18 changed files with 120 additions and 120 deletions

View File

@ -89,9 +89,9 @@ typedef struct FixedParallelState
Oid temp_toast_namespace_id;
int sec_context;
bool is_superuser;
PGPROC *parallel_master_pgproc;
pid_t parallel_master_pid;
BackendId parallel_master_backend_id;
PGPROC *parallel_leader_pgproc;
pid_t parallel_leader_pid;
BackendId parallel_leader_backend_id;
TimestampTz xact_ts;
TimestampTz stmt_ts;
SerializableXactHandle serializable_xact_handle;
@ -124,7 +124,7 @@ static FixedParallelState *MyFixedParallelState;
static dlist_head pcxt_list = DLIST_STATIC_INIT(pcxt_list);
/* Backend-local copy of data from FixedParallelState. */
static pid_t ParallelMasterPid;
static pid_t ParallelLeaderPid;
/*
* List of internal parallel worker entry points. We need this for
@ -323,9 +323,9 @@ InitializeParallelDSM(ParallelContext *pcxt)
GetUserIdAndSecContext(&fps->current_user_id, &fps->sec_context);
GetTempNamespaceState(&fps->temp_namespace_id,
&fps->temp_toast_namespace_id);
fps->parallel_master_pgproc = MyProc;
fps->parallel_master_pid = MyProcPid;
fps->parallel_master_backend_id = MyBackendId;
fps->parallel_leader_pgproc = MyProc;
fps->parallel_leader_pid = MyProcPid;
fps->parallel_leader_backend_id = MyBackendId;
fps->xact_ts = GetCurrentTransactionStartTimestamp();
fps->stmt_ts = GetCurrentStatementStartTimestamp();
fps->serializable_xact_handle = ShareSerializableXact();
@ -857,8 +857,8 @@ WaitForParallelWorkersToFinish(ParallelContext *pcxt)
*
* This function ensures that workers have been completely shutdown. The
* difference between WaitForParallelWorkersToFinish and this function is
* that former just ensures that last message sent by worker backend is
* received by master backend whereas this ensures the complete shutdown.
* that the former just ensures that last message sent by a worker backend is
* received by the leader backend whereas this ensures the complete shutdown.
*/
static void
WaitForParallelWorkersToExit(ParallelContext *pcxt)
@ -1302,8 +1302,8 @@ ParallelWorkerMain(Datum main_arg)
MyFixedParallelState = fps;
/* Arrange to signal the leader if we exit. */
ParallelMasterPid = fps->parallel_master_pid;
ParallelMasterBackendId = fps->parallel_master_backend_id;
ParallelLeaderPid = fps->parallel_leader_pid;
ParallelLeaderBackendId = fps->parallel_leader_backend_id;
on_shmem_exit(ParallelWorkerShutdown, (Datum) 0);
/*
@ -1318,8 +1318,8 @@ ParallelWorkerMain(Datum main_arg)
shm_mq_set_sender(mq, MyProc);
mqh = shm_mq_attach(mq, seg, NULL);
pq_redirect_to_shm_mq(seg, mqh);
pq_set_parallel_master(fps->parallel_master_pid,
fps->parallel_master_backend_id);
pq_set_parallel_leader(fps->parallel_leader_pid,
fps->parallel_leader_backend_id);
/*
* Send a BackendKeyData message to the process that initiated parallelism
@ -1347,8 +1347,8 @@ ParallelWorkerMain(Datum main_arg)
* deadlock. (If we can't join the lock group, the leader has gone away,
* so just exit quietly.)
*/
if (!BecomeLockGroupMember(fps->parallel_master_pgproc,
fps->parallel_master_pid))
if (!BecomeLockGroupMember(fps->parallel_leader_pgproc,
fps->parallel_leader_pid))
return;
/*
@ -1410,7 +1410,7 @@ ParallelWorkerMain(Datum main_arg)
/* Restore transaction snapshot. */
tsnapspace = shm_toc_lookup(toc, PARALLEL_KEY_TRANSACTION_SNAPSHOT, false);
RestoreTransactionSnapshot(RestoreSnapshot(tsnapspace),
fps->parallel_master_pgproc);
fps->parallel_leader_pgproc);
/* Restore active snapshot. */
asnapspace = shm_toc_lookup(toc, PARALLEL_KEY_ACTIVE_SNAPSHOT, false);
@ -1510,9 +1510,9 @@ ParallelWorkerReportLastRecEnd(XLogRecPtr last_xlog_end)
static void
ParallelWorkerShutdown(int code, Datum arg)
{
SendProcSignal(ParallelMasterPid,
SendProcSignal(ParallelLeaderPid,
PROCSIG_PARALLEL_MESSAGE,
ParallelMasterBackendId);
ParallelLeaderBackendId);
}
/*

View File

@ -750,7 +750,7 @@ GetCurrentCommandId(bool used)
{
/*
* Forbid setting currentCommandIdUsed in a parallel worker, because
* we have no provision for communicating this back to the master. We
* we have no provision for communicating this back to the leader. We
* could relax this restriction when currentCommandIdUsed was already
* true at the start of the parallel operation.
*/
@ -987,7 +987,7 @@ ExitParallelMode(void)
/*
* IsInParallelMode
*
* Are we in a parallel operation, as either the master or a worker? Check
* Are we in a parallel operation, as either the leader or a worker? Check
* this to prohibit operations that change backend-local state expected to
* match across all workers. Mere caches usually don't require such a
* restriction. State modified in a strict push/pop fashion, such as the
@ -2164,13 +2164,13 @@ CommitTransaction(void)
else
{
/*
* We must not mark our XID committed; the parallel master is
* We must not mark our XID committed; the parallel leader is
* responsible for that.
*/
latestXid = InvalidTransactionId;
/*
* Make sure the master will know about any WAL we wrote before it
* Make sure the leader will know about any WAL we wrote before it
* commits.
*/
ParallelWorkerReportLastRecEnd(XactLastRecEnd);
@ -2699,7 +2699,7 @@ AbortTransaction(void)
latestXid = InvalidTransactionId;
/*
* Since the parallel master won't get our value of XactLastRecEnd in
* Since the parallel leader won't get our value of XactLastRecEnd in
* this case, we nudge WAL-writer ourselves in this case. See related
* comments in RecordTransactionAbort for why this matters.
*/
@ -4488,7 +4488,7 @@ RollbackAndReleaseCurrentSubTransaction(void)
/*
* Unlike ReleaseCurrentSubTransaction(), this is nominally permitted
* during parallel operations. That's because we may be in the master,
* during parallel operations. That's because we may be in the leader,
* recovering from an error thrown while we were in parallel mode. We
* won't reach here in a worker, because BeginInternalSubTransaction()
* will have failed.