mirror of
https://github.com/postgres/postgres.git
synced 2026-10-28 02:33:10 +03:00
Allocate separate DSM chunk for parallel Index[Only]Scan instrumentation
Previously, parallel index and index-only scans packed the parallel scan descriptor and shared instrumentation (for EXPLAIN ANALYZE) into a single DSM allocation. Since scans may be instrumented without being parallel-aware, and vice versa, using separate DSM chunks -- each with its own TOC key -- is cleaner. A future commit will extend this pattern to other scan node types. Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Tomas Vondra <tomas@vondra.me> Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me
This commit is contained in:
@@ -171,14 +171,9 @@ extern void index_endscan(IndexScanDesc scan);
|
||||
extern void index_markpos(IndexScanDesc scan);
|
||||
extern void index_restrpos(IndexScanDesc scan);
|
||||
extern Size index_parallelscan_estimate(Relation indexRelation,
|
||||
int nkeys, int norderbys, Snapshot snapshot,
|
||||
bool instrument, bool parallel_aware,
|
||||
int nworkers);
|
||||
int nkeys, int norderbys, Snapshot snapshot);
|
||||
extern void index_parallelscan_initialize(Relation heapRelation,
|
||||
Relation indexRelation, Snapshot snapshot,
|
||||
bool instrument, bool parallel_aware,
|
||||
int nworkers,
|
||||
SharedIndexScanInstrumentation **sharedinfo,
|
||||
ParallelIndexScanDesc target);
|
||||
extern void index_parallelrescan(IndexScanDesc scan);
|
||||
extern IndexScanDesc index_beginscan_parallel(Relation heaprel,
|
||||
|
||||
@@ -203,7 +203,6 @@ typedef struct ParallelIndexScanDescData
|
||||
{
|
||||
RelFileLocator ps_locator; /* physical table relation to scan */
|
||||
RelFileLocator ps_indexlocator; /* physical index relation to scan */
|
||||
Size ps_offset_ins; /* Offset to SharedIndexScanInstrumentation */
|
||||
Size ps_offset_am; /* Offset to am-specific structure */
|
||||
char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER];
|
||||
} ParallelIndexScanDescData;
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
#ifndef INSTRUMENT_NODE_H
|
||||
#define INSTRUMENT_NODE_H
|
||||
|
||||
/*
|
||||
* Offset added to plan_node_id to create a second TOC key for per-worker scan
|
||||
* instrumentation. Instrumentation and parallel-awareness are independent, so
|
||||
* separate DSM chunks let each be allocated and initialized only when needed.
|
||||
* In the future, if nodes need more DSM allocations, we would need a more
|
||||
* robust system.
|
||||
*/
|
||||
#define PARALLEL_KEY_SCAN_INSTRUMENT_OFFSET UINT64CONST(0xD000000000000000)
|
||||
|
||||
/* ---------------------
|
||||
* Instrumentation information for aggregate function execution
|
||||
|
||||
@@ -32,6 +32,12 @@ extern void ExecIndexOnlyScanReInitializeDSM(IndexOnlyScanState *node,
|
||||
ParallelContext *pcxt);
|
||||
extern void ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node,
|
||||
ParallelWorkerContext *pwcxt);
|
||||
extern void ExecIndexOnlyScanInstrumentEstimate(IndexOnlyScanState *node,
|
||||
ParallelContext *pcxt);
|
||||
extern void ExecIndexOnlyScanInstrumentInitDSM(IndexOnlyScanState *node,
|
||||
ParallelContext *pcxt);
|
||||
extern void ExecIndexOnlyScanInstrumentInitWorker(IndexOnlyScanState *node,
|
||||
ParallelWorkerContext *pwcxt);
|
||||
extern void ExecIndexOnlyScanRetrieveInstrumentation(IndexOnlyScanState *node);
|
||||
|
||||
#endif /* NODEINDEXONLYSCAN_H */
|
||||
|
||||
@@ -28,6 +28,12 @@ extern void ExecIndexScanInitializeDSM(IndexScanState *node, ParallelContext *pc
|
||||
extern void ExecIndexScanReInitializeDSM(IndexScanState *node, ParallelContext *pcxt);
|
||||
extern void ExecIndexScanInitializeWorker(IndexScanState *node,
|
||||
ParallelWorkerContext *pwcxt);
|
||||
extern void ExecIndexScanInstrumentEstimate(IndexScanState *node,
|
||||
ParallelContext *pcxt);
|
||||
extern void ExecIndexScanInstrumentInitDSM(IndexScanState *node,
|
||||
ParallelContext *pcxt);
|
||||
extern void ExecIndexScanInstrumentInitWorker(IndexScanState *node,
|
||||
ParallelWorkerContext *pwcxt);
|
||||
extern void ExecIndexScanRetrieveInstrumentation(IndexScanState *node);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user