PostgreSQL Source Code git master
|
#include "postgres.h"
#include "access/htup.h"
#include "access/htup_details.h"
#include "storage/buffile.h"
#include "storage/lwlock.h"
#include "storage/sharedfileset.h"
#include "utils/sharedtuplestore.h"
Go to the source code of this file.
Data Structures | |
struct | SharedTuplestoreChunk |
struct | SharedTuplestoreParticipant |
struct | SharedTuplestore |
struct | SharedTuplestoreAccessor |
Macros | |
#define | STS_CHUNK_PAGES 4 |
#define | STS_CHUNK_HEADER_SIZE offsetof(SharedTuplestoreChunk, data) |
#define | STS_CHUNK_DATA_SIZE (STS_CHUNK_PAGES * BLCKSZ - STS_CHUNK_HEADER_SIZE) |
Typedefs | |
typedef struct SharedTuplestoreChunk | SharedTuplestoreChunk |
typedef struct SharedTuplestoreParticipant | SharedTuplestoreParticipant |
#define STS_CHUNK_DATA_SIZE (STS_CHUNK_PAGES * BLCKSZ - STS_CHUNK_HEADER_SIZE) |
Definition at line 39 of file sharedtuplestore.c.
#define STS_CHUNK_HEADER_SIZE offsetof(SharedTuplestoreChunk, data) |
Definition at line 38 of file sharedtuplestore.c.
#define STS_CHUNK_PAGES 4 |
Definition at line 37 of file sharedtuplestore.c.
typedef struct SharedTuplestoreChunk SharedTuplestoreChunk |
typedef struct SharedTuplestoreParticipant SharedTuplestoreParticipant |
SharedTuplestoreAccessor * sts_attach | ( | SharedTuplestore * | sts, |
int | my_participant_number, | ||
SharedFileSet * | fileset | ||
) |
Definition at line 178 of file sharedtuplestore.c.
References Assert, SharedTuplestoreAccessor::context, CurrentMemoryContext, SharedTuplestoreAccessor::fileset, palloc0(), SharedTuplestoreAccessor::participant, and SharedTuplestoreAccessor::sts.
Referenced by ExecParallelHashEnsureBatchAccessors(), and ExecParallelHashRepartitionRest().
void sts_begin_parallel_scan | ( | SharedTuplestoreAccessor * | accessor | ) |
Definition at line 253 of file sharedtuplestore.c.
References Assert, i, SharedTuplestore::nparticipants, SharedTuplestoreAccessor::participant, SharedTuplestore::participants, PG_USED_FOR_ASSERTS_ONLY, SharedTuplestoreAccessor::read_file, SharedTuplestoreAccessor::read_next_page, SharedTuplestoreAccessor::read_participant, SharedTuplestoreAccessor::sts, sts_end_parallel_scan(), and SharedTuplestoreParticipant::writing.
Referenced by ExecParallelHashJoinNewBatch(), and ExecParallelHashRepartitionRest().
void sts_end_parallel_scan | ( | SharedTuplestoreAccessor * | accessor | ) |
Definition at line 281 of file sharedtuplestore.c.
References BufFileClose(), and SharedTuplestoreAccessor::read_file.
Referenced by ExecHashTableDetach(), ExecHashTableDetachBatch(), ExecParallelHashCloseBatchAccessors(), ExecParallelHashJoinNewBatch(), ExecParallelHashRepartitionRest(), ExecParallelPrepHashTableForUnmatched(), and sts_begin_parallel_scan().
void sts_end_write | ( | SharedTuplestoreAccessor * | accessor | ) |
Definition at line 213 of file sharedtuplestore.c.
References BufFileClose(), SharedTuplestoreAccessor::participant, SharedTuplestore::participants, pfree(), SharedTuplestoreAccessor::sts, sts_flush_chunk(), SharedTuplestoreAccessor::write_chunk, SharedTuplestoreAccessor::write_file, and SharedTuplestoreParticipant::writing.
Referenced by ExecHashTableDetach(), ExecParallelHashCloseBatchAccessors(), ExecParallelHashJoinPartitionOuter(), and MultiExecParallelHash().
size_t sts_estimate | ( | int | participants | ) |
Definition at line 104 of file sharedtuplestore.c.
|
static |
Definition at line 598 of file sharedtuplestore.c.
References MAXPGPATH, name, SharedTuplestore::name, snprintf, and SharedTuplestoreAccessor::sts.
Referenced by sts_parallel_scan_next(), and sts_puttuple().
|
static |
Definition at line 196 of file sharedtuplestore.c.
References BufFileWrite(), SharedTuplestoreChunk::data, SharedTuplestoreParticipant::npages, SharedTuplestoreAccessor::participant, SharedTuplestore::participants, size, SharedTuplestoreAccessor::sts, STS_CHUNK_PAGES, SharedTuplestoreAccessor::write_chunk, SharedTuplestoreAccessor::write_file, and SharedTuplestoreAccessor::write_pointer.
Referenced by sts_end_write(), and sts_puttuple().
SharedTuplestoreAccessor * sts_initialize | ( | SharedTuplestore * | sts, |
int | participants, | ||
int | my_participant_number, | ||
size_t | meta_data_size, | ||
int | flags, | ||
SharedFileSet * | fileset, | ||
const char * | name | ||
) |
Definition at line 126 of file sharedtuplestore.c.
References Assert, SharedTuplestoreAccessor::context, CurrentMemoryContext, elog, ERROR, SharedTuplestoreAccessor::fileset, SharedTuplestore::flags, i, SharedTuplestoreParticipant::lock, LWLockInitialize(), LWTRANCHE_SHARED_TUPLESTORE, SharedTuplestore::meta_data_size, name, SharedTuplestore::name, SharedTuplestoreParticipant::npages, SharedTuplestore::nparticipants, palloc0(), SharedTuplestoreAccessor::participant, SharedTuplestore::participants, SharedTuplestoreParticipant::read_page, SharedTuplestoreAccessor::sts, STS_CHUNK_DATA_SIZE, and SharedTuplestoreParticipant::writing.
Referenced by ExecParallelHashJoinSetUpBatches().
MinimalTuple sts_parallel_scan_next | ( | SharedTuplestoreAccessor * | accessor, |
void * | meta_data | ||
) |
Definition at line 495 of file sharedtuplestore.c.
References BufFileClose(), BufFileOpenFileSet(), BufFileReadExact(), BufFileSeekBlock(), SharedTuplestoreAccessor::context, ereport, errcode_for_file_access(), errmsg(), ERROR, SharedTuplestoreAccessor::fileset, SharedFileSet::fs, if(), SharedTuplestoreParticipant::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAXPGPATH, MemoryContextSwitchTo(), name, SharedTuplestoreParticipant::npages, SharedTuplestore::nparticipants, SharedTuplestoreChunk::ntuples, SharedTuplestoreChunk::overflow, SharedTuplestoreAccessor::participant, SharedTuplestore::participants, SharedTuplestoreAccessor::read_bytes, SharedTuplestoreAccessor::read_file, SharedTuplestoreAccessor::read_next_page, SharedTuplestoreAccessor::read_ntuples, SharedTuplestoreAccessor::read_ntuples_available, SharedTuplestoreParticipant::read_page, SharedTuplestoreAccessor::read_participant, SharedTuplestoreAccessor::sts, STS_CHUNK_HEADER_SIZE, STS_CHUNK_PAGES, sts_filename(), and sts_read_tuple().
Referenced by ExecParallelHashJoinNewBatch(), ExecParallelHashJoinOuterGetTuple(), and ExecParallelHashRepartitionRest().
void sts_puttuple | ( | SharedTuplestoreAccessor * | accessor, |
void * | meta_data, | ||
MinimalTuple | tuple | ||
) |
Definition at line 300 of file sharedtuplestore.c.
References Assert, BufFileCreateFileSet(), SharedTuplestoreAccessor::context, SharedTuplestoreChunk::data, SharedTuplestoreAccessor::fileset, SharedFileSet::fs, MAXPGPATH, MemoryContextAllocZero(), MemoryContextSwitchTo(), SharedTuplestore::meta_data_size, Min, name, SharedTuplestoreChunk::ntuples, SharedTuplestoreChunk::overflow, SharedTuplestoreAccessor::participant, SharedTuplestore::participants, size, SharedTuplestoreAccessor::sts, STS_CHUNK_DATA_SIZE, STS_CHUNK_PAGES, sts_filename(), sts_flush_chunk(), MinimalTupleData::t_len, SharedTuplestoreAccessor::write_chunk, SharedTuplestoreAccessor::write_end, SharedTuplestoreAccessor::write_file, SharedTuplestoreAccessor::write_pointer, and SharedTuplestoreParticipant::writing.
Referenced by ExecParallelHashJoinPartitionOuter(), ExecParallelHashRepartitionFirst(), ExecParallelHashRepartitionRest(), and ExecParallelHashTableInsert().
|
static |
Definition at line 415 of file sharedtuplestore.c.
References BufFileReadExact(), SharedTuplestoreAccessor::context, ereport, errcode_for_file_access(), errdetail_internal(), errmsg(), ERROR, Max, MemoryContextAlloc(), SharedTuplestore::meta_data_size, Min, SharedTuplestoreChunk::ntuples, SharedTuplestoreChunk::overflow, pfree(), SharedTuplestoreAccessor::read_buffer, SharedTuplestoreAccessor::read_buffer_size, SharedTuplestoreAccessor::read_bytes, SharedTuplestoreAccessor::read_file, SharedTuplestoreAccessor::read_next_page, SharedTuplestoreAccessor::read_ntuples, SharedTuplestoreAccessor::read_ntuples_available, size, SharedTuplestoreAccessor::sts, STS_CHUNK_HEADER_SIZE, STS_CHUNK_PAGES, and MinimalTupleData::t_len.
Referenced by sts_parallel_scan_next().
void sts_reinitialize | ( | SharedTuplestoreAccessor * | accessor | ) |
Definition at line 234 of file sharedtuplestore.c.
References i, SharedTuplestore::nparticipants, SharedTuplestore::participants, SharedTuplestoreParticipant::read_page, and SharedTuplestoreAccessor::sts.