*
*
* IDENTIFICATION
- * $Id: nbtsort.c,v 1.26 1998/01/07 21:01:59 momjian Exp $
+ * $Id: nbtsort.c,v 1.27 1998/01/13 04:03:41 scrappy Exp $
*
* NOTES
*
#include <fcntl.h>
-#include <postgres.h>
-
-#include <utils/memutils.h>
-#include <storage/bufpage.h>
-#include <access/nbtree.h>
-#include <storage/bufmgr.h>
+#include "postgres.h"
+#include "access/nbtree.h"
+#include "storage/bufmgr.h"
+#include "storage/bufpage.h"
+#include "utils/memutils.h"
#ifndef HAVE_MEMMOVE
#include <regex/utils.h>
#endif
#ifdef BTREE_BUILD_STATS
-#include <tcop/tcopprot.h>
+#include "tcop/tcopprot.h"
extern int ShowExecutorStats;
#endif
#define FASTBUILD_MERGE
#define MAXTAPES (7)
-#define TAPEBLCKSZ (MAXBLCKSZ << 2)
+#define TAPEBLCKSZ (BLCKSZ << 2)
#define TAPETEMP "pg_btsortXXXXXX"
extern int NDirectFileRead;
{
tape->bttb_eor = eor;
FileWrite(tape->bttb_fd, (char *) tape, TAPEBLCKSZ);
- NDirectFileWrite += TAPEBLCKSZ / MAXBLCKSZ;
+ NDirectFileWrite += TAPEBLCKSZ / BLCKSZ;
_bt_tapereset(tape);
}
return (0);
}
Assert(tape->bttb_magic == BTTAPEMAGIC);
- NDirectFileRead += TAPEBLCKSZ / MAXBLCKSZ;
+ NDirectFileRead += TAPEBLCKSZ / BLCKSZ;
return (1);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.33 1998/01/06 19:42:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.34 1998/01/13 04:03:45 scrappy Exp $
*
*
* INTERFACE ROUTINES
*
*-------------------------------------------------------------------------
*/
-#include <postgres.h>
-
-#include <catalog/pg_proc.h>
-#include <storage/bufmgr.h>
-#include <fmgr.h>
-#include <access/genam.h>
-#include <access/heapam.h>
-#include <access/istrat.h>
-#include <access/xact.h>
-#include <bootstrap/bootstrap.h>
-#include <catalog/catname.h>
-#include <catalog/catalog.h>
-#include <catalog/indexing.h>
-#include <catalog/heap.h>
-#include <catalog/index.h>
-#include <catalog/pg_type.h>
-#include <executor/executor.h>
-#include <miscadmin.h>
-#include <optimizer/clauses.h>
-#include <optimizer/prep.h>
-#include <parser/parse_func.h>
-#include <storage/lmgr.h>
-#include <storage/smgr.h>
-#include <utils/builtins.h>
-#include <utils/mcxt.h>
-#include <utils/relcache.h>
-#include <utils/syscache.h>
-#include <utils/tqual.h>
+#include "postgres.h"
+#include "fmgr.h"
+
+#include "access/genam.h"
+#include "access/heapam.h"
+#include "access/istrat.h"
+#include "access/xact.h"
+#include "bootstrap/bootstrap.h"
+#include "catalog/catalog.h"
+#include "catalog/catname.h"
+#include "catalog/heap.h"
+#include "catalog/index.h"
+#include "catalog/indexing.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_type.h"
+#include "executor/executor.h"
+#include "miscadmin.h"
+#include "optimizer/clauses.h"
+#include "optimizer/prep.h"
+#include "parser/parse_func.h"
+#include "storage/lmgr.h"
+#include "storage/smgr.h"
+#include "utils/builtins.h"
+#include "utils/mcxt.h"
+#include "utils/relcache.h"
+#include "utils/syscache.h"
+#include "utils/tqual.h"
#ifndef HAVE_MEMMOVE
#include <regex/utils.h>
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.15 1998/01/07 21:02:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.16 1998/01/13 04:03:53 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-
-#include "storage/fd.h" /* for SEEK_ */
-#include "storage/ipc.h"
-#include "storage/bufmgr.h" /* for BLCKSZ */
+#include "executor/execdebug.h"
#include "executor/executor.h"
#include "executor/nodeHash.h"
#include "executor/nodeHashjoin.h"
-#include "executor/execdebug.h"
-#include "utils/palloc.h"
+#include "storage/ipc.h"
#include "utils/hsearch.h"
extern int NBuffers;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.8 1997/09/08 21:43:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.9 1998/01/13 04:03:58 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <sys/stat.h>
#include <fcntl.h>
-
-
#include "postgres.h"
-#include "storage/bufmgr.h" /* for BLCKSZ */
-#include "storage/fd.h" /* for SEEK_ */
-#include "executor/executor.h"
+
#include "executor/execdebug.h"
+#include "executor/executor.h"
#include "executor/nodeHash.h"
#include "executor/nodeHashjoin.h"
-
#include "optimizer/clauses.h" /* for get_leftop */
-
-#include "utils/palloc.h"
-
static TupleTableSlot *
ExecHashJoinOuterGetTuple(Plan *node, Plan *parent, HashJoinState *hjstate);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.19 1997/09/08 21:44:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.20 1998/01/13 04:04:06 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include "config.h"
#include <math.h>
+
#ifdef HAVE_LIMITS_H
#include <limits.h>
#ifndef MAXINT
#endif
#endif
-#include <utils/lsyscache.h>
#include "nodes/relation.h"
-
#include "optimizer/cost.h"
#include "optimizer/internal.h"
#include "optimizer/keys.h"
#include "optimizer/tlist.h"
-
-#include "storage/bufmgr.h" /* for BLCKSZ */
+#include "utils/lsyscache.h"
extern int NBuffers;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.11 1998/01/07 21:03:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.12 1998/01/13 04:04:07 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <string.h>
#include "postgres.h"
-#include "nodes/pg_list.h"
+
+#include "access/heapam.h"
+#include "catalog/pg_language.h"
+#include "catalog/pg_proc.h"
+#include "catalog/pg_type.h"
+#include "lib/lispsort.h"
#include "nodes/nodes.h"
+#include "nodes/pg_list.h"
#include "nodes/primnodes.h"
#include "nodes/relation.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/syscache.h"
-#include "catalog/pg_proc.h"
-#include "catalog/pg_type.h"
-#include "utils/syscache.h"
-#include "catalog/pg_language.h"
-#include "optimizer/xfunc.h"
#include "optimizer/clauses.h"
-#include "optimizer/pathnode.h"
-#include "optimizer/internal.h"
#include "optimizer/cost.h"
+#include "optimizer/internal.h"
#include "optimizer/keys.h"
-#include "optimizer/tlist.h"
-#include "lib/lispsort.h"
-#include "access/heapam.h"
-#include "tcop/dest.h"
+#include "optimizer/pathnode.h"
+#include "optimizer/tlist.h" /* for get_expr */
+#include "optimizer/xfunc.h"
#include "storage/buf_internals.h" /* for NBuffers */
-#include "optimizer/tlist.h" /* for get_expr */
+#include "tcop/dest.h"
+#include "utils/syscache.h"
#define ever ; 1 ;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.13 1998/01/07 21:04:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.14 1998/01/13 04:04:12 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include <string.h>
+
#include "postgres.h"
-#include "utils/rel.h" /* for Relation stuff */
#include "access/heapam.h" /* access methods like amopenr */
-#include "utils/builtins.h"
-#include "utils/elog.h" /* for elog */
-#include "utils/palloc.h"
-#include "utils/lsyscache.h" /* for get_typlen */
-#include "nodes/pg_list.h" /* for Lisp support */
#include "nodes/parsenodes.h"
+#include "nodes/pg_list.h" /* for Lisp support */
#include "parser/parse_relation.h"
-
#include "rewrite/locks.h"
#include "rewrite/rewriteDefine.h"
#include "rewrite/rewriteRemove.h"
#include "rewrite/rewriteSupport.h"
#include "tcop/tcopprot.h"
+#include "utils/builtins.h"
+#include "utils/lsyscache.h" /* for get_typlen */
+#include "utils/rel.h" /* for Relation stuff */
+
Oid LastOidProcessed = InvalidOid;
*
* should this be smaller?
*/
-#define RULE_PLAN_SIZE 8192
+#define RULE_PLAN_SIZE BLCKSZ
static void
strcpyq(char *dest, char *source)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.16 1998/01/07 21:04:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.17 1998/01/13 04:04:20 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include "storage/spin.h"
#include "storage/smgr.h"
#include "storage/lmgr.h"
-#include "storage/buf_internals.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/hsearch.h"
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.26 1998/01/07 21:05:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.27 1998/01/13 04:04:31 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "miscadmin.h" /* for DataDir */
+#include "catalog/catalog.h"
#include "storage/block.h"
#include "storage/fd.h"
#include "storage/smgr.h" /* where the declarations go */
-#include "storage/fd.h"
#include "utils/mcxt.h"
#include "utils/rel.h"
-#include "utils/palloc.h"
-#include "catalog/catalog.h"
#undef DIAGNOSTIC
#define MDFD_DIRTY (uint16) 0x01
#define MDFD_FREE (uint16) 0x02
-#define RELSEG_SIZE 262144 /* (2 ** 31) / 8192 -- 2GB file */
+/*
+ * RELSEG_SIZE appears to be the number of segments that can
+ * be in a disk file. It was defined as 262144 based on 8k
+ * blocks, but now that the block size can be changed, this
+ * has to be calculated at compile time. Otherwise, the file
+ * size limit would not work out to 2-gig (2147483648).
+ *
+ * The number needs to be (2 ** 31) / BLCKSZ, but to be keep
+ * the math under MAXINT, pre-divide by 256 and use ...
+ *
+ * (((2 ** 23) / BLCKSZ) * (2 ** 8))
+ *
+ * 07 Jan 98 darrenk
+ */
+
+#define RELSEG_SIZE ((8388608 / BLCKSZ) * 256)
/* routines declared here */
static MdfdVec *_mdfd_openseg(Relation reln, int segno, int oflags);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.60 1998/01/09 05:48:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.61 1998/01/13 04:04:36 scrappy Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
#include "postgres.h"
#include "miscadmin.h"
-#include "catalog/catname.h"
-#include "access/xact.h"
-
-#include "lib/dllist.h"
+#include "fmgr.h"
+#include "access/xact.h"
+#include "catalog/catname.h"
#include "commands/async.h"
-#include "tcop/tcopprot.h" /* where declarations for this file go */
+#include "executor/execdebug.h"
+#include "executor/executor.h"
+#include "lib/dllist.h"
+#include "libpq/libpq.h"
+#include "libpq/pqsignal.h"
+#include "nodes/pg_list.h"
+#include "nodes/print.h"
+#include "optimizer/cost.h"
#include "optimizer/planner.h"
+#include "optimizer/prep.h"
#include "parser/parser.h"
-
-#include "tcop/tcopprot.h"
+#include "rewrite/rewriteHandler.h" /* for QueryRewrite() */
+#include "storage/bufmgr.h"
+#include "tcop/dest.h"
+#include "tcop/fastpath.h"
+#include "tcop/pquery.h"
#include "tcop/tcopdebug.h"
+#include "tcop/tcopprot.h" /* where declarations for this file go */
+#include "tcop/utility.h"
+#include "utils/mcxt.h"
+#include "utils/rel.h"
-#include "executor/execdebug.h"
-#include "executor/executor.h"
#if FALSE
#include "nodes/relation.h"
#endif
-#include "nodes/print.h"
-#include "optimizer/cost.h"
-#include "optimizer/planner.h"
#if 0
#include "optimizer/xfunc.h"
#endif
-#include "optimizer/prep.h"
+
#if FALSE
#include "nodes/plannodes.h"
#endif
-#include "storage/bufmgr.h"
-#include "fmgr.h"
-#include "utils/palloc.h"
-#include "utils/rel.h"
-
-#include "nodes/pg_list.h"
-#include "tcop/dest.h"
#if FALSE
#include "nodes/memnodes.h"
#endif
-#include "utils/mcxt.h"
-#include "tcop/pquery.h"
-#include "tcop/utility.h"
-#include "tcop/fastpath.h"
-
-#include "libpq/libpq.h"
-#include "libpq/pqsignal.h"
-#include "rewrite/rewriteHandler.h" /* for QueryRewrite() */
static void quickdie(SIGNAL_ARGS);
int S;
S = atoi(optarg);
- if ( S >= 4*MAXBLCKSZ/1024 )
+ if ( S >= 4*BLCKSZ/1024 )
SortMem = S;
}
break;
if (IsUnderPostmaster == false)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.60 $ $Date: 1998/01/09 05:48:22 $");
+ puts("$Revision: 1.61 $ $Date: 1998/01/13 04:04:36 $");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.13 1998/01/05 16:39:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.14 1998/01/13 04:04:47 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <fcntl.h>
#include "postgres.h"
-
-#include <libpq/be-fsstubs.h>
-#include "utils/memutils.h"
-#include "libpq/libpq-fs.h"
-
-#include "storage/fd.h" /* for SEEK_ */
+#include "fmgr.h"
#include "catalog/pg_type.h"
-
-#include "fmgr.h"
+#include "libpq/be-fsstubs.h"
+#include "libpq/libpq-fs.h"
+#include "optimizer/internal.h"
#include "utils/array.h"
+#include "utils/memutils.h"
-#include "optimizer/internal.h"
#ifndef HAVE_MEMMOVE
#include <regex/utils.h>
#else
#include <string.h>
#endif
-
#define INFTY 500000000
#define MANY 10000
#define MAXPAT 20
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.30 1998/01/07 21:06:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.31 1998/01/13 04:04:57 scrappy Exp $
*
* NOTES
* Sorts the first relation into the second relation.
#include <unistd.h>
#include "postgres.h"
+#include "miscadmin.h"
-#include "executor/execdebug.h"
#include "access/heapam.h"
#include "access/htup.h"
#include "access/relscan.h"
#include "access/skey.h"
-#include "storage/buf.h"
-#include "storage/bufmgr.h" /* for BLCKSZ */
-#include "utils/portal.h" /* for {Start,End}PortalAllocMode */
-#include "utils/elog.h"
-#include "utils/rel.h"
-
+#include "executor/execdebug.h"
+#include "executor/executor.h"
#include "nodes/execnodes.h"
#include "nodes/plannodes.h"
-#include "executor/executor.h"
-
+#include "storage/buf.h"
+#include "storage/fd.h"
#include "utils/lselect.h"
+#include "utils/portal.h" /* for {Start,End}PortalAllocMode */
#include "utils/psort.h"
-
-#include "miscadmin.h"
-#include "storage/fd.h"
+#include "utils/rel.h"
static bool createfirstrun(Sort * node);
static bool createrun(Sort * node, FILE * file);
#define USEMEM(NODE,AMT) PS(node)->treeContext.sortMem -= (AMT)
#define FREEMEM(NODE,AMT) PS(node)->treeContext.sortMem += (AMT)
-#define LACKMEM(NODE) (PS(node)->treeContext.sortMem <= MAXBLCKSZ) /* not accurate */
+#define LACKMEM(NODE) (PS(node)->treeContext.sortMem <= BLCKSZ) /* not accurate */
#define TRACEMEM(FUNC)
#define TRACEOUT(FUNC, TUP)
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufmgr.h,v 1.15 1997/09/08 21:54:18 momjian Exp $
+ * $Id: bufmgr.h,v 1.16 1998/01/13 04:05:09 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
* in theory this could be anything, but in practice this is actually
* limited to 2^13 bytes because we have limited ItemIdData.lp_off and
* ItemIdData.lp_len to 13 bits (see itemid.h).
+ *
+ * limit is now 2^15. Took four bits from ItemIdData.lp_flags and gave
+ * two apiece to ItemIdData.lp_len and lp_off. darrenk 01/06/98
+ *
*/
-#define MAXBLCKSZ 8192
-typedef void *Block;
+#define MAXBLCKSZ 32768
+typedef void *Block;
/* special pageno for bget */
#define P_NEW InvalidBlockNumber /* grow the file to get a new page */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufpage.h,v 1.13 1997/09/08 21:54:20 momjian Exp $
+ * $Id: bufpage.h,v 1.14 1998/01/13 04:05:11 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
*
* note that this is actually limited to 2^13 because we have limited
* ItemIdData.lp_off and ItemIdData.lp_len to 13 bits (see itemid.h).
+ *
+ * uint16 is still valid, but the limit has been raised to 15 bits.
+ * 06 Jan 98 - darrenk
*/
typedef uint16 LocationIndex;
* page header, opaque space and a minimal tuple;
* on the high end, we can only support pages up
* to 8KB because lp_off/lp_len are 13 bits.
+ *
+ * see above comment. Now use 15 bits and pages
+ * up to 32KB at your own risk.
*/
typedef struct OpaqueData
{
*
* XXX currently all page sizes are "valid" but we only actually
* use BLCKSZ.
+ *
+ * 01/06/98 Now does something useful. darrenk
+ *
*/
-#define PageSizeIsValid(pageSize) 1
+#define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ)
/*
* PageGetPageSize --
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: itemid.h,v 1.4 1997/09/08 21:54:24 momjian Exp $
+ * $Id: itemid.h,v 1.5 1998/01/13 04:05:12 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
typedef struct ItemIdData
{ /* line pointers */
- unsigned lp_off:13, /* offset to find tup */
+ unsigned lp_off:15, /* offset to find tup */
/* can be reduced by 2 if necc. */
- lp_flags:6, /* flags on tuple */
- lp_len:13; /* length of tuple */
+ lp_flags:2, /* flags on tuple */
+ lp_len:15; /* length of tuple */
} ItemIdData;
typedef struct ItemIdData *ItemId;