mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Replace it with an approach similar to what GiST uses: when a page is split, the left sibling is marked with a flag indicating that the parent hasn't been updated yet. When the parent is updated, the flag is cleared. If an insertion steps on a page with the flag set, it will finish split before proceeding with the insertion. The post-recovery cleanup mechanism was never totally reliable, as insertion to the parent could fail e.g because of running out of memory or disk space, leaving the tree in an inconsistent state. This also divides the responsibility of WAL-logging more clearly between the generic ginbtree.c code, and the parts specific to entry and posting trees. There is now a common WAL record format for insertions and deletions, which is written by ginbtree.c, followed by tree-specific payload, which is returned by the placetopage- and split- callbacks.
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/*--------------------------------------------------------------------------
|
|
* gin.h
|
|
* Public header file for Generalized Inverted Index access method.
|
|
*
|
|
* Copyright (c) 2006-2013, PostgreSQL Global Development Group
|
|
*
|
|
* src/include/access/gin.h
|
|
*--------------------------------------------------------------------------
|
|
*/
|
|
#ifndef GIN_H
|
|
#define GIN_H
|
|
|
|
#include "access/xlog.h"
|
|
#include "storage/block.h"
|
|
#include "utils/relcache.h"
|
|
|
|
|
|
/*
|
|
* amproc indexes for inverted indexes.
|
|
*/
|
|
#define GIN_COMPARE_PROC 1
|
|
#define GIN_EXTRACTVALUE_PROC 2
|
|
#define GIN_EXTRACTQUERY_PROC 3
|
|
#define GIN_CONSISTENT_PROC 4
|
|
#define GIN_COMPARE_PARTIAL_PROC 5
|
|
#define GINNProcs 5
|
|
|
|
/*
|
|
* searchMode settings for extractQueryFn.
|
|
*/
|
|
#define GIN_SEARCH_MODE_DEFAULT 0
|
|
#define GIN_SEARCH_MODE_INCLUDE_EMPTY 1
|
|
#define GIN_SEARCH_MODE_ALL 2
|
|
#define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */
|
|
|
|
/*
|
|
* GinStatsData represents stats data for planner use
|
|
*/
|
|
typedef struct GinStatsData
|
|
{
|
|
BlockNumber nPendingPages;
|
|
BlockNumber nTotalPages;
|
|
BlockNumber nEntryPages;
|
|
BlockNumber nDataPages;
|
|
int64 nEntries;
|
|
int32 ginVersion;
|
|
} GinStatsData;
|
|
|
|
/* GUC parameter */
|
|
extern PGDLLIMPORT int GinFuzzySearchLimit;
|
|
|
|
/* ginutil.c */
|
|
extern void ginGetStats(Relation index, GinStatsData *stats);
|
|
extern void ginUpdateStats(Relation index, const GinStatsData *stats);
|
|
|
|
/* ginxlog.c */
|
|
extern void gin_redo(XLogRecPtr lsn, XLogRecord *record);
|
|
extern void gin_desc(StringInfo buf, uint8 xl_info, char *rec);
|
|
extern void gin_xlog_startup(void);
|
|
extern void gin_xlog_cleanup(void);
|
|
|
|
#endif /* GIN_H */
|