Reversed out Massimo patch.
This commit is contained in:
parent
603e153bb8
commit
0c3281ce7c
|
@ -8,7 +8,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.52 1999/06/12 14:05:36 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.53 1999/06/12 14:07:20 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* The old interface functions have been converted to macros
|
* The old interface functions have been converted to macros
|
||||||
|
@ -27,11 +27,6 @@
|
||||||
#include <storage/bufpage.h>
|
#include <storage/bufpage.h>
|
||||||
#include <utils/memutils.h>
|
#include <utils/memutils.h>
|
||||||
|
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
#include <utils/portal.h>
|
|
||||||
#include <utils/trace.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_MEMMOVE
|
#ifndef HAVE_MEMMOVE
|
||||||
#include <regex/utils.h>
|
#include <regex/utils.h>
|
||||||
#else
|
#else
|
||||||
|
@ -98,9 +93,6 @@ DataFill(char *data,
|
||||||
int i;
|
int i;
|
||||||
int numberOfAttributes = tupleDesc->natts;
|
int numberOfAttributes = tupleDesc->natts;
|
||||||
Form_pg_attribute *att = tupleDesc->attrs;
|
Form_pg_attribute *att = tupleDesc->attrs;
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
bool free_tuple_memory = pg_options[OPT_FREE_TUPLE_MEMORY];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (bit != NULL)
|
if (bit != NULL)
|
||||||
{
|
{
|
||||||
|
@ -139,14 +131,6 @@ DataFill(char *data,
|
||||||
*infomask |= HEAP_HASVARLENA;
|
*infomask |= HEAP_HASVARLENA;
|
||||||
data_length = VARSIZE(DatumGetPointer(value[i]));
|
data_length = VARSIZE(DatumGetPointer(value[i]));
|
||||||
memmove(data, DatumGetPointer(value[i]), data_length);
|
memmove(data, DatumGetPointer(value[i]), data_length);
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
/* try to pfree value[i] - dz */
|
|
||||||
if (free_tuple_memory &&
|
|
||||||
PortalHeapMemoryIsValid(CurrentMemoryContext,
|
|
||||||
(Pointer) value[i])) {
|
|
||||||
pfree(value[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case sizeof(char):
|
case sizeof(char):
|
||||||
*data = att[i]->attbyval ?
|
*data = att[i]->attbyval ?
|
||||||
|
@ -163,15 +147,8 @@ DataFill(char *data,
|
||||||
*((int32 *) value[i]));
|
*((int32 *) value[i]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
memmove(data, DatumGetPointer(value[i]), att[i]->attlen);
|
memmove(data, DatumGetPointer(value[i]),
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
att[i]->attlen);
|
||||||
/* try to pfree value[i] - dz */
|
|
||||||
if (free_tuple_memory &&
|
|
||||||
PortalHeapMemoryIsValid(CurrentMemoryContext,
|
|
||||||
(Pointer) value[i])) {
|
|
||||||
pfree(value[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data = (char *) att_addlength((long) data, att[i]->attlen, value[i]);
|
data = (char *) att_addlength((long) data, att[i]->attlen, value[i]);
|
||||||
|
|
|
@ -31,11 +31,6 @@
|
||||||
#include "utils/syscache.h"
|
#include "utils/syscache.h"
|
||||||
#include "optimizer/clauses.h"
|
#include "optimizer/clauses.h"
|
||||||
|
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
#include <utils/portal.h>
|
|
||||||
#include <utils/trace.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AggFuncInfo -
|
* AggFuncInfo -
|
||||||
* keeps the transition functions information around
|
* keeps the transition functions information around
|
||||||
|
@ -118,9 +113,7 @@ ExecAgg(Agg *node)
|
||||||
isNull1 = FALSE,
|
isNull1 = FALSE,
|
||||||
isNull2 = FALSE;
|
isNull2 = FALSE;
|
||||||
bool qual_result;
|
bool qual_result;
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
bool free_tuple_memory = pg_options[OPT_FREE_TUPLE_MEMORY];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ---------------------
|
/* ---------------------
|
||||||
* get state info from node
|
* get state info from node
|
||||||
|
@ -248,10 +241,6 @@ ExecAgg(Agg *node)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
TupleTableSlot *outerslot;
|
TupleTableSlot *outerslot;
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
Oid valueType;
|
|
||||||
bool isByValue = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
isNull = isNull1 = isNull2 = 0;
|
isNull = isNull1 = isNull2 = 0;
|
||||||
outerslot = ExecProcNode(outerPlan, (Plan *) node);
|
outerslot = ExecProcNode(outerPlan, (Plan *) node);
|
||||||
|
@ -304,31 +293,6 @@ ExecAgg(Agg *node)
|
||||||
newVal = ExecEvalExpr(aggref->target, econtext,
|
newVal = ExecEvalExpr(aggref->target, econtext,
|
||||||
&isNull, &isDone);
|
&isNull, &isDone);
|
||||||
}
|
}
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
if (free_tuple_memory) {
|
|
||||||
switch (nodeTag(aggref->target)) {
|
|
||||||
case T_Const:
|
|
||||||
isByValue = ((Const*) (aggref->target))->constbyval;
|
|
||||||
break;
|
|
||||||
case T_Var:
|
|
||||||
valueType = ((Var*) (aggref->target))->vartype;
|
|
||||||
isByValue = typeByVal(typeidType(valueType));
|
|
||||||
break;
|
|
||||||
case T_Array:
|
|
||||||
isByValue = ((Array*)(aggref->target))->arrayelembyval;
|
|
||||||
break;
|
|
||||||
case T_ArrayRef:
|
|
||||||
isByValue =((ArrayRef*)(aggref->target))->refelembyval;
|
|
||||||
break;
|
|
||||||
case T_Expr:
|
|
||||||
valueType = ((Expr*) (aggref->target))->typeOid;
|
|
||||||
isByValue = typeByVal(typeidType(valueType));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (isNull && !aggref->usenulls)
|
if (isNull && !aggref->usenulls)
|
||||||
continue; /* ignore this tuple for this agg */
|
continue; /* ignore this tuple for this agg */
|
||||||
|
@ -389,16 +353,6 @@ ExecAgg(Agg *node)
|
||||||
(FmgrValues *) args, &isNull2);
|
(FmgrValues *) args, &isNull2);
|
||||||
Assert(!isNull2);
|
Assert(!isNull2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
/* try to pfree newVal if not isByValue - dz */
|
|
||||||
if (free_tuple_memory && !isByValue &&
|
|
||||||
PortalHeapMemoryIsValid(CurrentMemoryContext,
|
|
||||||
(Pointer) newVal))
|
|
||||||
{
|
|
||||||
pfree(newVal);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -73,9 +73,6 @@ static char *opt_names[] = {
|
||||||
"syslog", /* use syslog for error messages */
|
"syslog", /* use syslog for error messages */
|
||||||
"hostlookup", /* enable hostname lookup in ps_status */
|
"hostlookup", /* enable hostname lookup in ps_status */
|
||||||
"showportnumber", /* show port number in ps_status */
|
"showportnumber", /* show port number in ps_status */
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
"free_tuple_memory", /* try to pfree memory for each tuple */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NUM_PG_OPTIONS */ /* must be the last item of enum */
|
/* NUM_PG_OPTIONS */ /* must be the last item of enum */
|
||||||
};
|
};
|
||||||
|
@ -407,9 +404,9 @@ read_pg_options(SIGNAL_ARGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local Variables:
|
* Local variables:
|
||||||
* tab-width: 4
|
* tab-width: 4
|
||||||
* c-indent-level: 4
|
* c-indent-level: 4
|
||||||
* c-basic-offset: 4
|
* c-basic-offset: 4
|
||||||
* End:
|
* End:
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.20 1999/06/12 14:05:39 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.21 1999/06/12 14:07:26 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -289,24 +289,6 @@ PortalHeapMemoryFree(PortalHeapMemory this,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
/*
|
|
||||||
* PortalHeapMemoryIsValid --
|
|
||||||
*
|
|
||||||
* Check if a pointer is allocated in a memory context.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
PortalHeapMemoryIsValid(MemoryContext context, Pointer pointer)
|
|
||||||
{
|
|
||||||
HeapMemoryBlock block = HEAPMEMBLOCK((PortalHeapMemory) context);
|
|
||||||
|
|
||||||
AssertState(PointerIsValid(block));
|
|
||||||
|
|
||||||
return (AllocSetContains(&block->setData, pointer));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* PortalHeapMemoryRealloc
|
* PortalHeapMemoryRealloc
|
||||||
* ----------------
|
* ----------------
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: portal.h,v 1.14 1999/06/12 14:05:40 momjian Exp $
|
* $Id: portal.h,v 1.15 1999/06/12 14:07:32 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -80,10 +80,6 @@ extern void EndPortalAllocMode(void);
|
||||||
extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
|
extern PortalVariableMemory PortalGetVariableMemory(Portal portal);
|
||||||
extern PortalHeapMemory PortalGetHeapMemory(Portal portal);
|
extern PortalHeapMemory PortalGetHeapMemory(Portal portal);
|
||||||
|
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
bool PortalHeapMemoryIsValid(MemoryContext context, Pointer pointer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* estimate of the maximum number of open portals a user would have,
|
/* estimate of the maximum number of open portals a user would have,
|
||||||
* used in initially sizing the PortalHashTable in EnablePortalManager()
|
* used in initially sizing the PortalHashTable in EnablePortalManager()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -64,9 +64,6 @@ enum pg_option_enum {
|
||||||
OPT_SYSLOG, /* use syslog for error messages */
|
OPT_SYSLOG, /* use syslog for error messages */
|
||||||
OPT_HOSTLOOKUP, /* enable hostname lookup in ps_status */
|
OPT_HOSTLOOKUP, /* enable hostname lookup in ps_status */
|
||||||
OPT_SHOWPORTNUMBER, /* show port number in ps_status */
|
OPT_SHOWPORTNUMBER, /* show port number in ps_status */
|
||||||
#ifdef FREE_TUPLE_MEMORY
|
|
||||||
OPT_FREE_TUPLE_MEMORY, /* try to pfree memory for each tuple */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NUM_PG_OPTIONS /* must be the last item of enum */
|
NUM_PG_OPTIONS /* must be the last item of enum */
|
||||||
};
|
};
|
||||||
|
@ -86,9 +83,9 @@ extern int pg_options[NUM_PG_OPTIONS];
|
||||||
#endif /* TRACE_H */
|
#endif /* TRACE_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local Variables:
|
* Local variables:
|
||||||
* tab-width: 4
|
* tab-width: 4
|
||||||
* c-indent-level: 4
|
* c-indent-level: 4
|
||||||
* c-basic-offset: 4
|
* c-basic-offset: 4
|
||||||
* End:
|
* End:
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue