Use pgstat_progress_update_multi_param() where possible
This commit changes one code path in REINDEX INDEX and one code path in CREATE INDEX CONCURRENTLY to report the progress of each operation using pgstat_progress_update_multi_param() rather than multiple calls to pgstat_progress_update_param(). This has the advantage to make the progress report more consistent to the end-user without impacting the amount of information provided. Author: Bharath Rupireddy Discussion: https://postgr.es/m/CALj2ACV5zW7GxD8D_tyO==bcj6ZktQchEKWKPBOAGKiLhAQo=w@mail.gmail.com
This commit is contained in:
parent
db8374d804
commit
9294264278
|
@ -3686,12 +3686,18 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
|
|||
|
||||
if (progress)
|
||||
{
|
||||
const int progress_cols[] = {
|
||||
PROGRESS_CREATEIDX_COMMAND,
|
||||
PROGRESS_CREATEIDX_INDEX_OID
|
||||
};
|
||||
const int64 progress_vals[] = {
|
||||
PROGRESS_CREATEIDX_COMMAND_REINDEX,
|
||||
indexId
|
||||
};
|
||||
|
||||
pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX,
|
||||
heapId);
|
||||
pgstat_progress_update_param(PROGRESS_CREATEIDX_COMMAND,
|
||||
PROGRESS_CREATEIDX_COMMAND_REINDEX);
|
||||
pgstat_progress_update_param(PROGRESS_CREATEIDX_INDEX_OID,
|
||||
indexId);
|
||||
pgstat_progress_update_multi_param(2, progress_cols, progress_vals);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1457,10 +1457,21 @@ DefineIndex(Oid relationId,
|
|||
set_indexsafe_procflags();
|
||||
|
||||
/*
|
||||
* The index is now visible, so we can report the OID.
|
||||
* The index is now visible, so we can report the OID. While on it,
|
||||
* include the report for the beginning of phase 2.
|
||||
*/
|
||||
pgstat_progress_update_param(PROGRESS_CREATEIDX_INDEX_OID,
|
||||
indexRelationId);
|
||||
{
|
||||
const int progress_cols[] = {
|
||||
PROGRESS_CREATEIDX_INDEX_OID,
|
||||
PROGRESS_CREATEIDX_PHASE
|
||||
};
|
||||
const int64 progress_vals[] = {
|
||||
indexRelationId,
|
||||
PROGRESS_CREATEIDX_PHASE_WAIT_1
|
||||
};
|
||||
|
||||
pgstat_progress_update_multi_param(2, progress_cols, progress_vals);
|
||||
}
|
||||
|
||||
/*
|
||||
* Phase 2 of concurrent index build (see comments for validate_index()
|
||||
|
@ -1478,8 +1489,6 @@ DefineIndex(Oid relationId,
|
|||
* exclusive lock on our table. The lock code will detect deadlock and
|
||||
* error out properly.
|
||||
*/
|
||||
pgstat_progress_update_param(PROGRESS_CREATEIDX_PHASE,
|
||||
PROGRESS_CREATEIDX_PHASE_WAIT_1);
|
||||
WaitForLockers(heaplocktag, ShareLock, true);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue