problem inserting tuples with access methods

From: Alice Lottini <alice_lottini(at)yahoo(dot)it>
To: PostgreSQL Mailing List Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: problem inserting tuples with access methods
Date: 2003-05-23 11:42:53
Message-ID: 20030523114253.61857.qmail@web13701.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi everybody,
we wrote a dynamically loaded function using the
Access Methods but we have a problem we don't know how
to tackle.
Our function reads data from an existing table (with a
simple table scan) and, for each tuple, it performs
several recursive (and memory-intensive) operations
producing quite a huge amount of results, which are
then stored on two existing heap tables. Each time a
result is produced it is immediately stored so as to
free as much memory as possible.
The storage of the resulting tuples is done through a
call to simple_heap_insert.

Here you have the routine handling the insertion and,
following, the error which occurs at its execution.

It should be an XLog error, but what is the reason?
Could the XLog file be too large to be handled?

We're sorry to bother you but we really can't solve
this problem by ourselves :(

Thanks a lot for your help!!

alice and lorena

**** Insertion Code ****

tidset++;

/* first table storage code */

tupdesc=CreateTupleDescCopy(RelationGetDescr(itemset_rel));
nattrs=tupdesc->natts;
values=(Datum *)palloc(nattrs*sizeof(*values));
nulls=(char *)palloc(nattrs*sizeof(*nulls));
memset(values,0,nattrs*sizeof(*values));
for(i=0;i<nattrs;i++)
nulls[i]=' ';

values[0]=UInt32GetDatum(tidset);
item=condition->head;
while(item!=NULL)
{
values[1]=UInt32GetDatum(item->item_id);
htup=heap_formtuple(tupdesc,values,nulls);
simple_heap_insert(itemset_rel,htup);
CommandCounterIncrement();
heap_freetuple(htup);
item=item->next;
}
pfree(values);
pfree(nulls);

/* second table storage code */

tupdesc=CreateTupleDescCopy(RelationGetDescr(setsupp_rel));

nattrs=tupdesc->natts;
values=(Datum *)palloc(nattrs*sizeof(*values));
nulls=(char *)palloc(nattrs*sizeof(*nulls));
memset(values,0,nattrs*sizeof(*values));
memset(nulls,0,nattrs*sizeof(*nulls));

for(i=0;i<nattrs;i++)
nulls[i]=' ';

values[0]=UInt32GetDatum(tidset);
values[1]=UInt32GetDatum(condition->supp);

htup=heap_formtuple(tupdesc,values,nulls);
simple_heap_insert(setsupp_rel,htup);
CommandCounterIncrement();
heap_freetuple(htup);

pfree(values);
pfree(nulls);

....

**** Error recorded in /home/postgres/logfile ****

SupporLOG: server process (pid 1581) was terminated
by signal 11
LOG: terminating any other active server processes
LOG: all server processes terminated; reinitializing
shared memory and semaphores
LOG: database system was interrupted at 2003-05-23
12:25:37 CEST
LOG: checkpoint record is at 0/1C7E125C
LOG: redo record is at 0/1C7E125C; undo record is at
0/0; shutdown FALSE
LOG: next transaction id: 5791; next oid: 2616805
LOG: database system was not properly shut down;
automatic recovery in progress
FATAL: The database system is starting up
LOG: redo starts at 0/1C7E129C
LOG: ReadRecord: invalid magic number 0000 in log
file 0, segment 28, offset 8495104
LOG: redo done at 0/1C819F90
LOG: database system is ready

______________________________________________________________________
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro Anti-spam
http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-05-23 13:08:38 Re: Text format protocol representation
Previous Message Manfred Koizar 2003-05-23 10:17:21 Re: Static snapshot data