aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/genam.h24
-rw-r--r--src/include/access/nbtree.h20
-rw-r--r--src/include/access/xlog.h15
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/pg_am.h16
-rw-r--r--src/include/catalog/pg_proc.h4
6 files changed, 54 insertions, 29 deletions
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 6266da47c8f..59ecf1d8f4f 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: genam.h,v 1.37 2002/09/04 20:31:36 momjian Exp $
+ * $Id: genam.h,v 1.38 2003/02/22 00:45:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,17 +20,32 @@
#include "nodes/primnodes.h"
-/* Struct for statistics returned by bulk-delete operation */
+/*
+ * Struct for statistics returned by bulk-delete operation
+ *
+ * This is now also passed to the index AM's vacuum-cleanup operation,
+ * if it has one, which can modify the results as needed. Note that
+ * an index AM could choose to have bulk-delete return a larger struct
+ * of which this is just the first field; this provides a way for bulk-delete
+ * to communicate additional private data to vacuum-cleanup.
+ */
typedef struct IndexBulkDeleteResult
{
BlockNumber num_pages; /* pages remaining in index */
+ double num_index_tuples; /* tuples remaining */
double tuples_removed; /* # removed by bulk-delete operation */
- double num_index_tuples; /* # remaining */
+ BlockNumber pages_free; /* # unused pages in index */
} IndexBulkDeleteResult;
/* Typedef for callback function to determine if a tuple is bulk-deletable */
typedef bool (*IndexBulkDeleteCallback) (ItemPointer itemptr, void *state);
+/* Struct for additional arguments passed to vacuum-cleanup operation */
+typedef struct IndexVacuumCleanupInfo
+{
+ bool vacuum_full; /* VACUUM FULL (we have exclusive lock) */
+ int message_level; /* elog level for progress messages */
+} IndexVacuumCleanupInfo;
/* Struct for heap-or-index scans of system tables */
typedef struct SysScanDescData
@@ -72,6 +87,9 @@ extern bool index_getnext_indexitem(IndexScanDesc scan,
extern IndexBulkDeleteResult *index_bulk_delete(Relation indexRelation,
IndexBulkDeleteCallback callback,
void *callback_state);
+extern IndexBulkDeleteResult *index_vacuum_cleanup(Relation indexRelation,
+ IndexVacuumCleanupInfo *info,
+ IndexBulkDeleteResult *stats);
extern RegProcedure index_cost_estimator(Relation indexRelation);
extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
uint16 procnum);
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index f4dce1842f1..4bb5db0513e 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nbtree.h,v 1.64 2003/02/21 00:06:22 tgl Exp $
+ * $Id: nbtree.h,v 1.65 2003/02/22 00:45:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,6 +54,7 @@ typedef BTPageOpaqueData *BTPageOpaque;
#define BTP_ROOT (1 << 1) /* root page (has no parent) */
#define BTP_DELETED (1 << 2) /* page has been deleted from tree */
#define BTP_META (1 << 3) /* meta-page */
+#define BTP_HALF_DEAD (1 << 4) /* empty, but still in tree */
/*
@@ -124,12 +125,13 @@ typedef BTItemData *BTItem;
#define SizeOfBTItem sizeof(BTItemData)
/* Test whether items are the "same" per the above notes */
-#define BTItemSame(i1, i2) ( (i1)->bti_itup.t_tid.ip_blkid.bi_hi == \
- (i2)->bti_itup.t_tid.ip_blkid.bi_hi && \
- (i1)->bti_itup.t_tid.ip_blkid.bi_lo == \
- (i2)->bti_itup.t_tid.ip_blkid.bi_lo && \
- (i1)->bti_itup.t_tid.ip_posid == \
- (i2)->bti_itup.t_tid.ip_posid )
+#define BTTidSame(i1, i2) \
+ ( (i1).ip_blkid.bi_hi == (i2).ip_blkid.bi_hi && \
+ (i1).ip_blkid.bi_lo == (i2).ip_blkid.bi_lo && \
+ (i1).ip_posid == (i2).ip_posid )
+#define BTItemSame(i1, i2) \
+ BTTidSame((i1)->bti_itup.t_tid, (i2)->bti_itup.t_tid)
+
/*
* In general, the btree code tries to localize its knowledge about
@@ -150,6 +152,7 @@ typedef BTItemData *BTItem;
#define P_ISLEAF(opaque) ((opaque)->btpo_flags & BTP_LEAF)
#define P_ISROOT(opaque) ((opaque)->btpo_flags & BTP_ROOT)
#define P_ISDELETED(opaque) ((opaque)->btpo_flags & BTP_DELETED)
+#define P_IGNORE(opaque) ((opaque)->btpo_flags & (BTP_DELETED|BTP_HALF_DEAD))
/*
* Lehman and Yao's algorithm requires a ``high key'' on every non-rightmost
@@ -412,8 +415,6 @@ typedef BTScanOpaqueData *BTScanOpaque;
/*
* prototypes for functions in nbtree.c (external entry points for btree)
*/
-extern bool BuildingBtree; /* in nbtree.c */
-
extern void AtEOXact_nbtree(void);
extern Datum btbuild(PG_FUNCTION_ARGS);
@@ -426,6 +427,7 @@ extern Datum btendscan(PG_FUNCTION_ARGS);
extern Datum btmarkpos(PG_FUNCTION_ARGS);
extern Datum btrestrpos(PG_FUNCTION_ARGS);
extern Datum btbulkdelete(PG_FUNCTION_ARGS);
+extern Datum btvacuumcleanup(PG_FUNCTION_ARGS);
/*
* prototypes for functions in nbtinsert.c
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index a1be9bacf3b..cb2e6e523df 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: xlog.h,v 1.41 2003/02/21 00:06:22 tgl Exp $
+ * $Id: xlog.h,v 1.42 2003/02/22 00:45:05 tgl Exp $
*/
#ifndef XLOG_H
#define XLOG_H
@@ -56,17 +56,18 @@ typedef struct XLogRecord
#define XLR_INFO_MASK 0x0F
/*
- * We support backup of up to 2 disk blocks per XLOG record (could support
- * more if we cared to dedicate more xl_info bits for this purpose; currently
- * do not need more than 2 anyway). If we backed up any disk blocks then we
- * use flag bits in xl_info to signal it.
+ * If we backed up any disk blocks with the XLOG record, we use flag bits in
+ * xl_info to signal it. We support backup of up to 3 disk blocks per XLOG
+ * record. (Could support 4 if we cared to dedicate all the xl_info bits for
+ * this purpose; currently bit 0 of xl_info is unused and available.)
*/
-#define XLR_BKP_BLOCK_MASK 0x0C /* all info bits used for bkp
+#define XLR_BKP_BLOCK_MASK 0x0E /* all info bits used for bkp
* blocks */
-#define XLR_MAX_BKP_BLOCKS 2
+#define XLR_MAX_BKP_BLOCKS 3
#define XLR_SET_BKP_BLOCK(iblk) (0x08 >> (iblk))
#define XLR_BKP_BLOCK_1 XLR_SET_BKP_BLOCK(0) /* 0x08 */
#define XLR_BKP_BLOCK_2 XLR_SET_BKP_BLOCK(1) /* 0x04 */
+#define XLR_BKP_BLOCK_3 XLR_SET_BKP_BLOCK(2) /* 0x02 */
/*
* Sometimes we log records which are out of transaction control.
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 240889577ae..fc24db5d2e1 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.178 2003/02/21 00:06:22 tgl Exp $
+ * $Id: catversion.h,v 1.179 2003/02/22 00:45:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200302171
+#define CATALOG_VERSION_NO 200302211
#endif
diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h
index 66b2f2621f1..3ee7121812c 100644
--- a/src/include/catalog/pg_am.h
+++ b/src/include/catalog/pg_am.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_am.h,v 1.23 2002/07/29 22:14:11 tgl Exp $
+ * $Id: pg_am.h,v 1.24 2003/02/22 00:45:05 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -58,6 +58,7 @@ CATALOG(pg_am)
regproc amrestrpos; /* "restore marked scan position" function */
regproc ambuild; /* "build new index" function */
regproc ambulkdelete; /* bulk-delete function */
+ regproc amvacuumcleanup; /* post-VACUUM cleanup function */
regproc amcostestimate; /* estimate cost of an indexscan */
} FormData_pg_am;
@@ -72,7 +73,7 @@ typedef FormData_pg_am *Form_pg_am;
* compiler constants for pg_am
* ----------------
*/
-#define Natts_pg_am 19
+#define Natts_pg_am 20
#define Anum_pg_am_amname 1
#define Anum_pg_am_amowner 2
#define Anum_pg_am_amstrategies 3
@@ -91,21 +92,22 @@ typedef FormData_pg_am *Form_pg_am;
#define Anum_pg_am_amrestrpos 16
#define Anum_pg_am_ambuild 17
#define Anum_pg_am_ambulkdelete 18
-#define Anum_pg_am_amcostestimate 19
+#define Anum_pg_am_amvacuumcleanup 19
+#define Anum_pg_am_amcostestimate 20
/* ----------------
* initial contents of pg_am
* ----------------
*/
-DATA(insert OID = 402 ( rtree PGUID 8 3 0 f f f f rtgettuple rtinsert rtbeginscan rtrescan rtendscan rtmarkpos rtrestrpos rtbuild rtbulkdelete rtcostestimate ));
+DATA(insert OID = 402 ( rtree PGUID 8 3 0 f f f f rtgettuple rtinsert rtbeginscan rtrescan rtendscan rtmarkpos rtrestrpos rtbuild rtbulkdelete - rtcostestimate ));
DESCR("r-tree index access method");
-DATA(insert OID = 403 ( btree PGUID 5 1 1 t t t t btgettuple btinsert btbeginscan btrescan btendscan btmarkpos btrestrpos btbuild btbulkdelete btcostestimate ));
+DATA(insert OID = 403 ( btree PGUID 5 1 1 t t t t btgettuple btinsert btbeginscan btrescan btendscan btmarkpos btrestrpos btbuild btbulkdelete btvacuumcleanup btcostestimate ));
DESCR("b-tree index access method");
#define BTREE_AM_OID 403
-DATA(insert OID = 405 ( hash PGUID 1 1 0 f f f t hashgettuple hashinsert hashbeginscan hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbulkdelete hashcostestimate ));
+DATA(insert OID = 405 ( hash PGUID 1 1 0 f f f t hashgettuple hashinsert hashbeginscan hashrescan hashendscan hashmarkpos hashrestrpos hashbuild hashbulkdelete - hashcostestimate ));
DESCR("hash index access method");
-DATA(insert OID = 783 ( gist PGUID 100 7 0 f t f f gistgettuple gistinsert gistbeginscan gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbulkdelete gistcostestimate ));
+DATA(insert OID = 783 ( gist PGUID 100 7 0 f t f f gistgettuple gistinsert gistbeginscan gistrescan gistendscan gistmarkpos gistrestrpos gistbuild gistbulkdelete - gistcostestimate ));
DESCR("GiST index access method");
#define GIST_AM_OID 783
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index f32715284b0..3aab3ef8a73 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.283 2003/02/13 05:24:02 momjian Exp $
+ * $Id: pg_proc.h,v 1.284 2003/02/22 00:45:05 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -710,6 +710,8 @@ DATA(insert OID = 338 ( btbuild PGNSP PGUID 12 f f t f v 3 2278 "2281 2281
DESCR("btree(internal)");
DATA(insert OID = 332 ( btbulkdelete PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281" btbulkdelete - _null_ ));
DESCR("btree(internal)");
+DATA(insert OID = 972 ( btvacuumcleanup PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281" btvacuumcleanup - _null_ ));
+DESCR("btree(internal)");
DATA(insert OID = 1268 ( btcostestimate PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281" btcostestimate - _null_ ));
DESCR("btree(internal)");