From: | Leonardo F <m_lists(at)yahoo(dot)it> |
---|---|
To: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: I: About "Our CLUSTER implementation is pessimal" patch |
Date: | 2010-02-10 13:24:33 |
Message-ID: | 125102.34436.qm@web29016.mail.ird.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I think you're confusing HeapTuple and HeapTupleHeader. SortTuple->tuple
> field should point to a HeapTupleHeader, not a HeapTuple.
Mmh, I don't get it: that would mean I might be using more info than required,
but I still don't understand why it's not working... at the end, CLUSTER is going
to need full HeapTuple(s) (if I'm not mistaken).
SortTuple->tuple can be any of MinimalTuple, IndexTuple, even a Datum.
So I added my own read/write_rawtuple (I'm not that good, they were in the
original patch and I copy&pasted them).
I can write and read those tuples (using some Asserts I think everything goes
as expected in write/readtup_rawheap). But when calling tuplesort_getrawtuple,
after some "right" tuples, the call to tuplesort_gettuple_common fails because
the lines:
/* pull next preread tuple from list, insert in heap */
newtup = &state->memtuples[tupIndex];
give a wrong initialized "newtup" (in other words, newtup is random memory).
Since write/readtup_rawheap seems fine, I can't understand what's going on...
I write the HeapTuples with:
(in writetup_rawheap):
HeapTuple tuple = (HeapTuple) stup->tuple;
tuple->t_len += HEAPTUPLESIZE; /* write out the header as well */
LogicalTapeWrite(state->tapeset, tapenum,
tuple, HEAPTUPLESIZE);
LogicalTapeWrite(state->tapeset, tapenum, tuple->t_data,
tuple->t_len-HEAPTUPLESIZE);
then I read them with:
(in readtup_rawheap):
HeapTuple tuple = (HeapTuple) palloc(tuplen);
USEMEM(state, GetMemoryChunkSpace(tuple));
tuple->t_len = tuplen - HEAPTUPLESIZE;
if (LogicalTapeRead(state->tapeset, tapenum, &tuple->t_self,
HEAPTUPLESIZE-sizeof(tuplen)) != HEAPTUPLESIZE-sizeof(tuplen))
elog(ERROR, "unexpected end of data");
if (LogicalTapeRead(state->tapeset, tapenum, tuple->t_data, tuple->t_len) != tuple->t_len)
elog(ERROR, "unexpected end of data");
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-02-10 13:26:45 | Re: Some belated patch review for "Buffers" explain analyze patch |
Previous Message | Heikki Linnakangas | 2010-02-10 12:48:00 | Re: I: About "Our CLUSTER implementation is pessimal" patch |