pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feed[DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
6+ messages / 4 participants
[nested] [flat]
* [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
@ 2002-09-23 17:46 Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-23 22:03 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. mallah@trade-india.com
2002-09-24 07:33 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-26 08:18 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
0 siblings, 3 replies; 6+ messages in thread
From: Rajesh Kumar Mallah. @ 2002-09-23 17:46 UTC (permalink / raw)
To: pgsql-admin; pgsql-replication@postgresql.org; +Cc: ssinger@navtechinc.com
Hi
Is anyone using dbmirror in production?
I Intend to replicate a set of tables between local and remote servers.
and plan to use dbmirror.
I observe that unless a table has a primary key the trigger recordchange()
which is supposed to be attached to a replicated table does not works properly
and causes postmaster to crash.
INSERT works but not update and deletes.
below is a debug outputing from pending.c
I am using 7.2.1 and DBmirror: $Id: pending.c,v 1.1 2002/06/23 21:58:08 momjian Exp $
Regds
Mallah.
tradein_clients=# CREATE TABLE test (a integer , b integer);
CREATE
tradein_clients=#
tradein_clients=#
tradein_clients=# CREATE TRIGGER "test_trig" AFTER INSERT OR DELETE OR UPDATE ON "test" FOR EACH ROW EXECUTE PROCEDURE "recordchange" ();
]CREATE
tradein_clients=#
tradein_clients=#
tradein_clients=# INSERT INTO test values(1,1);
NOTICE: row successfully stored in pending table
NOTICE: a
NOTICE: 1
NOTICE: Starting format loop
NOTICE: "a"='1'
NOTICE: b
NOTICE: 1
NOTICE: Starting format loop
NOTICE: "a"='1' "b"='1'
NOTICE: Returning
NOTICE: INSERT SUCCESFULL
NOTICE: DOne storing keyinfo
NOTICE: Returning on success
INSERT 183571162 1
tradein_clients=#
tradein_clients=#
tradein_clients=# INSERT INTO test values(1,3);
NOTICE: row successfully stored in pending table
NOTICE: a
NOTICE: 1
NOTICE: Starting format loop
NOTICE: "a"='1'
NOTICE: b
NOTICE: 3
NOTICE: Starting format loop
NOTICE: "a"='1' "b"='3'
NOTICE: Returning
NOTICE: INSERT SUCCESFULL
NOTICE: DOne storing keyinfo
NOTICE: Returning on success
INSERT 183571165 1
tradein_clients=# DELETE from test;
NOTICE: row successfully stored in pending table
NOTICE: Executing: SELECT indkey FROM pg_index WHERE indisprimary='t' AND indrelid=183571159
NOTICE: Could not select primary index key
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
2002-09-23 17:46 [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
@ 2002-09-23 22:03 ` mallah@trade-india.com
2 siblings, 0 replies; 6+ messages in thread
From: mallah@trade-india.com @ 2002-09-23 22:03 UTC (permalink / raw)
To: ssinger@navtechinc.com; +Cc: mallah@trade-india.com; pgsql-admin; pgsql-replication@postgresql.org
Hi Steven ,
thanks for the reply and letting me know that a primary key is
essential for the replicated tables.
For your information pending.c used to crash postmaster even
when it was not in debug mode. (it was only then i defined
DEBUG_OUTPUT to see whats going on).
Thanks for the patch. But what will it say when there is no
primary key in the table?
anyway i will apply the patch and let u know.
I am using dbmirror for asynchronous replication so speen of
replication is not important.
Regards
Mallah.
> On Mon, 23 Sep 2002, Rajesh Kumar Mallah. wrote:
>
>> Hi
>>
>> Is anyone using dbmirror in production?
>
> We've been using it in production for sometime now and haven't been having any problems with
> it.
>
>>
>> I Intend to replicate a set of tables between local and remote servers. and plan to use
>> dbmirror.
>>
>
> The speed of replicating edits over a WAN isn't that great.
> If you perform a lot of edits in a short period of time there could be a backlog.
>
>> I observe that unless a table has a primary key the trigger recordchange() which is supposed
>> to be attached to a replicated table does not works properly and causes postmaster to crash.
>>
>
> dbmirror requires that all tables that you replicate have primary keys
(This should be said > more explictly in the README)
>
> However it still should not crash(In defence it will only crash the postmaster when you
> compile dbmirror in debug mode).
>
> The attatched patch to pending.c should prevent it from crashing the postmaster. Let me know
> if it fixes the problem and I'll submit it to pgpatches.
>
>
> *** pending.c Mon Sep 23 20:24:04 2002
> --- /tmp/pending.c Mon Sep 23 20:23:43 2002
> ***************
> *** 226,232 ****
> /* pplan = SPI_saveplan(pplan); */
> cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData,
> PRIMARY);
> #if defined DEBUG_OUTPUT
> ! elog(NOTICE, cpKeyData);
> #endif
> saPlanData[0] = PointerGetDatum(cpKeyData);
>
> --- 226,235 ----
> /* pplan = SPI_saveplan(pplan); */
> cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData,
> PRIMARY);
> #if defined DEBUG_OUTPUT
> ! if(cpKeyData != NULL )
> ! {
> ! elog(NOTICE, cpKeyData);
> ! }
> #endif
> saPlanData[0] = PointerGetDatum(cpKeyData);
>
> --
> Steven Singer ssinger@navtechinc.com Aircraft Performance
> Systems Phone: 519-747-1170 ext 282 Navtech Systems Support Inc.
> AFTN: CYYZXNSX SITA: YYZNSCR Waterloo, Ontario ARINC: YKFNSCR
-----------------------------------------
Get your free web based email at trade-india.com.
"India's Leading B2B eMarketplace.!"
http://www.trade-india.com/
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
2002-09-23 17:46 [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
@ 2002-09-24 07:33 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-24 13:22 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Mark McEahern <marklists@mceahern.com>
2002-09-24 16:20 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 2 replies; 6+ messages in thread
From: Rajesh Kumar Mallah. @ 2002-09-24 07:33 UTC (permalink / raw)
To: Steven Singer <ssinger@navtechinc.com>; +Cc: pgsql-admin; pgsql-replication@postgresql.org
Hi can you help me with applying the patch
i dunno much abt patch
# patch -p0 < patch
patch: **** malformed patch at line 7: PRIMARY);
regds
mallah.
On Tuesday 24 September 2002 02:18, Steven Singer wrote:
> On Mon, 23 Sep 2002, Rajesh Kumar Mallah. wrote:
> > Hi
> >
> > Is anyone using dbmirror in production?
>
> We've been using it in production for sometime now and haven't been having
> any problems with it.
>
> > I Intend to replicate a set of tables between local and remote servers.
> > and plan to use dbmirror.
>
> The speed of replicating edits over a WAN isn't that great.
> If you perform a lot of edits in a short period of time there could be a
> backlog.
>
> > I observe that unless a table has a primary key the trigger
> > recordchange() which is supposed to be attached to a replicated table
> > does not works properly and causes postmaster to crash.
>
> dbmirror requires that all tables that you replicate have primary
> keys(This should be said more explictly in the README)
>
> However it still should not crash(In defence it will only crash the
> postmaster when you compile dbmirror in debug mode).
>
> The attatched patch to pending.c should prevent it from crashing the
> postmaster. Let me know if it fixes the problem and I'll submit it to
> pgpatches.
>
>
> *** pending.c Mon Sep 23 20:24:04 2002
> --- /tmp/pending.c Mon Sep 23 20:23:43 2002
> ***************
> *** 226,232 ****
> /* pplan = SPI_saveplan(pplan); */
> cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData,
> PRIMARY);
> #if defined DEBUG_OUTPUT
> ! elog(NOTICE, cpKeyData);
> #endif
> saPlanData[0] = PointerGetDatum(cpKeyData);
>
> --- 226,235 ----
> /* pplan = SPI_saveplan(pplan); */
> cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData,
> PRIMARY);
> #if defined DEBUG_OUTPUT
> ! if(cpKeyData != NULL )
> ! {
> ! elog(NOTICE, cpKeyData);
> ! }
> #endif
> saPlanData[0] = PointerGetDatum(cpKeyData);
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
2002-09-23 17:46 [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-24 07:33 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
@ 2002-09-24 13:22 ` Mark McEahern <marklists@mceahern.com>
1 sibling, 0 replies; 6+ messages in thread
From: Mark McEahern @ 2002-09-24 13:22 UTC (permalink / raw)
To: pgsql-admin; pgsql-replication@postgresql.org
[Rajesh Kumar Mallah]
> Hi can you help me with applying the patch
> i dunno much abt patch
>
> # patch -p0 < patch
> patch: **** malformed patch at line 7: PRIMARY);
It looks like a context patch. patch --help should tell you how to apply a
context patch. It will also tell you the basic syntax. Suppose I had a
patch in a file called foobar.patch. And the file I wanted to patch was
called foobar. I'd apply it like this:
patch foobar foobar.patch
Cheers,
// mark
-
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
2002-09-23 17:46 [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-24 07:33 ` Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
@ 2002-09-24 16:20 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 6+ messages in thread
From: Tom Lane @ 2002-09-24 16:20 UTC (permalink / raw)
To: Rajesh Kumar Mallah. <mallah@trade-india.com>; +Cc: Steven Singer <ssinger@navtechinc.com>; pgsql-admin; pgsql-replication@postgresql.org
"Rajesh Kumar Mallah." <mallah@trade-india.com> writes:
> # patch -p0 < patch
> patch: **** malformed patch at line 7: PRIMARY);
I think the patch got mucked up by line-wrapping, either in your mail
program or Steve's ...
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs.
2002-09-23 17:46 [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
@ 2002-09-26 08:18 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
2 siblings, 0 replies; 6+ messages in thread
From: Rajesh Kumar Mallah. @ 2002-09-26 08:18 UTC (permalink / raw)
To: Steven Singer <ssinger@navtechinc.com>; +Cc: pgsql-admin; pgsql-replication@postgresql.org
Hi Steven,
Your most recent version pending.c does not crashes
postmaster anymore when PRIMARY KEYS are missing.
Instead it raises notices and errors:
tradein_clients=> BEGIN work; UPDATE iid_listing set city='DELHI testing' where list_id=23312;
BEGIN
NOTICE: Could not select primary index key
NOTICE: Error obtaining primary key values
ERROR: Operation could not be mirrored
Regds
Mallah.
On Tuesday 24 September 2002 02:18, Steven Singer wrote:
> On Mon, 23 Sep 2002, Rajesh Kumar Mallah. wrote:
> > Hi
> >
> > Is anyone using dbmirror in production?
>
> We've been using it in production for sometime now and haven't been having
> any problems with it.
>
> > I Intend to replicate a set of tables between local and remote servers.
> > and plan to use dbmirror.
>
> The speed of replicating edits over a WAN isn't that great.
> If you perform a lot of edits in a short period of time there could be a
> backlog.
>
> > I observe that unless a table has a primary key the trigger
> > recordchange() which is supposed to be attached to a replicated table
> > does not works properly and causes postmaster to crash.
>
> dbmirror requires that all tables that you replicate have primary
> keys(This should be said more explictly in the README)
>
> However it still should not crash(In defence it will only crash the
> postmaster when you compile dbmirror in debug mode).
>
> The attatched patch to pending.c should prevent it from crashing the
> postmaster. Let me know if it fixes the problem and I'll submit it to
> pgpatches.
>
>
> *** pending.c Mon Sep 23 20:24:04 2002
> --- /tmp/pending.c Mon Sep 23 20:23:43 2002
> ***************
> *** 226,232 ****
> /* pplan = SPI_saveplan(pplan); */
> cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData,
> PRIMARY);
> #if defined DEBUG_OUTPUT
> ! elog(NOTICE, cpKeyData);
> #endif
> saPlanData[0] = PointerGetDatum(cpKeyData);
>
> --- 226,235 ----
> /* pplan = SPI_saveplan(pplan); */
> cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData,
> PRIMARY);
> #if defined DEBUG_OUTPUT
> ! if(cpKeyData != NULL )
> ! {
> ! elog(NOTICE, cpKeyData);
> ! }
> #endif
> saPlanData[0] = PointerGetDatum(cpKeyData);
--
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)
Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2002-09-26 08:18 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-23 17:46 [DBmirror Issue] recordchange() dies in packageData unless there is a PRIMARY KEY on DELETE and UPDATEs. Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-23 22:03 ` mallah@trade-india.com
2002-09-24 07:33 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
2002-09-24 13:22 ` Mark McEahern <marklists@mceahern.com>
2002-09-24 16:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-09-26 08:18 ` Rajesh Kumar Mallah. <mallah@trade-india.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox