From: | mchron(at)aueb(dot)gr |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | copying a bucket to a BufFile |
Date: | 2005-06-07 16:04:02 |
Message-ID: | courier.42A5C572.0000678A@red.servers.aueb.gr |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
hi,
I'm trying to copy the contents of a bucket of a hash table to a BufFile.
There is a memory context for each bucket. That is, there is an array
(#nbuckets) memory contexts.
thus the tree of mem cxts are
...
hashCxt
|
batchCxt
| |
| |
BucketCxt... BucketCxt ... (#nbuckets)
The server terminated abnormally here "->>> (1)" at the code below and I
can't understand why! Please if anyone has any idea what's wrong, i'd
appreciate any suggetion. Thanks is advance!! --martha
void ExecScanDPHashBucketCopyToFile(HashJoinTable hashTable,int noOfbucket)
{
HashJoinTuple hashTuple;
TupleTableSlot *slot;
// create temp files only if they already don't exist.
if(hashTable->outerBucketFile[noOfbucket] == NULL)
hashTable->BucketFile[noOfbucket] = BufFileCreateTemp(false);
hashTuple = hashTable->buckets[noOfbucket]; // first tuple in bucket
while(hashTuple != NULL)
{
HeapTuple heapTuple = &hashTuple->htup;
ExecHashJoinSaveTuple(heapTuple,
HashTable->BucketFile[noOfbucket]);
->>> (1)
// print the tuple we copy
slot = ExecStoreTuple(heapTuple,slot,InvalidBuffer,false);
if(!TupIsNull(slot))
print_slot(slot);
hashTuple = hashTuple->next;
}
// the bucket has copied. Rewind file to read it later.
if(BufFileSeek(hashtable->BucketFile[noOfbucket], 0, 0L, SEK_SET))
ereport(ERROR,(errcode_for_file_access(),
errmsq("could not rewind hash join emp file:%m")));
if(hashTable->bucketCxt[noOfbucket] != NULL) //if there is a context
allocated for this bucket.
MemoryContextReset(*(hashTable->bucketCxt[noOfbucket]));
hashTable->flushedBucket[noOfbucket] = true; // consider it flushed anyway
}
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-06-07 16:04:28 | Re: CPU-intensive autovacuuming |
Previous Message | Matthew T. O'Connor | 2005-06-07 16:00:54 | Re: CPU-intensive autovacuuming |