1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +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.

View File

@@ -190,7 +190,7 @@ BuildTupleHashTableExt(PlanState *parent,
hashtable->cur_eq_func = NULL;
/*
* If parallelism is in use, even if the master backend is performing the
* If parallelism is in use, even if the leader backend is performing the
* scan itself, we don't want to create the hashtable exactly the same way
* in all workers. As hashtables are iterated over in keyspace-order,
* doing so in all processes in the same way is likely to lead to

View File

@@ -23,8 +23,8 @@
static shm_mq_handle *pq_mq_handle;
static bool pq_mq_busy = false;
static pid_t pq_mq_parallel_master_pid = 0;
static pid_t pq_mq_parallel_master_backend_id = InvalidBackendId;
static pid_t pq_mq_parallel_leader_pid = 0;
static pid_t pq_mq_parallel_leader_backend_id = InvalidBackendId;
static void pq_cleanup_redirect_to_shm_mq(dsm_segment *seg, Datum arg);
static void mq_comm_reset(void);
@@ -73,15 +73,15 @@ pq_cleanup_redirect_to_shm_mq(dsm_segment *seg, Datum arg)
}
/*
* Arrange to SendProcSignal() to the parallel master each time we transmit
* Arrange to SendProcSignal() to the parallel leader each time we transmit
* message data via the shm_mq.
*/
void
pq_set_parallel_master(pid_t pid, BackendId backend_id)
pq_set_parallel_leader(pid_t pid, BackendId backend_id)
{
Assert(PqCommMethods == &PqCommMqMethods);
pq_mq_parallel_master_pid = pid;
pq_mq_parallel_master_backend_id = backend_id;
pq_mq_parallel_leader_pid = pid;
pq_mq_parallel_leader_backend_id = backend_id;
}
static void
@@ -160,10 +160,10 @@ mq_putmessage(char msgtype, const char *s, size_t len)
{
result = shm_mq_sendv(pq_mq_handle, iov, 2, true);
if (pq_mq_parallel_master_pid != 0)
SendProcSignal(pq_mq_parallel_master_pid,
if (pq_mq_parallel_leader_pid != 0)
SendProcSignal(pq_mq_parallel_leader_pid,
PROCSIG_PARALLEL_MESSAGE,
pq_mq_parallel_master_backend_id);
pq_mq_parallel_leader_backend_id);
if (result != SHM_MQ_WOULD_BLOCK)
break;

View File

@@ -11,7 +11,7 @@
* cpu_tuple_cost Cost of typical CPU time to process a tuple
* cpu_index_tuple_cost Cost of typical CPU time to process an index tuple
* cpu_operator_cost Cost of CPU time to execute an operator or function
* parallel_tuple_cost Cost of CPU time to pass a tuple from worker to master backend
* parallel_tuple_cost Cost of CPU time to pass a tuple from worker to leader backend
* parallel_setup_cost Cost of setting up shared memory for parallelism
*
* We expect that the kernel will typically do some amount of read-ahead

View File

@@ -1028,8 +1028,8 @@ max_parallel_hazard_walker(Node *node, max_parallel_hazard_context *context)
* We can't pass Params to workers at the moment either, so they are also
* parallel-restricted, unless they are PARAM_EXTERN Params or are
* PARAM_EXEC Params listed in safe_param_ids, meaning they could be
* either generated within the worker or can be computed in master and
* then their value can be passed to the worker.
* either generated within workers or can be computed by the leader and
* then their value can be passed to workers.
*/
else if (IsA(node, Param))
{

View File

@@ -80,7 +80,7 @@ char postgres_exec_path[MAXPGPATH]; /* full path to backend */
BackendId MyBackendId = InvalidBackendId;
BackendId ParallelMasterBackendId = InvalidBackendId;
BackendId ParallelLeaderBackendId = InvalidBackendId;
Oid MyDatabaseId = InvalidOid;

View File

@@ -3448,7 +3448,7 @@ static struct config_real ConfigureNamesReal[] =
{
{"parallel_tuple_cost", PGC_USERSET, QUERY_TUNING_COST,
gettext_noop("Sets the planner's estimate of the cost of "
"passing each tuple (row) from worker to master backend."),
"passing each tuple (row) from worker to leader backend."),
NULL,
GUC_EXPLAIN
},