head     1.11;
branch   ;
access   ;
symbols  Version_2_1:1.9 Version_2:1.6;
locks    ; strict;
comment  @ * @;


1.11
date     91.04.24.23.24.04;  author cimarron;  state Exp;
branches ;
next     1.10;

1.10
date     91.03.20.20.54.05;  author cimarron;  state Exp;
branches ;
next     1.9;

1.9
date     91.02.07.15.50.10;  author hong;  state Exp;
branches ;
next     1.8;

1.8
date     91.02.07.13.59.58;  author hong;  state Exp;
branches ;
next     1.7;

1.7
date     91.02.07.00.44.55;  author hong;  state Exp;
branches ;
next     1.6;

1.6
date     90.03.15.10.05.09;  author cimarron;  state Version_2;
branches ;
next     1.5;

1.5
date     90.02.12.19.54.20;  author cimarron;  state Exp;
branches ;
next     1.4;

1.4
date     90.02.12.19.46.30;  author cimarron;  state Exp;
branches ;
next     1.3;

1.3
date     90.02.02.17.11.41;  author cimarron;  state Exp;
branches ;
next     1.2;

1.2
date     90.01.26.13.33.40;  author cimarron;  state Exp;
branches ;
next     1.1;

1.1
date     89.11.02.18.06.07;  author cimarron;  state Exp;
branches ;
next     ;


desc
@added support for Merge Joins in the executor
@


1.11
log
@added some merge join debugging macros
@
text
@/* ----------------------------------------------------------------
 *      FILE
 *     	execdebug.h
 *     
 *      DESCRIPTION
 *     	#defines governing debugging behaviour in the executor
 *
 *	$Header: RCS/execdebug.h,v 1.10 91/03/20 20:54:05 cimarron Exp $
 * ----------------------------------------------------------------
 */

#ifndef ExecDebugIncluded
#define ExecDebugIncluded

/* ----------------------------------------------------------------
 *	debugging defines.
 *
 *	If you want certain debugging behaviour, then #define
 *	the variable to 1, else #undef it. -cim 10/26/89
 * ----------------------------------------------------------------
 */

/* ----------------
 *	EXEC_DEBUGSTORETUP is for tuple table debugging - this
 *	will print a message every time we call ExecStoreTuple.
 *	-cim 3/20/91
 * ----------------
 */
#undef EXEC_DEBUGSTORETUP

/* ----------------
 *	EXEC_TUPLECOUNT is a #define which causes the
 *	executor keep track of tuple counts.  This might be
 *	causing some problems with the decstation stuff so
 *	you might want to undefine this if you are doing work
 *	on the decs  - cim 10/20/89
 * ----------------
 */
#undef EXEC_TUPLECOUNT

/* ----------------
 *	EXEC_SHOWBUFSTATS controls whether or not buffer statistics
 *	are shown for each query.  -cim 2/9/89
 * ----------------
 */
#undef EXEC_SHOWBUFSTATS

/* ----------------
 *	EXEC_ASSIGNDEBUGHOOKS controls whether or not _debug_hook_id_
 *	will be used to assign debugging hooks to all the executor
 *	nodes.  
 * ----------------
 */
#undef EXEC_ASSIGNDEBUGHOOKS

/* ----------------
 *	EXEC_CONTEXTDEBUG turns on the printing of debugging information
 *	by CXT_printf() calls regarding which memory context is the
 *	CurrentMemoryContext for palloc() calls.  
 * ----------------
 */
#undef EXEC_CONTEXTDEBUG

/* ----------------
 *	EXEC_ALLOCDEBUG makes the ExecAlloc macro call ExecAllocDebug
 *	instead of ExecAllocNormal.  ExecAllocNormal should just call
 *	the memory manager in whatever way is needed and ExecAllocDebug
 *	should do that and keep track of what stuff is allocated and
 *	dump a status report of unallocated stuff at EndPlan() time
 * ----------------
 */
#undef EXEC_ALLOCDEBUG

/* ----------------
 *	EXEC_RETURNSIZE is a compile flag governing the
 *	behaviour of lispFmgr..  See ExecMakeFunctionResult().
 *	Undefining this avoids a problem in the system cache.
 *
 *	Note: undefining this means that there is incorrect
 *	      information in the const nodes corresponding
 *	      to function (or operator) results.  The thing is,
 *	      99% of the time this is fine because when you do
 *	      something like x = emp.sal + 1, you already know
 *	      the type and size of x so the fact that + didn't
 *	      return the correct size doesn't matter.
 *	      With variable length stuff the size is stored in
 *	      the first few bytes of the data so again, it's
 *	      not likely to matter.
 * ----------------
 */
#undef EXEC_RETURNSIZE

/* ----------------
 *	EXEC_UTILSDEBUG is a flag which turns on debugging of the
 *	executor utilities by EU_printf() in eutils.c
 * ----------------
 */
#undef EXEC_UTILSDEBUG

/* ----------------
 *	EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the
 *	nest loop node by NL_printf() and ENL_printf() in nestloop.c
 * ----------------
 */
#undef EXEC_NESTLOOPDEBUG

/* ----------------
 *	EXEC_PROCDEBUG is a flag which turns on debugging of
 *	ExecProcNode() by PN_printf() in procnode.c
 * ----------------
 */
#undef EXEC_PROCDEBUG

/* ----------------
 *	EXEC_EVALDEBUG is a flag which turns on debugging of
 *	ExecEval and ExecTargetList() stuff by EV_printf() in qual.c
 * ----------------
 */
#undef EXEC_EVALDEBUG

/* ----------------
 *	EXEC_SCANDEBUG is a flag which turns on debugging of
 *	the ExecSeqScan() stuff by S_printf() in seqscan.c
 * ----------------
 */
#undef EXEC_SCANDEBUG

/* ----------------
 *	EXEC_SORTDEBUG is a flag which turns on debugging of
 *	the ExecSort() stuff by SO_printf() in sort.c
 * ----------------
 */
#undef EXEC_SORTDEBUG

/* ----------------
 *	EXEC_MERGEJOINDEBUG is a flag which turns on debugging of
 *	the ExecMergeJoin() stuff by MJ_printf() in mergejoin.c
 * ----------------
 */
#undef EXEC_MERGEJOINDEBUG

/* ----------------
 *	EXEC_MERGEJOINPFREE is a flag which causes merge joins
 *	to pfree intermittant tuples (which is the proper thing)
 *	Not defining this means we avoid menory management problems
 *	at the cost of doing deallocation of stuff only at the
 *	end of the transaction
 * ----------------
 */
#undef EXEC_MERGEJOINPFREE

/* ----------------
 *	EXEC_DEBUGINTERACTIVE is a flag which enables the
 *	user to issue "DEBUG" commands from an interactive
 *	backend. 
 * ----------------
 */
#undef EXEC_DEBUGINTERACTIVE

/* ----------------
 *	EXEC_DEBUGVARIABLEFILE is string, which if defined will
 *	be loaded when the executor is initialized.  If this
 *	string is not defined then nothing will be loaded..
 *
 *	Example:
 *
 * #define EXEC_DEBUGVARIABLEFILE "/a/postgres/cimarron/.pg_debugvars"
 #
 *	Note: since these variables are read at execution time,
 *	they can't affect the first query.. this hack should be
 *	replaced by something better sometime. -cim 11/2/89
 * ----------------
 */
#undef EXEC_DEBUGVARIABLEFILE

/* ----------------------------------------------------------------
 *	#defines controlled by above definitions
 *
 *	Note: most of these are "incomplete" because I didn't
 *	      need the ones not defined.  More should be added
 *	      only as necessary -cim 10/26/89
 * ----------------------------------------------------------------
 */
#define T_OR_F(b)  		(b ? "true" : "false")
#define NULL_OR_TUPLE(slot) 	(TupIsNull(slot) ? "null" : "a tuple")

/* ----------------
 *	tuple table debugging
 * ----------------
 */
#ifdef EXEC_DEBUGSTORETUP
#define ExecStoreTuple(tuple, slot, buffer, shouldFree) \
    ExecStoreTupleDebug(__FILE__, __LINE__, tuple, slot, buffer, shouldFree)
#endif EXEC_DEBUGSTORETUP

#define EXEC_TUPLECOUNT
/* ----------------
 *	tuple count debugging defines
 * ----------------
 */
#ifdef EXEC_TUPLECOUNT
extern int     NTupleProcessed;
extern int     NTupleRetrieved;
extern int     NTupleReplaced;
extern int     NTupleAppended;
extern int     NTupleDeleted;
extern int     NIndexTupleProcessed;
extern int     NIndexTupleInserted;

#define IncrRetrieved()		NTupleRetrieved++
#define	IncrAppended()		NTupleAppended++
#define	IncrDeleted()		NTupleDeleted++
#define	IncrReplaced()		NTupleReplaced++
#define	IncrInserted()		NTupleInserted++
#define IncrProcessed()		NTupleProcessed++
#define IncrIndexProcessed()	NIndexTupleProcessed++
#define IncrIndexInserted()	NIndexTupleInserted++
#else
#define IncrRetrieved()
#define	IncrAppended()
#define	IncrDeleted()
#define	IncrReplaced()
#define	IncrInserted()
#define IncrProcessed()
#define IncrIndexProcessed()
#define IncrIndexInserted()
#endif EXEC_TUPLECOUNT

/* ----------------
 *	memory context debugging defines
 * ----------------
 */
#ifdef EXEC_CONTEXTDEBUG
#define CXT_printf(s)			printf(s)
#define CXT1_printf(s, a)		printf(s, a)
#else
#define CXT_printf(s)		
#define CXT1_printf(s, a)		
#endif EXEC_CONTEXTDEBUG

/* ----------------
 *	memory allocation debugging defines
 * ----------------
 */
#ifdef EXEC_ALLOCDEBUG
#define ExecAlloc(routine, size) \
    ExecAllocDebug(routine, __FILE__, __LINE__, size)

#define ExecFree(routine, pointer) \
    ExecFreeDebug(routine, __FILE__, __LINE__, pointer)
#else
#define ExecAlloc(routine, size)	ExecAllocNormal(size)
#define ExecFree(routine, pointer)	ExecFreeNormal(pointer)
#endif EXEC_ALLOCDEBUG

/* ----------------
 *	eutils debugging defines
 * ----------------
 */
#ifdef EXEC_UTILSDEBUG
#define EU_lispDisplay(l)		lispDisplay(l, 0)
#define EU_printf(s)			printf(s)
#define EU1_printf(s, a)		printf(s, a)
#define EU4_printf(s, a, b, c, d)	printf(s, a, b, c, d)
#else
#define EU_lispDisplay(l)		
#define EU_printf(s)			
#define EU1_printf(s, a)		
#define EU4_printf(s, a, b, c, d)	
#endif EXEC_UTILSDEBUG


/* ----------------
 *	nest loop debugging defines
 * ----------------
 */
#ifdef EXEC_NESTLOOPDEBUG
#define NL_lispDisplay(l)		lispDisplay(l, 0)
#define NL_printf(s)			printf(s)
#define NL1_printf(s, a)		printf(s, a)
#define NL4_printf(s, a, b, c, d)	printf(s, a, b, c, d)
#define ENL1_printf(message)		printf("ExecNestLoop: %s\n", message)
#else
#define NL_lispDisplay(l)		
#define NL_printf(s)			
#define NL1_printf(s, a)		
#define NL4_printf(s, a, b, c, d)	
#define ENL1_printf(message)
#endif EXEC_NESTLOOPDEBUG

/* ----------------
 *	proc node debugging defines
 * ----------------
 */
#ifdef EXEC_PROCDEBUG
#define PN_printf(s)			printf(s)
#define PN1_printf(s, p)		printf(s, p)
#else
#define PN_printf(s)		
#define PN1_printf(s, p)	
#endif EXEC_PROCDEBUG

/* ----------------
 *	exec eval / target list debugging defines
 * ----------------
 */
#ifdef EXEC_EVALDEBUG
#define EV_lispDisplay(l)		lispDisplay(l, 0)
#define EV_printf(s)			printf(s)
#define EV1_printf(s, a)		printf(s, a)
#define EV5_printf(s, a, b, c, d, e)	printf(s, a, b, c, d, e)
#else
#define EV_lispDisplay(l)		
#define EV_printf(s)			
#define EV1_printf(s, a)		
#define EV5_printf(s, a, b, c, d, e)	
#endif EXEC_EVALDEBUG

/* ----------------
 *	scan debugging defines
 * ----------------
 */
#ifdef EXEC_SCANDEBUG
#define S_lispDisplay(l)		lispDisplay(l, 0)
#define S_printf(s)			printf(s)
#define S1_printf(s, p)			printf(s, p)
#else
#define S_lispDisplay(l)	
#define S_printf(s)		
#define S1_printf(s, p)		
#endif EXEC_SCANDEBUG
 
/* ----------------
 *	sort node debugging defines
 * ----------------
 */
#ifdef EXEC_SORTDEBUG
#define SO_lispDisplay(l)		lispDisplay(l, 0)
#define SO_printf(s)			printf(s)
#define SO1_printf(s, p)		printf(s, p)
#else
#define SO_lispDisplay(l)	
#define SO_printf(s)		
#define SO1_printf(s, p)		
#endif EXEC_SORTDEBUG

/* ----------------
 *	merge join debugging defines
 * ----------------
 */
#ifdef EXEC_MERGEJOINDEBUG
#define MJ_lispDisplay(l)		lispDisplay(l, 0)
#define MJ_printf(s)			printf(s)
#define MJ1_printf(s, p)		printf(s, p)
#define MJ2_printf(s, p1, p2)		printf(s, p1, p2)
#define MJ_debugtup(tuple, type)	debugtup(tuple, type)
#define MJ_dump(context, state)		ExecMergeTupleDump(econtext, state)
#define MJ_DEBUG_QUAL(clause, res) \
  MJ2_printf("  ExecQual(%s, econtext) returns %s\n", \
	     CppAsString(clause), T_OR_F(res));
	    
#define MJ_DEBUG_MERGE_COMPARE(qual, res) \
  MJ2_printf("  MergeCompare(mergeclauses, %s, ..) returns %s\n", \
	     CppAsString(qual), T_OR_F(res));

#define MJ_DEBUG_PROC_NODE(slot) \
  MJ2_printf("  %s = ExecProcNode(innerPlan) returns %s\n", \
	     CppAsString(slot), NULL_OR_TUPLE(slot));
#else
#define MJ_lispDisplay(l)
#define MJ_printf(s)		
#define MJ1_printf(s, p)		
#define MJ2_printf(s, p1, p2)
#define MJ_debugtup(tuple, type)
#define MJ_dump(context, state)
#define MJ_DEBUG_QUAL(clause, res)
#define MJ_DEBUG_MERGE_COMPARE(qual, res)
#define MJ_DEBUG_PROC_NODE(slot)
#endif EXEC_MERGEJOINDEBUG

/* ----------------------------------------------------------------
 *	DO NOT DEFINE THESE EVER OR YOU WILL BURN!
 * ----------------------------------------------------------------
 */
/* ----------------
 *	DOESNOTWORK is currently placed around memory manager
 *	code that is known to cause problems.  Code in between
 *	is likely not converted and probably won't work anyways.
 * ----------------
 */
#undef DOESNOTWORK

/* ----------------
 *	PERHAPSNEVER is placed around the "scan attribute"
 *	support code for the rule manager because for now we
 *	do things inefficiently.  The correct solution to our
 *	problem is to add code to the parser/planner to save
 *	attribute information for the rule manager rather than
 *	have the executor have to grope through the entire plan
 *	for it so if we ever decide to make things better,
 *	we should probably delete the stuff in between PERHAPSNEVER..
 * ----------------
 */
#undef PERHAPSNEVER

/* ----------------
 *	NOTYET is placed around any code not yet implemented
 *	in the executor.  Only remove these when actually implementing
 *	said code.
 * ----------------
 */
#undef NOTYET

extern int NDirectFileRead;
extern int NDirectFileWrite;

#endif  ExecDebugIncluded
@


1.10
log
@fixed some problems with buffer ref counts in the TupleTable stuff
@
text
@d8 1
a8 1
 *	$Header: RCS/execdebug.h,v 1.9 91/02/07 15:50:10 hong Exp Locker: cimarron $
d184 2
d352 1
d355 1
d358 11
d370 1
d373 1
d376 3
@


1.9
log
@introduce counters for direct file I/O's
@
text
@d8 1
a8 1
 *	$Header: RCS/execdebug.h,v 1.8 91/02/07 13:59:58 hong Exp Locker: hong $
d24 8
d184 9
@


1.8
log
@also keep track of number of index tuples inserted
@
text
@d8 1
a8 1
 *	$Header: RCS/execdebug.h,v 1.7 91/02/07 00:44:55 hong Exp $
d376 3
@


1.7
log
@new global variables and routines for various tuple counts
@
text
@d8 1
a8 1
 *	$Header: RCS/execdebug.h,v 1.6 90/03/15 10:05:09 cimarron Version_2 Locker: hong $
d189 1
d198 1
d207 1
@


1.6
log
@changed Increment stuff to be prettier.
,
@
text
@d8 1
a8 1
 *	$Header: RCS/execdebug.h,v 1.4 90/02/12 19:46:30 cimarron Exp $
d177 1
d183 14
a196 6
#define IncrRetrieved(x)	ExecIncrementRetrieved(x)
#define	IncrAppended(x)		ExecIncrementAppended(x)
#define	IncrDeleted(x)		ExecIncrementDeleted(x)
#define	IncrReplaced(x)		ExecIncrementReplaced(x)
#define	IncrInserted(x)		ExecIncrementInserted(x)
#define IncrProcessed(x)	ExecIncrementProcessed(x)
d198 7
a204 6
#define IncrRetrieved(x)
#define	IncrAppended(x)
#define	IncrDeleted(x)
#define	IncrReplaced(x)
#define	IncrInserted(x)
#define IncrProcessed(x)
@


1.5
log
@new debug definitions for buffer manager statistics
@
text
@d178 20
@


1.4
log
@*** empty log message ***
@
text
@d8 1
a8 1
 *	$Header: RCS/execdebug.h,v 1.1 89/11/02 18:06:07 cimarron Exp $
d31 1
a31 1
#define EXEC_TUPLECOUNT 1
d38 1
a38 1
#define EXEC_SHOWBUFSTATS 1
d46 1
a46 1
#define EXEC_ASSIGNDEBUGHOOKS 1
d97 1
a97 1
#define EXEC_NESTLOOPDEBUG 1
d132 1
a132 1
#define EXEC_MERGEJOINDEBUG 1
d150 1
a150 1
#define EXEC_DEBUGINTERACTIVE 1
d166 1
a166 1
#define EXEC_DEBUGVARIABLEFILE "/a/postgres/cimarron/.pg_debugvars"
@


1.3
log
@added some new execdebug macros
@
text
@d31 1
a31 1
#undef EXEC_TUPLECOUNT
d34 7
d46 1
a46 1
#undef EXEC_ASSIGNDEBUGHOOKS
d97 1
a97 1
#undef EXEC_NESTLOOPDEBUG
d132 1
a132 1
#undef EXEC_MERGEJOINDEBUG
d150 1
a150 1
#undef EXEC_DEBUGINTERACTIVE
d166 1
a166 1
#undef EXEC_DEBUGVARIABLEFILE
@


1.2
log
@added new  EXEC_DEBUGINTERACTIVE define
-cim
@
text
@d34 8
d87 1
a87 1
 *	nest loop node by NL_printf() in nestloop.c
d138 1
a138 1
 *	EXEC_INTERACTIVEDEBUG is a flag which enables the
d187 5
a191 2
#define ExecAlloc(routine, size)	ExecAllocDebug(routine, size)
#define ExecFree(routine, pointer)	ExecFreeDebug(routine, pointer)
d223 1
d229 1
@


1.1
log
@Initial revision
@
text
@d8 1
a8 1
 *	$Header$
d128 8
@
