Re: RULE regression test failure

Lists: pgsql-hackers
From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: RULE regression test failure
Date: 2002-08-30 02:01:53
Message-ID: GNELIHDDFBOCMGBFGEFOEEPFCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

With the recent talk of RULE regression failures, I thought I'd bring back
up that I _always_ have a rule failure on Freebsd/alpha.

The files are attached...

Chris

Attachment Content-Type Size
regression.diffs application/octet-stream 932 bytes
regression.out application/octet-stream 3.7 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 06:30:53
Message-ID: 27634.1030689053@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> With the recent talk of RULE regression failures, I thought I'd bring back
> up that I _always_ have a rule failure on Freebsd/alpha.

Hm, what do you get from
explain SELECT * FROM shoe_ready WHERE total_avail >= 2;
in the regression database?

regards, tom lane


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 06:32:55
Message-ID: GNELIHDDFBOCMGBFGEFOCEPICDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Ummmm...how do I make the regression database!? Do I have to do
installcheck instead of check?

Chris

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Friday, 30 August 2002 2:31 PM
> To: Christopher Kings-Lynne
> Cc: Hackers
> Subject: Re: [HACKERS] RULE regression test failure
>
>
> "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > With the recent talk of RULE regression failures, I thought I'd
> bring back
> > up that I _always_ have a rule failure on Freebsd/alpha.
>
> Hm, what do you get from
> explain SELECT * FROM shoe_ready WHERE total_avail >= 2;
> in the regression database?
>
> regards, tom lane
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 06:34:33
Message-ID: 27684.1030689273@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> Ummmm...how do I make the regression database!? Do I have to do
> installcheck instead of check?

That's the easiest way; or you can restart the temp postmaster that
the regression script starts and kills.

regards, tom lane


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 06:37:53
Message-ID: Pine.LNX.4.21.0208301637340.24582-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 30 Aug 2002, Christopher Kings-Lynne wrote:

> Ummmm...how do I make the regression database!? Do I have to do
> installcheck instead of check?

yes

Database is 'regression'

g


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Fulltextindex
Date: 2002-08-30 06:42:15
Message-ID: GNELIHDDFBOCMGBFGEFOGEPICDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

An aside.

In the fulltextindex code I'm trying to figure out what's breaking the
attached code segment.

Basically the data->vl_len line causes a segfault on the second time thru
the while loop. I can't figure it out. I can't write to the value, but
why? Basically with a word like 'john', it is inserting 'hn', then 'ohn'
and then 'john' into the database.

Thanks for any help for me getting this in for the beta!

Chris
-------------------------------------

struct varlena *data;
char *word = NULL;
char *cur_pos = NULL;
int cur_pos_length = 0;

data = (struct varlena *) palloc(column_length);

while(cur_pos > word)
{
cur_pos_length = strlen(cur_pos);
/* Line below causes seg fault on SECOND iteration */
data->vl_len = cur_pos_length + sizeof(int32);
memcpy(VARDATA(data), cur_pos, cur_pos_length);
values[0] = PointerGetDatum(data);
values[1] = 0;
values[2] = oid;

ret = SPI_execp(*(plan->splan), values, NULL, 0);
if(ret != SPI_OK_INSERT)
elog(ERROR, "Full Text Indexing: error executing plan in insert\n");

cur_pos--;
}


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 06:52:16
Message-ID: GNELIHDDFBOCMGBFGEFOCEPJCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Attached.

Chris

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Friday, 30 August 2002 2:31 PM
> To: Christopher Kings-Lynne
> Cc: Hackers
> Subject: Re: [HACKERS] RULE regression test failure
>
>
> "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > With the recent talk of RULE regression failures, I thought I'd
> bring back
> > up that I _always_ have a rule failure on Freebsd/alpha.
>
> Hm, what do you get from
> explain SELECT * FROM shoe_ready WHERE total_avail >= 2;
> in the regression database?
>
> regards, tom lane
>

Attachment Content-Type Size
tom.txt text/plain 1.9 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fulltextindex
Date: 2002-08-30 06:53:11
Message-ID: 27847.1030690391@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> struct varlena *data;
> char *word = NULL;
> char *cur_pos = NULL;
> int cur_pos_length = 0;

> data = (struct varlena *) palloc(column_length);

> while(cur_pos > word)
> {
> cur_pos_length = strlen(cur_pos);
> /* Line below causes seg fault on SECOND iteration */

You are not telling the whole truth here, as the above code excerpt
will obviously never iterate the WHILE even once. "NULL > NULL" is
false in every C I ever heard of.

Also, how much is column_length and how does it relate to the amount
of data being copied into *data ?

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 07:00:52
Message-ID: 27907.1030690852@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> Hm, what do you get from
>> explain SELECT * FROM shoe_ready WHERE total_avail >= 2;
>> in the regression database?
>
> [this plan]

That seems substantially the same plan as I see here. I guess
that the different output order must reflect a platform-specific
difference in qsort()'s treatment of equal keys.

Probably the best answer is to add "ORDER BY shoename" to the test
query to eliminate the platform dependency. Any objections out there?

regards, tom lane


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-08-30 07:02:59
Message-ID: GNELIHDDFBOCMGBFGEFOIEPJCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> That seems substantially the same plan as I see here. I guess
> that the different output order must reflect a platform-specific
> difference in qsort()'s treatment of equal keys.
>
> Probably the best answer is to add "ORDER BY shoename" to the test
> query to eliminate the platform dependency. Any objections out there?

None here.

Chris


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fulltextindex
Date: 2002-08-30 07:08:54
Message-ID: GNELIHDDFBOCMGBFGEFOMEPJCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

OK, I was probably a little aggressive in my pruning...BTW, this code was
not written by me...

--------------------------------

struct varlena *data;
char *word = "john";
char *cur_pos = NULL;
int cur_pos_length = 0;

data = (struct varlena *) palloc(VARHDRSZ + column_length + 1);
word_length = strlen(word);
cur_pos = &word[word_length - 2];

while(cur_pos > word)
{
cur_pos_length = strlen(cur_pos);
/* Line below causes seg fault on SECOND iteration */
data->vl_len = cur_pos_length + sizeof(int32);
memcpy(VARDATA(data), cur_pos, cur_pos_length);
values[0] = PointerGetDatum(data);
values[1] = 0;
values[2] = oid;

ret = SPI_execp(*(plan->splan), values, NULL, 0);
if(ret != SPI_OK_INSERT)
elog(ERROR, "Full Text Indexing: error executing plan in insert\n");

cur_pos--;
}

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Friday, 30 August 2002 2:53 PM
> To: Christopher Kings-Lynne
> Cc: Hackers
> Subject: Re: Fulltextindex
>
>
> "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> > struct varlena *data;
> > char *word = NULL;
> > char *cur_pos = NULL;
> > int cur_pos_length = 0;
>
> > data = (struct varlena *) palloc(column_length);
>
> > while(cur_pos > word)
> > {
> > cur_pos_length = strlen(cur_pos);
> > /* Line below causes seg fault on SECOND iteration */
>
> You are not telling the whole truth here, as the above code excerpt
> will obviously never iterate the WHILE even once. "NULL > NULL" is
> false in every C I ever heard of.
>
> Also, how much is column_length and how does it relate to the amount
> of data being copied into *data ?
>
> regards, tom lane
>


From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fulltextindex
Date: 2002-08-30 11:22:01
Message-ID: Pine.LNX.4.21.0208301209370.667-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Fri, 30 Aug 2002, Christopher Kings-Lynne wrote:
>
> --------------------------------
>
> struct varlena *data;
> char *word = "john";
> char *cur_pos = NULL;
> int cur_pos_length = 0;
>
> data = (struct varlena *) palloc(VARHDRSZ + column_length + 1);
> word_length = strlen(word);
> cur_pos = &word[word_length - 2];
>
> while(cur_pos > word)
> {
> cur_pos_length = strlen(cur_pos);
> /* Line below causes seg fault on SECOND iteration */
> data->vl_len = cur_pos_length + sizeof(int32);
> memcpy(VARDATA(data), cur_pos, cur_pos_length);
> values[0] = PointerGetDatum(data);
> values[1] = 0;
> values[2] = oid;
>
> ret = SPI_execp(*(plan->splan), values, NULL, 0);
> if(ret != SPI_OK_INSERT)
> elog(ERROR, "Full Text Indexing: error executing plan in insert\n");
>
> cur_pos--;
> }
>

That would imply the SPI_execp call is trashing the value of data. Have you
confirmed that? (Sometimes it helps to confirm exactly where a pointer is
getting hammered.)

column_length is something sensible like word_length I presume.

That sizeof(int32) should really be VARHDRSZ imo, but I can't see how that's
breaking it.

Disclaimer: I have no idea what I'm doing here.

--
Nigel J. Andrews


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fulltextindex
Date: 2002-08-30 13:44:03
Message-ID: 29881.1030715043@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> struct varlena *data;
> char *word = "john";
> char *cur_pos = NULL;
> int cur_pos_length = 0;

> data = (struct varlena *) palloc(VARHDRSZ + column_length + 1);
> word_length = strlen(word);
> cur_pos = &word[word_length - 2];

> while(cur_pos > word)
> {
> cur_pos_length = strlen(cur_pos);
> /* Line below causes seg fault on SECOND iteration */
> data->vl_len = cur_pos_length + sizeof(int32);
> memcpy(VARDATA(data), cur_pos, cur_pos_length);
> values[0] = PointerGetDatum(data);
> values[1] = 0;
> values[2] = oid;

> ret = SPI_execp(*(plan->splan), values, NULL, 0);
> if(ret != SPI_OK_INSERT)
> elog(ERROR, "Full Text Indexing: error executing plan in insert\n");

> cur_pos--;
> }

Are you sure it's actually segfaulting *at* the store into data->vl_len?
This seems hard to believe, if data is a local variable. It seems
possible that the storage data is pointing to gets freed during
SPI_execp, but that would just mean you'd be scribbling on memory that
doesn't belong to you --- which might cause a crash later, but surely
not at that line.

It would be worth looking to see which context is active when you do the
palloc() for data, and then watch to see if anything does a
MemoryContextReset on it. (If you are running with asserts enabled,
an even simpler test is to look and see if data->vl_len gets changed
underneath you.)

Also, I'm still wondering if column_length is guaranteed to be longer
than word_length.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-09-02 05:20:59
Message-ID: 200209020520.g825Kx710663@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


OK, patch attached that adds ORDER BY to the problem regression query.

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:
> > That seems substantially the same plan as I see here. I guess
> > that the different output order must reflect a platform-specific
> > difference in qsort()'s treatment of equal keys.
> >
> > Probably the best answer is to add "ORDER BY shoename" to the test
> > query to eliminate the platform dependency. Any objections out there?
>
> None here.
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.9 KB

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RULE regression test failure
Date: 2002-09-02 06:20:59
Message-ID: GNELIHDDFBOCMGBFGEFOMEPOCDAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

All regression tests now pass perfectly for me. Thanks.

Chris

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Bruce Momjian
> Sent: Monday, 2 September 2002 1:21 PM
> To: Christopher Kings-Lynne
> Cc: Tom Lane; Hackers
> Subject: Re: [HACKERS] RULE regression test failure
>
>
>
> OK, patch attached that adds ORDER BY to the problem regression query.
>
> ------------------------------------------------------------------
> ---------
>
> Christopher Kings-Lynne wrote:
> > > That seems substantially the same plan as I see here. I guess
> > > that the different output order must reflect a platform-specific
> > > difference in qsort()'s treatment of equal keys.
> > >
> > > Probably the best answer is to add "ORDER BY shoename" to the test
> > > query to eliminate the platform dependency. Any objections out there?
> >
> > None here.
> >
> > Chris
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square,
> Pennsylvania 19073
>