aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/gist_private.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-03-30 23:03:10 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-03-30 23:03:10 +0000
commit89395bfa6f2fafccec10be377fcf759030910654 (patch)
tree836d0cd5721066b626d5e58f9028a6989e1cb97d /src/include/access/gist_private.h
parent4243f2387a762b26c8e6be5c8094425798d86ea3 (diff)
downloadpostgresql-89395bfa6f2fafccec10be377fcf759030910654.tar.gz
postgresql-89395bfa6f2fafccec10be377fcf759030910654.zip
Improve gist XLOG code to follow the coding rules needed to prevent
torn-page problems. This introduces some issues of its own, mainly that there are now some critical sections of unreasonably broad scope, but it's a step forward anyway. Further cleanup will require some code refactoring that I'd prefer to get Oleg and Teodor involved in.
Diffstat (limited to 'src/include/access/gist_private.h')
-rw-r--r--src/include/access/gist_private.h34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h
index 3b072da6376..1bfc90abbce 100644
--- a/src/include/access/gist_private.h
+++ b/src/include/access/gist_private.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.11 2006/03/24 04:32:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/gist_private.h,v 1.12 2006/03/30 23:03:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,11 +80,13 @@ typedef GISTScanOpaqueData *GISTScanOpaque;
/* XLog stuff */
extern const XLogRecPtr XLogRecPtrForTemp;
-#define XLOG_GIST_ENTRY_UPDATE 0x00
-#define XLOG_GIST_ENTRY_DELETE 0x10
-#define XLOG_GIST_NEW_ROOT 0x20
+#define XLOG_GIST_PAGE_UPDATE 0x00
+#define XLOG_GIST_NEW_ROOT 0x20
+#define XLOG_GIST_PAGE_SPLIT 0x30
+#define XLOG_GIST_INSERT_COMPLETE 0x40
+#define XLOG_GIST_CREATE_INDEX 0x50
-typedef struct gistxlogEntryUpdate
+typedef struct gistxlogPageUpdate
{
RelFileNode node;
BlockNumber blkno;
@@ -100,17 +102,16 @@ typedef struct gistxlogEntryUpdate
/*
* follow: 1. todelete OffsetNumbers 2. tuples to insert
*/
-} gistxlogEntryUpdate;
-
-#define XLOG_GIST_PAGE_SPLIT 0x30
+} gistxlogPageUpdate;
typedef struct gistxlogPageSplit
{
RelFileNode node;
BlockNumber origblkno; /* splitted page */
+ bool origleaf; /* was splitted page a leaf page? */
uint16 npage;
- /* see comments on gistxlogEntryUpdate */
+ /* see comments on gistxlogPageUpdate */
ItemPointerData key;
/*
@@ -118,22 +119,19 @@ typedef struct gistxlogPageSplit
*/
} gistxlogPageSplit;
-#define XLOG_GIST_INSERT_COMPLETE 0x40
-
typedef struct gistxlogPage
{
BlockNumber blkno;
- int num;
+ int num; /* number of index tuples following */
} gistxlogPage;
-#define XLOG_GIST_CREATE_INDEX 0x50
-
typedef struct gistxlogInsertComplete
{
RelFileNode node;
/* follows ItemPointerData key to clean */
} gistxlogInsertComplete;
+
/* SplitedPageLayout - gistSplit function result */
typedef struct SplitedPageLayout
{
@@ -239,8 +237,7 @@ extern void gistnewroot(Relation r, Buffer buffer, IndexTuple *itup, int len, It
extern IndexTuple *gistSplit(Relation r, Buffer buffer, IndexTuple *itup,
int *len, SplitedPageLayout **dist, GISTSTATE *giststate);
-extern GISTInsertStack *gistFindPath(Relation r, BlockNumber child,
- Buffer (*myReadBuffer) (Relation, BlockNumber));
+extern GISTInsertStack *gistFindPath(Relation r, BlockNumber child);
/* gistxlog.c */
extern void gist_redo(XLogRecPtr lsn, XLogRecord *record);
@@ -249,11 +246,12 @@ extern void gist_xlog_startup(void);
extern void gist_xlog_cleanup(void);
extern IndexTuple gist_form_invalid_tuple(BlockNumber blkno);
-extern XLogRecData *formUpdateRdata(RelFileNode node, BlockNumber blkno,
+extern XLogRecData *formUpdateRdata(RelFileNode node, Buffer buffer,
OffsetNumber *todelete, int ntodelete, bool emptypage,
IndexTuple *itup, int ituplen, ItemPointer key);
-extern XLogRecData *formSplitRdata(RelFileNode node, BlockNumber blkno,
+extern XLogRecData *formSplitRdata(RelFileNode node,
+ BlockNumber blkno, bool page_is_leaf,
ItemPointer key, SplitedPageLayout *dist);
extern XLogRecPtr gistxlogInsertCompletion(RelFileNode node, ItemPointerData *keys, int len);