PostgreSQL Source Code
git master
|
#include "storage/sharedfileset.h"
Go to the source code of this file.
Data Structures | |
struct | TapeShare |
Typedefs | |
typedef struct LogicalTapeSet | LogicalTapeSet |
typedef struct LogicalTape | LogicalTape |
typedef struct TapeShare | TapeShare |
Functions | |
LogicalTapeSet * | LogicalTapeSetCreate (bool preallocate, SharedFileSet *fileset, int worker) |
void | LogicalTapeClose (LogicalTape *lt) |
void | LogicalTapeSetClose (LogicalTapeSet *lts) |
LogicalTape * | LogicalTapeCreate (LogicalTapeSet *lts) |
LogicalTape * | LogicalTapeImport (LogicalTapeSet *lts, int worker, TapeShare *shared) |
void | LogicalTapeSetForgetFreeSpace (LogicalTapeSet *lts) |
size_t | LogicalTapeRead (LogicalTape *lt, void *ptr, size_t size) |
void | LogicalTapeWrite (LogicalTape *lt, const void *ptr, size_t size) |
void | LogicalTapeRewindForRead (LogicalTape *lt, size_t buffer_size) |
void | LogicalTapeFreeze (LogicalTape *lt, TapeShare *share) |
size_t | LogicalTapeBackspace (LogicalTape *lt, size_t size) |
void | LogicalTapeSeek (LogicalTape *lt, int64 blocknum, int offset) |
void | LogicalTapeTell (LogicalTape *lt, int64 *blocknum, int *offset) |
int64 | LogicalTapeSetBlocks (LogicalTapeSet *lts) |
typedef struct LogicalTape LogicalTape |
typedef struct LogicalTapeSet LogicalTapeSet |
size_t LogicalTapeBackspace | ( | LogicalTape * | lt, |
size_t | size | ||
) |
Definition at line 1062 of file logtape.c.
References Assert, LogicalTape::buffer, LogicalTape::buffer_size, LogicalTape::curBlockNumber, elog, ERROR, LogicalTape::firstBlockNumber, LogicalTape::frozen, ltsInitReadBuffer(), ltsReadBlock(), LogicalTape::nbytes, LogicalTape::nextBlockNumber, LogicalTape::pos, size, TapeBlockGetTrailer, TapeBlockPayloadSize, LogicalTape::tapeSet, and while().
Referenced by tuplesort_gettuple_common().
void LogicalTapeClose | ( | LogicalTape * | lt | ) |
Definition at line 733 of file logtape.c.
References LogicalTape::buffer, and pfree().
Referenced by agg_refill_hash_table(), mergeruns(), and tuplesort_gettuple_common().
LogicalTape* LogicalTapeCreate | ( | LogicalTapeSet * | lts | ) |
Definition at line 680 of file logtape.c.
References elog, ERROR, LogicalTapeSet::fileset, ltsCreateTape(), and LogicalTapeSet::worker.
Referenced by hashagg_spill_init(), and selectnewtape().
void LogicalTapeFreeze | ( | LogicalTape * | lt, |
TapeShare * | share | ||
) |
Definition at line 981 of file logtape.c.
References Assert, LogicalTape::buffer, LogicalTape::buffer_size, BufFileExportFileSet(), LogicalTape::curBlockNumber, LogicalTape::dirty, LogicalTape::firstBlockNumber, TapeShare::firstblocknumber, LogicalTape::frozen, ltsReadBlock(), ltsWriteBlock(), LogicalTape::nbytes, LogicalTape::nextBlockNumber, LogicalTape::offsetBlockNumber, palloc(), LogicalTapeSet::pfile, pfree(), LogicalTape::pos, TapeBlockGetNBytes, TapeBlockGetTrailer, TapeBlockIsLast, TapeBlockSetNBytes, LogicalTape::tapeSet, VALGRIND_MAKE_MEM_DEFINED, and LogicalTape::writing.
Referenced by mergeruns(), and worker_freeze_result_tape().
LogicalTape* LogicalTapeImport | ( | LogicalTapeSet * | lts, |
int | worker, | ||
TapeShare * | shared | ||
) |
Definition at line 609 of file logtape.c.
References BufFileAppend(), BufFileOpenFileSet(), BufFileSize(), filename, LogicalTapeSet::fileset, LogicalTape::firstBlockNumber, TapeShare::firstblocknumber, SharedFileSet::fs, ltsCreateTape(), LogicalTape::max_size, MaxAllocSize, MAXPGPATH, Min, LogicalTapeSet::nBlocksAllocated, LogicalTapeSet::nBlocksWritten, LogicalTapeSet::nHoleBlocks, LogicalTape::offsetBlockNumber, LogicalTapeSet::pfile, and pg_itoa().
Referenced by leader_takeover_tapes().
size_t LogicalTapeRead | ( | LogicalTape * | lt, |
void * | ptr, | ||
size_t | size | ||
) |
Definition at line 928 of file logtape.c.
References Assert, LogicalTape::buffer, ltsInitReadBuffer(), ltsReadFillBuffer(), LogicalTape::nbytes, LogicalTape::pos, size, and LogicalTape::writing.
Referenced by getlen(), and hashagg_batch_read().
void LogicalTapeRewindForRead | ( | LogicalTape * | lt, |
size_t | buffer_size | ||
) |
Definition at line 846 of file logtape.c.
References Assert, LogicalTape::buffer, LogicalTape::buffer_size, LogicalTape::curBlockNumber, LogicalTape::dirty, LogicalTape::frozen, i, ltsReleaseBlock(), ltsWriteBlock(), LogicalTape::max_size, LogicalTape::nbytes, LogicalTape::nprealloc, pfree(), LogicalTape::prealloc, LogicalTape::prealloc_size, TapeBlockSetNBytes, LogicalTape::tapeSet, VALGRIND_MAKE_MEM_DEFINED, and LogicalTape::writing.
Referenced by hashagg_spill_finish(), mergeruns(), and tuplesort_rescan().
void LogicalTapeSeek | ( | LogicalTape * | lt, |
int64 | blocknum, | ||
int | offset | ||
) |
Definition at line 1133 of file logtape.c.
References Assert, LogicalTape::buffer, LogicalTape::buffer_size, LogicalTape::curBlockNumber, elog, ERROR, LogicalTape::frozen, ltsInitReadBuffer(), ltsReadBlock(), LogicalTape::nbytes, LogicalTape::nextBlockNumber, LogicalTape::pos, TapeBlockGetTrailer, TapeBlockPayloadSize, and LogicalTape::tapeSet.
Referenced by tuplesort_restorepos().
int64 LogicalTapeSetBlocks | ( | LogicalTapeSet * | lts | ) |
Definition at line 1181 of file logtape.c.
References LogicalTapeSet::nBlocksWritten, and LogicalTapeSet::nHoleBlocks.
Referenced by hash_agg_update_metrics(), tuplesort_free(), and tuplesort_updatemax().
void LogicalTapeSetClose | ( | LogicalTapeSet * | lts | ) |
Definition at line 667 of file logtape.c.
References BufFileClose(), LogicalTapeSet::freeBlocks, LogicalTapeSet::pfile, and pfree().
Referenced by hashagg_reset_spill_state(), and tuplesort_free().
LogicalTapeSet* LogicalTapeSetCreate | ( | bool | preallocate, |
SharedFileSet * | fileset, | ||
int | worker | ||
) |
Definition at line 556 of file logtape.c.
References BufFileCreateFileSet(), BufFileCreateTemp(), LogicalTapeSet::enable_prealloc, filename, LogicalTapeSet::fileset, LogicalTapeSet::forgetFreeSpace, LogicalTapeSet::freeBlocks, LogicalTapeSet::freeBlocksLen, SharedFileSet::fs, MAXPGPATH, LogicalTapeSet::nBlocksAllocated, LogicalTapeSet::nBlocksWritten, LogicalTapeSet::nFreeBlocks, LogicalTapeSet::nHoleBlocks, palloc(), LogicalTapeSet::pfile, pg_itoa(), and LogicalTapeSet::worker.
Referenced by hash_agg_enter_spill_mode(), inittapes(), and leader_takeover_tapes().
void LogicalTapeSetForgetFreeSpace | ( | LogicalTapeSet * | lts | ) |
Definition at line 750 of file logtape.c.
References LogicalTapeSet::forgetFreeSpace.
Referenced by mergeruns().
void LogicalTapeTell | ( | LogicalTape * | lt, |
int64 * | blocknum, | ||
int * | offset | ||
) |
Definition at line 1162 of file logtape.c.
References Assert, LogicalTape::buffer, LogicalTape::buffer_size, LogicalTape::curBlockNumber, ltsInitReadBuffer(), LogicalTape::offsetBlockNumber, and LogicalTape::pos.
Referenced by tuplesort_markpos().
void LogicalTapeWrite | ( | LogicalTape * | lt, |
const void * | ptr, | ||
size_t | size | ||
) |
Definition at line 761 of file logtape.c.
References Assert, LogicalTape::buffer, LogicalTape::buffer_size, LogicalTape::curBlockNumber, LogicalTape::dirty, elog, ERROR, LogicalTape::firstBlockNumber, ltsGetBlock(), ltsWriteBlock(), LogicalTape::nbytes, LogicalTape::offsetBlockNumber, palloc(), LogicalTape::pos, size, TapeBlockGetTrailer, TapeBlockPayloadSize, LogicalTape::tapeSet, and LogicalTape::writing.
Referenced by hashagg_spill_tuple(), markrunend(), writetup_cluster(), writetup_datum(), writetup_heap(), writetup_index(), and writetup_index_brin().