PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "lib/stringinfo.h"
#include "miscadmin.h"
#include "utils/freepage.h"
#include "utils/relptr.h"
Go to the source code of this file.
Data Structures | |
struct | FreePageSpanLeader |
struct | FreePageBtreeHeader |
struct | FreePageBtreeInternalKey |
struct | FreePageBtreeLeafKey |
struct | FreePageBtree |
struct | FreePageBtreeSearchResult |
Macros | |
#define | FREE_PAGE_SPAN_LEADER_MAGIC 0xea4020f0 |
#define | FREE_PAGE_LEAF_MAGIC 0x98eae728 |
#define | FREE_PAGE_INTERNAL_MAGIC 0x19aa32c9 |
#define | FPM_ITEMS_PER_INTERNAL_PAGE |
#define | FPM_ITEMS_PER_LEAF_PAGE |
Typedefs | |
typedef struct FreePageBtreeHeader | FreePageBtreeHeader |
typedef struct FreePageBtreeInternalKey | FreePageBtreeInternalKey |
typedef struct FreePageBtreeLeafKey | FreePageBtreeLeafKey |
typedef struct FreePageBtreeSearchResult | FreePageBtreeSearchResult |
#define FPM_ITEMS_PER_INTERNAL_PAGE |
Definition at line 100 of file freepage.c.
#define FPM_ITEMS_PER_LEAF_PAGE |
Definition at line 103 of file freepage.c.
#define FREE_PAGE_INTERNAL_MAGIC 0x19aa32c9 |
Definition at line 65 of file freepage.c.
#define FREE_PAGE_LEAF_MAGIC 0x98eae728 |
Definition at line 64 of file freepage.c.
#define FREE_PAGE_SPAN_LEADER_MAGIC 0xea4020f0 |
Definition at line 63 of file freepage.c.
typedef struct FreePageBtreeHeader FreePageBtreeHeader |
typedef struct FreePageBtreeInternalKey FreePageBtreeInternalKey |
typedef struct FreePageBtreeLeafKey FreePageBtreeLeafKey |
typedef struct FreePageBtreeSearchResult FreePageBtreeSearchResult |
|
static |
Definition at line 501 of file freepage.c.
References Assert, FreePageBtreeInternalKey::child, FreePageBtreeInternalKey::first_page, FreePageBtreeLeafKey::first_page, FPM_ITEMS_PER_INTERNAL_PAGE, FPM_ITEMS_PER_LEAF_PAGE, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FREE_PAGE_LEAF_MAGIC, FreePageBtreeSearchInternal(), FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_access, and FreePageBtree::u.
Referenced by FreePageBtreeRemove(), FreePageBtreeRemovePage(), FreePageManagerGetInternal(), and FreePageManagerPutInternal().
|
static |
Definition at line 580 of file freepage.c.
References Assert, FreePageManager::btree_depth, FreePageManager::btree_recycle_count, FreePageManager::btree_root, fpm_pointer_to_page, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FREE_PAGE_LEAF_MAGIC, FreePageBtreeGetRecycled(), FreePageBtreeRecycle(), FreePageManagerPutInternal(), FreePagePopSpanLeader(), FreePagePushSpanLeader(), FreePageBtree::hdr, FreePageBtreeHeader::parent, relptr_access, relptr_copy, relptr_is_null, relptr_store, root, FreePageManager::singleton_first_page, and FreePageManager::singleton_npages.
Referenced by FreePageManagerGet(), and FreePageManagerPut().
|
static |
Definition at line 695 of file freepage.c.
References Assert, FPM_ITEMS_PER_INTERNAL_PAGE, FPM_ITEMS_PER_LEAF_PAGE, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FREE_PAGE_LEAF_MAGIC, FreePageBtreeFindLeftSibling(), FreePageBtreeFindRightSibling(), FreePageBtreeRemovePage(), FreePageBtreeUpdateParentPointers(), FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, and FreePageBtree::u.
Referenced by FreePageBtreeRemove(), and FreePageBtreeRemovePage().
|
static |
Definition at line 774 of file freepage.c.
References Assert, FreePageBtreeInternalKey::child, FreePageBtreeInternalKey::first_page, FREE_PAGE_INTERNAL_MAGIC, FreePageBtreeFirstKey(), FreePageBtreeSearchInternal(), FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_access, and FreePageBtree::u.
Referenced by FreePageBtreeConsolidate().
|
static |
Definition at line 819 of file freepage.c.
References Assert, FreePageBtreeInternalKey::child, FreePageBtreeInternalKey::first_page, FREE_PAGE_INTERNAL_MAGIC, FreePageBtreeFirstKey(), FreePageBtreeSearchInternal(), FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_access, and FreePageBtree::u.
Referenced by FreePageBtreeConsolidate(), and FreePageManagerPutInternal().
|
static |
Definition at line 863 of file freepage.c.
References Assert, FreePageBtreeInternalKey::first_page, FreePageBtreeLeafKey::first_page, FREE_PAGE_INTERNAL_MAGIC, FREE_PAGE_LEAF_MAGIC, FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, and FreePageBtree::u.
Referenced by FreePageBtreeFindLeftSibling(), FreePageBtreeFindRightSibling(), FreePageBtreeRemovePage(), and FreePageManagerPutInternal().
|
static |
Definition at line 880 of file freepage.c.
References Assert, FreePageManager::btree_recycle, FreePageManager::btree_recycle_count, fpm_pointer_is_page_aligned, fpm_segment_base, FreePageSpanLeader::next, FreePageSpanLeader::prev, relptr_access, relptr_copy, and relptr_store.
Referenced by FreePageBtreeCleanup(), FreePageBtreeSplitPage(), and FreePageManagerPutInternal().
|
static |
Definition at line 900 of file freepage.c.
References Assert, FreePageBtreeInternalKey::child, FreePageBtreeInternalKey::first_page, FPM_ITEMS_PER_INTERNAL_PAGE, FREE_PAGE_INTERNAL_MAGIC, FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, relptr_store, and FreePageBtree::u.
Referenced by FreePageManagerPutInternal().
|
static |
Definition at line 917 of file freepage.c.
References Assert, FreePageBtreeLeafKey::first_page, FPM_ITEMS_PER_LEAF_PAGE, FREE_PAGE_LEAF_MAGIC, FreePageBtree::hdr, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeLeafKey::npages, FreePageBtreeHeader::nused, and FreePageBtree::u.
Referenced by FreePageManagerPutInternal().
|
static |
Definition at line 934 of file freepage.c.
References FreePageManager::btree_recycle, FreePageManager::btree_recycle_count, fpm_page_to_pointer, fpm_segment_base, FREE_PAGE_SPAN_LEADER_MAGIC, FreePageSpanLeader::magic, FreePageSpanLeader::next, FreePageSpanLeader::npages, FreePageSpanLeader::prev, relptr_access, and relptr_store.
Referenced by FreePageBtreeCleanup(), FreePageBtreeRemovePage(), and FreePageManagerPutInternal().
|
static |
Definition at line 955 of file freepage.c.
References Assert, FREE_PAGE_LEAF_MAGIC, FreePageBtreeAdjustAncestorKeys(), FreePageBtreeConsolidate(), FreePageBtreeRemovePage(), FreePageBtree::hdr, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, and FreePageBtree::u.
Referenced by FreePageManagerGetInternal(), and FreePageManagerPutInternal().
|
static |
Definition at line 987 of file freepage.c.
References Assert, FreePageManager::btree_depth, FreePageManager::btree_root, fpm_pointer_to_page, fpm_segment_base, FREE_PAGE_LEAF_MAGIC, FreePageBtreeAdjustAncestorKeys(), FreePageBtreeConsolidate(), FreePageBtreeFirstKey(), FreePageBtreeRecycle(), FreePageBtreeSearchInternal(), FreePageBtreeSearchLeaf(), FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_access, relptr_store, FreePageManager::singleton_first_page, FreePageManager::singleton_npages, and FreePageBtree::u.
Referenced by FreePageBtreeConsolidate(), and FreePageBtreeRemove().
|
static |
Definition at line 1064 of file freepage.c.
References Assert, FreePageManager::btree_root, FreePageBtreeInternalKey::child, FreePageBtreeInternalKey::first_page, FreePageBtreeLeafKey::first_page, FreePageBtreeSearchResult::found, FPM_ITEMS_PER_INTERNAL_PAGE, FPM_ITEMS_PER_LEAF_PAGE, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FreePageBtreeSearchInternal(), FreePageBtreeSearchLeaf(), FreePageBtree::hdr, FreePageBtreeSearchResult::index, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeSearchResult::page, FreePageBtreeHeader::parent, relptr_access, FreePageBtreeSearchResult::split_pages, and FreePageBtree::u.
Referenced by FreePageManagerGetInternal(), and FreePageManagerPutInternal().
|
static |
Definition at line 1140 of file freepage.c.
References Assert, FreePageBtreeInternalKey::first_page, FPM_ITEMS_PER_INTERNAL_PAGE, FREE_PAGE_INTERNAL_MAGIC, FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtree::u, and val.
Referenced by FreePageBtreeAdjustAncestorKeys(), FreePageBtreeFindLeftSibling(), FreePageBtreeFindRightSibling(), FreePageBtreeRemovePage(), FreePageBtreeSearch(), and FreePageManagerPutInternal().
|
static |
Definition at line 1170 of file freepage.c.
References Assert, FreePageBtreeLeafKey::first_page, FPM_ITEMS_PER_LEAF_PAGE, FREE_PAGE_LEAF_MAGIC, FreePageBtree::hdr, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtree::u, and val.
Referenced by FreePageBtreeRemovePage(), FreePageBtreeSearch(), and FreePageManagerPutInternal().
|
static |
Definition at line 1201 of file freepage.c.
References Assert, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FREE_PAGE_LEAF_MAGIC, FreePageBtreeGetRecycled(), FreePageBtreeUpdateParentPointers(), FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_copy, and FreePageBtree::u.
Referenced by FreePageManagerPutInternal().
|
static |
Definition at line 1232 of file freepage.c.
References Assert, FreePageBtreeInternalKey::child, FREE_PAGE_INTERNAL_MAGIC, FreePageBtree::hdr, i, FreePageBtree::internal_key, FreePageBtreeHeader::magic, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_access, relptr_store, and FreePageBtree::u.
Referenced by FreePageBtreeConsolidate(), and FreePageBtreeSplitPage().
char* FreePageManagerDump | ( | FreePageManager * | fpm | ) |
Definition at line 424 of file freepage.c.
References appendStringInfo(), appendStringInfoString(), FreePageManager::btree_depth, FreePageManager::btree_recycle, FreePageManager::btree_root, buf, FreePageManager::contiguous_pages, FPM_NUM_FREELISTS, fpm_segment_base, FreePageManager::freelist, FreePageManagerDumpBtree(), FreePageManagerDumpSpans(), initStringInfo(), relptr_access, relptr_is_null, relptr_offset, root, FreePageManager::self, FreePageManager::singleton_first_page, and FreePageManager::singleton_npages.
|
static |
Definition at line 1250 of file freepage.c.
References appendStringInfo(), appendStringInfoChar(), buf, check_stack_depth(), FreePageBtreeInternalKey::child, FreePageBtreeInternalKey::first_page, FreePageBtreeLeafKey::first_page, FPM_PAGE_SIZE, fpm_pointer_to_page, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FreePageBtree::hdr, FreePageBtree::internal_key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeLeafKey::npages, FreePageBtreeHeader::nused, FreePageBtreeHeader::parent, relptr_access, relptr_offset, and FreePageBtree::u.
Referenced by FreePageManagerDump().
|
static |
Definition at line 1296 of file freepage.c.
References appendStringInfo(), appendStringInfoChar(), buf, fpm_pointer_to_page, fpm_segment_base, FreePageSpanLeader::next, FreePageSpanLeader::npages, and relptr_access.
Referenced by FreePageManagerDump().
bool FreePageManagerGet | ( | FreePageManager * | fpm, |
Size | npages, | ||
Size * | first_page | ||
) |
Definition at line 210 of file freepage.c.
References Assert, FreePageManager::contiguous_pages, FreePageBtreeCleanup(), FreePageManagerGetInternal(), FreePageManagerLargestContiguous(), and FreePageManagerUpdateLargest().
Referenced by dsa_allocate_extended(), dsm_create(), and ensure_active_superblock().
|
static |
Definition at line 1319 of file freepage.c.
References Assert, FreePageManager::btree_root, FreePageManager::contiguous_pages, FreePageManager::contiguous_pages_dirty, FreePageBtreeSearchResult::found, FPM_NUM_FREELISTS, fpm_pointer_to_page, fpm_segment_base, FREE_PAGE_SPAN_LEADER_MAGIC, FreePageManager::freelist, FreePageBtreeAdjustAncestorKeys(), FreePageBtreeRemove(), FreePageBtreeSearch(), FreePagePushSpanLeader(), FreePageBtreeSearchResult::index, sort-test::key, FreePageBtree::leaf_key, FreePageSpanLeader::magic, Min, next, FreePageSpanLeader::next, FreePageSpanLeader::npages, FreePageBtreeSearchResult::page, FreePageSpanLeader::prev, relptr_access, relptr_copy, relptr_is_null, FreePageManager::singleton_first_page, FreePageManager::singleton_npages, and FreePageBtree::u.
Referenced by FreePageManagerGet(), and FreePageManagerPutInternal().
void FreePageManagerInitialize | ( | FreePageManager * | fpm, |
char * | base | ||
) |
Definition at line 183 of file freepage.c.
References FreePageManager::btree_depth, FreePageManager::btree_recycle, FreePageManager::btree_recycle_count, FreePageManager::btree_root, FreePageManager::contiguous_pages, FreePageManager::contiguous_pages_dirty, FPM_NUM_FREELISTS, FreePageManager::freelist, relptr_store, FreePageManager::self, FreePageManager::singleton_first_page, and FreePageManager::singleton_npages.
Referenced by create_internal(), dsm_shmem_init(), and make_new_segment().
|
static |
Definition at line 324 of file freepage.c.
References FPM_NUM_FREELISTS, fpm_segment_base, FreePageManager::freelist, FreePageSpanLeader::next, FreePageSpanLeader::npages, relptr_access, and relptr_is_null.
Referenced by FreePageManagerGet(), FreePageManagerPut(), and FreePageManagerUpdateLargest().
void FreePageManagerPut | ( | FreePageManager * | fpm, |
Size | first_page, | ||
Size | npages | ||
) |
Definition at line 379 of file freepage.c.
References Assert, FreePageManager::contiguous_pages, FreePageBtreeCleanup(), FreePageManagerLargestContiguous(), FreePageManagerPutInternal(), and FreePageManagerUpdateLargest().
Referenced by create_internal(), destroy_superblock(), dsa_free(), dsm_create(), dsm_detach(), dsm_shmem_init(), dsm_unpin_segment(), and make_new_segment().
|
static |
Definition at line 1476 of file freepage.c.
References Assert, FreePageManager::btree_depth, FreePageManager::btree_recycle, FreePageManager::btree_recycle_count, FreePageManager::btree_root, FreePageBtreeInternalKey::child, elog, FATAL, FreePageBtreeInternalKey::first_page, FreePageBtreeLeafKey::first_page, FreePageBtreeSearchResult::found, FPM_ITEMS_PER_INTERNAL_PAGE, FPM_ITEMS_PER_LEAF_PAGE, fpm_page_to_pointer, fpm_segment_base, FREE_PAGE_INTERNAL_MAGIC, FREE_PAGE_LEAF_MAGIC, FreePageBtreeAdjustAncestorKeys(), FreePageBtreeFindRightSibling(), FreePageBtreeFirstKey(), FreePageBtreeGetRecycled(), FreePageBtreeInsertInternal(), FreePageBtreeInsertLeaf(), FreePageBtreeRecycle(), FreePageBtreeRemove(), FreePageBtreeSearch(), FreePageBtreeSearchInternal(), FreePageBtreeSearchLeaf(), FreePageBtreeSplitPage(), FreePageManagerGetInternal(), FreePagePopSpanLeader(), FreePagePushSpanLeader(), FreePageBtree::hdr, i, FreePageBtreeSearchResult::index, FreePageBtree::internal_key, sort-test::key, FreePageBtree::leaf_key, FreePageBtreeHeader::magic, FreePageBtreeLeafKey::npages, FreePageBtreeHeader::nused, FreePageBtreeSearchResult::page, FreePageBtreeHeader::parent, relptr_access, relptr_is_null, relptr_store, root, FreePageManager::singleton_first_page, FreePageManager::singleton_npages, FreePageBtreeSearchResult::split_pages, and FreePageBtree::u.
Referenced by FreePageBtreeCleanup(), and FreePageManagerPut().
|
static |
Definition at line 366 of file freepage.c.
References FreePageManager::contiguous_pages, FreePageManager::contiguous_pages_dirty, and FreePageManagerLargestContiguous().
Referenced by FreePageManagerGet(), and FreePageManagerPut().
|
static |
Definition at line 1843 of file freepage.c.
References Assert, FPM_NUM_FREELISTS, FPM_PAGE_SIZE, fpm_page_to_pointer, fpm_segment_base, FreePageManager::freelist, Min, next, FreePageSpanLeader::next, FreePageSpanLeader::npages, FreePageSpanLeader::prev, relptr_access, relptr_copy, and relptr_offset.
Referenced by FreePageBtreeCleanup(), and FreePageManagerPutInternal().
|
static |
Definition at line 1871 of file freepage.c.
References FPM_NUM_FREELISTS, fpm_page_to_pointer, fpm_segment_base, FREE_PAGE_SPAN_LEADER_MAGIC, FreePageManager::freelist, FreePageSpanLeader::magic, Min, FreePageSpanLeader::next, FreePageSpanLeader::npages, FreePageSpanLeader::prev, relptr_access, and relptr_store.
Referenced by FreePageBtreeCleanup(), FreePageManagerGetInternal(), and FreePageManagerPutInternal().