|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/tidstore.h"#include "miscadmin.h"#include "nodes/bitmapset.h"#include "storage/lwlock.h"#include "utils/dsa.h"#include "lib/radixtree.h"
Go to the source code of this file.
Data Structures | |
| struct | BlocktableEntry |
| struct | TidStore |
| struct | TidStoreIter |
Macros | |
| #define | WORDNUM(x) ((x) / BITS_PER_BITMAPWORD) |
| #define | BITNUM(x) ((x) % BITS_PER_BITMAPWORD) |
| #define | WORDS_PER_PAGE(n) ((n) / BITS_PER_BITMAPWORD + 1) |
| #define | NUM_FULL_OFFSETS ((sizeof(uintptr_t) - sizeof(uint8) - sizeof(int8)) / sizeof(OffsetNumber)) |
| #define | MAX_OFFSET_IN_BITMAP Min(BITS_PER_BITMAPWORD * PG_INT8_MAX - 1, MaxOffsetNumber) |
| #define | MaxBlocktableEntrySize |
| #define | RT_PREFIX local_ts |
| #define | RT_SCOPE static |
| #define | RT_DECLARE |
| #define | RT_DEFINE |
| #define | RT_VALUE_TYPE BlocktableEntry |
| #define | RT_VARLEN_VALUE_SIZE(page) |
| #define | RT_RUNTIME_EMBEDDABLE_VALUE |
| #define | RT_PREFIX shared_ts |
| #define | RT_SHMEM |
| #define | RT_SCOPE static |
| #define | RT_DECLARE |
| #define | RT_DEFINE |
| #define | RT_VALUE_TYPE BlocktableEntry |
| #define | RT_VARLEN_VALUE_SIZE(page) |
| #define | RT_RUNTIME_EMBEDDABLE_VALUE |
| #define | TidStoreIsShared(ts) ((ts)->area != NULL) |
Typedefs | |
| typedef struct BlocktableEntry | BlocktableEntry |
Functions | |
| TidStore * | TidStoreCreateLocal (size_t max_bytes, bool insert_only) |
| TidStore * | TidStoreCreateShared (size_t max_bytes, int tranche_id) |
| TidStore * | TidStoreAttach (dsa_handle area_handle, dsa_pointer handle) |
| void | TidStoreDetach (TidStore *ts) |
| void | TidStoreLockExclusive (TidStore *ts) |
| void | TidStoreLockShare (TidStore *ts) |
| void | TidStoreUnlock (TidStore *ts) |
| void | TidStoreDestroy (TidStore *ts) |
| void | TidStoreSetBlockOffsets (TidStore *ts, BlockNumber blkno, OffsetNumber *offsets, int num_offsets) |
| bool | TidStoreIsMember (TidStore *ts, const ItemPointerData *tid) |
| TidStoreIter * | TidStoreBeginIterate (TidStore *ts) |
| TidStoreIterResult * | TidStoreIterateNext (TidStoreIter *iter) |
| void | TidStoreEndIterate (TidStoreIter *iter) |
| size_t | TidStoreMemoryUsage (TidStore *ts) |
| dsa_area * | TidStoreGetDSA (TidStore *ts) |
| dsa_pointer | TidStoreGetHandle (TidStore *ts) |
| int | TidStoreGetBlockOffsets (TidStoreIterResult *result, OffsetNumber *offsets, int max_offsets) |
| #define BITNUM | ( | x | ) | ((x) % BITS_PER_BITMAPWORD) |
Definition at line 32 of file tidstore.c.
| #define MAX_OFFSET_IN_BITMAP Min(BITS_PER_BITMAPWORD * PG_INT8_MAX - 1, MaxOffsetNumber) |
Definition at line 84 of file tidstore.c.
| #define MaxBlocktableEntrySize |
Definition at line 86 of file tidstore.c.
| #define NUM_FULL_OFFSETS ((sizeof(uintptr_t) - sizeof(uint8) - sizeof(int8)) / sizeof(OffsetNumber)) |
Definition at line 38 of file tidstore.c.
| #define RT_DECLARE |
Definition at line 104 of file tidstore.c.
| #define RT_DECLARE |
Definition at line 104 of file tidstore.c.
| #define RT_DEFINE |
Definition at line 105 of file tidstore.c.
| #define RT_DEFINE |
Definition at line 105 of file tidstore.c.
| #define RT_PREFIX local_ts |
Definition at line 101 of file tidstore.c.
| #define RT_PREFIX shared_ts |
Definition at line 101 of file tidstore.c.
| #define RT_RUNTIME_EMBEDDABLE_VALUE |
Definition at line 110 of file tidstore.c.
| #define RT_RUNTIME_EMBEDDABLE_VALUE |
Definition at line 110 of file tidstore.c.
| #define RT_SCOPE static |
Definition at line 103 of file tidstore.c.
| #define RT_SCOPE static |
Definition at line 103 of file tidstore.c.
| #define RT_SHMEM |
Definition at line 102 of file tidstore.c.
| #define RT_VALUE_TYPE BlocktableEntry |
Definition at line 106 of file tidstore.c.
| #define RT_VALUE_TYPE BlocktableEntry |
Definition at line 106 of file tidstore.c.
| #define RT_VARLEN_VALUE_SIZE | ( | page | ) |
Definition at line 107 of file tidstore.c.
| #define RT_VARLEN_VALUE_SIZE | ( | page | ) |
Definition at line 107 of file tidstore.c.
| #define TidStoreIsShared | ( | ts | ) | ((ts)->area != NULL) |
Definition at line 132 of file tidstore.c.
| #define WORDNUM | ( | x | ) | ((x) / BITS_PER_BITMAPWORD) |
Definition at line 31 of file tidstore.c.
| #define WORDS_PER_PAGE | ( | n | ) | ((n) / BITS_PER_BITMAPWORD + 1) |
Definition at line 35 of file tidstore.c.
| typedef struct BlocktableEntry BlocktableEntry |
| TidStore * TidStoreAttach | ( | dsa_handle | area_handle, |
| dsa_pointer | handle | ||
| ) |
Definition at line 244 of file tidstore.c.
References TidStore::area, Assert(), dsa_attach(), DSA_HANDLE_INVALID, DsaPointerIsValid, palloc0(), TidStore::shared, and TidStore::tree.
Referenced by parallel_vacuum_main().
| TidStoreIter * TidStoreBeginIterate | ( | TidStore * | ts | ) |
Definition at line 471 of file tidstore.c.
References TidStore::local, TidStoreIter::local, palloc0(), TidStore::shared, TidStoreIter::shared, TidStoreIsShared, TidStore::tree, TidStoreIter::tree_iter, and TidStoreIter::ts.
Referenced by check_set_block_offsets(), and lazy_vacuum_heap_rel().
| TidStore * TidStoreCreateLocal | ( | size_t | max_bytes, |
| bool | insert_only | ||
| ) |
Definition at line 162 of file tidstore.c.
References ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, ALLOCSET_DEFAULT_MINSIZE, AllocSetContextCreate, BumpContextCreate(), CurrentMemoryContext, TidStore::local, palloc0(), TidStore::rt_context, and TidStore::tree.
Referenced by dead_items_alloc(), dead_items_reset(), and test_create().
| TidStore * TidStoreCreateShared | ( | size_t | max_bytes, |
| int | tranche_id | ||
| ) |
Definition at line 208 of file tidstore.c.
References TidStore::area, dsa_create_ext(), DSA_DEFAULT_INIT_SEGMENT_SIZE, DSA_MAX_SEGMENT_SIZE, DSA_MIN_SEGMENT_SIZE, palloc0(), TidStore::shared, and TidStore::tree.
Referenced by parallel_vacuum_init(), parallel_vacuum_reset_dead_items(), and test_create().
| void TidStoreDestroy | ( | TidStore * | ts | ) |
Definition at line 317 of file tidstore.c.
References TidStore::area, dsa_detach(), TidStore::local, MemoryContextDelete(), pfree(), TidStore::rt_context, TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by dead_items_reset(), parallel_vacuum_end(), parallel_vacuum_reset_dead_items(), and test_destroy().
| void TidStoreDetach | ( | TidStore * | ts | ) |
Definition at line 269 of file tidstore.c.
References TidStore::area, Assert(), dsa_detach(), pfree(), TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by parallel_vacuum_main().
| void TidStoreEndIterate | ( | TidStoreIter * | iter | ) |
Definition at line 518 of file tidstore.c.
References TidStoreIter::local, pfree(), TidStoreIter::shared, TidStoreIsShared, TidStoreIter::tree_iter, and TidStoreIter::ts.
Referenced by check_set_block_offsets(), and lazy_vacuum_heap_rel().
| int TidStoreGetBlockOffsets | ( | TidStoreIterResult * | result, |
| OffsetNumber * | offsets, | ||
| int | max_offsets | ||
| ) |
Definition at line 566 of file tidstore.c.
References BITS_PER_BITMAPWORD, BlocktableEntry::full_offsets, BlocktableEntry::header, i, TidStoreIterResult::internal_page, InvalidOffsetNumber, NUM_FULL_OFFSETS, BlocktableEntry::nwords, and BlocktableEntry::words.
Referenced by check_set_block_offsets(), and lazy_vacuum_heap_rel().
Definition at line 544 of file tidstore.c.
References TidStore::area, Assert(), and TidStoreIsShared.
Referenced by parallel_vacuum_init(), parallel_vacuum_reset_dead_items(), and test_create().
| dsa_pointer TidStoreGetHandle | ( | TidStore * | ts | ) |
Definition at line 552 of file tidstore.c.
References Assert(), TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by parallel_vacuum_init(), and parallel_vacuum_reset_dead_items().
| bool TidStoreIsMember | ( | TidStore * | ts, |
| const ItemPointerData * | tid | ||
| ) |
Definition at line 421 of file tidstore.c.
References BITNUM, BlocktableEntry::full_offsets, BlocktableEntry::header, i, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), TidStore::local, NUM_FULL_OFFSETS, BlocktableEntry::nwords, TidStore::shared, TidStoreIsShared, TidStore::tree, WORDNUM, and BlocktableEntry::words.
Referenced by check_set_block_offsets(), and vac_tid_reaped().
| TidStoreIterResult * TidStoreIterateNext | ( | TidStoreIter * | iter | ) |
Definition at line 493 of file tidstore.c.
References TidStoreIterResult::blkno, TidStoreIterResult::internal_page, sort-test::key, TidStoreIter::local, TidStoreIter::output, TidStoreIter::shared, TidStoreIsShared, TidStoreIter::tree_iter, and TidStoreIter::ts.
Referenced by check_set_block_offsets(), and vacuum_reap_lp_read_stream_next().
| void TidStoreLockExclusive | ( | TidStore * | ts | ) |
Definition at line 287 of file tidstore.c.
References TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by do_set_block_offsets().
| void TidStoreLockShare | ( | TidStore * | ts | ) |
Definition at line 294 of file tidstore.c.
References TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by check_set_block_offsets().
| size_t TidStoreMemoryUsage | ( | TidStore * | ts | ) |
Definition at line 532 of file tidstore.c.
References TidStore::local, TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by dead_items_add(), lazy_scan_heap(), lazy_vacuum(), test_create(), and test_is_full().
| void TidStoreSetBlockOffsets | ( | TidStore * | ts, |
| BlockNumber | blkno, | ||
| OffsetNumber * | offsets, | ||
| int | num_offsets | ||
| ) |
Definition at line 345 of file tidstore.c.
References Assert(), BITNUM, BITS_PER_BITMAPWORD, data, elog, ERROR, BlocktableEntry::full_offsets, BlocktableEntry::header, i, idx(), InvalidOffsetNumber, TidStore::local, MAX_OFFSET_IN_BITMAP, MaxBlocktableEntrySize, NUM_FULL_OFFSETS, BlocktableEntry::nwords, TidStore::shared, TidStoreIsShared, TidStore::tree, word(), WORDNUM, BlocktableEntry::words, and WORDS_PER_PAGE.
Referenced by dead_items_add(), and do_set_block_offsets().
| void TidStoreUnlock | ( | TidStore * | ts | ) |
Definition at line 301 of file tidstore.c.
References TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by check_set_block_offsets(), and do_set_block_offsets().