|
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 92 of file tidstore.c.
| #define RT_DECLARE |
Definition at line 92 of file tidstore.c.
| #define RT_DEFINE |
Definition at line 93 of file tidstore.c.
| #define RT_DEFINE |
Definition at line 93 of file tidstore.c.
Definition at line 90 of file tidstore.c.
Definition at line 90 of file tidstore.c.
| #define RT_RUNTIME_EMBEDDABLE_VALUE |
Definition at line 98 of file tidstore.c.
| #define RT_RUNTIME_EMBEDDABLE_VALUE |
Definition at line 98 of file tidstore.c.
Definition at line 91 of file tidstore.c.
Definition at line 91 of file tidstore.c.
| #define RT_SHMEM |
Definition at line 102 of file tidstore.c.
| #define RT_VALUE_TYPE BlocktableEntry |
Definition at line 94 of file tidstore.c.
| #define RT_VALUE_TYPE BlocktableEntry |
Definition at line 94 of file tidstore.c.
| #define RT_VARLEN_VALUE_SIZE | ( | page | ) |
Definition at line 95 of file tidstore.c.
| #define RT_VARLEN_VALUE_SIZE | ( | page | ) |
Definition at line 95 of file tidstore.c.
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.
| 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, fb(), palloc0_object, TidStore::shared, and TidStore::tree.
Referenced by parallel_vacuum_main().
| TidStoreIter * TidStoreBeginIterate | ( | TidStore * | ts | ) |
Definition at line 471 of file tidstore.c.
References fb(), TidStore::local, TidStoreIter::local, palloc0_object, TidStore::shared, TidStoreIter::shared, TidStoreIsShared, TidStore::tree, TidStoreIter::tree_iter, and TidStoreIter::ts.
Referenced by check_set_block_offsets(), and lazy_vacuum_heap_rel().
Definition at line 162 of file tidstore.c.
References ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, ALLOCSET_DEFAULT_MINSIZE, AllocSetContextCreate, BumpContextCreate(), CurrentMemoryContext, fb(), TidStore::local, palloc0_object, TidStore::rt_context, and TidStore::tree.
Referenced by dead_items_alloc(), dead_items_reset(), and test_create().
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, fb(), palloc0_object, TidStore::shared, and TidStore::tree.
Referenced by parallel_vacuum_init(), parallel_vacuum_reset_dead_items(), and test_create().
Definition at line 317 of file tidstore.c.
References TidStore::area, dsa_detach(), fb(), 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().
Definition at line 269 of file tidstore.c.
References TidStore::area, Assert, dsa_detach(), fb(), 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 fb(), 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, fb(), 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, fb(), 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, fb(), 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, fb(), TidStoreIterResult::internal_page, 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().
Definition at line 287 of file tidstore.c.
References fb(), TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by do_set_block_offsets().
Definition at line 294 of file tidstore.c.
References fb(), TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by check_set_block_offsets().
Definition at line 532 of file tidstore.c.
References fb(), TidStore::local, TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by dead_items_add(), dead_items_reset(), heap_vacuum_rel(), 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, fb(), 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().
Definition at line 301 of file tidstore.c.
References fb(), TidStore::shared, TidStoreIsShared, and TidStore::tree.
Referenced by check_set_block_offsets(), and do_set_block_offsets().