Re: 'COPY ... FROM' inserts to btree, blocks on buffer

From: Michael Wildpaner <mike(at)rainbow(dot)studorg(dot)tuwien(dot)ac(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: 'COPY ... FROM' inserts to btree, blocks on buffer
Date: 2005-01-01 00:48:53
Message-ID: Pine.LNX.4.58.0501010139560.13169@rainbow.studorg.tuwien.ac.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 31 Dec 2004, Tom Lane wrote:
> Michael Wildpaner <mike(at)rainbow(dot)studorg(dot)tuwien(dot)ac(dot)at> writes:
> > two concurrent clients try to 'COPY ... FROM ...' to the same table,
> > "feature_link".
>
> > The second one (pid 17983) is waiting for an ExclusiveLock on the table's
> > primary key index, "key__idpk__flink".
>
> You didn't show a stack trace for this one ...

Here it is:

[fuchs:/people/mike/build/postgresql-8.0.0beta2] gdb src/backend/postgres
[...]
(gdb) attach 17983
[...]
(gdb) where
#0 0x0000002a96181279 in semop () from /lib64/tls/libc.so.6
#1 0x0000000000511707 in PGSemaphoreLock (sema=0x2aa16d8f90, interruptOK=1 '\001') at pg_sema.c:418
#2 0x0000000000533e76 in ProcSleep (lockMethodTable=0x274801d, lockmode=7, lock=0x2aa1773878, proclock=0x2aa18ee398) at proc.c:725
#3 0x0000000000532a7c in WaitOnLock (lockmethodid=32797, locallock=0x894180, owner=0x975130) at lock.c:1037
#4 0x000000000053246f in LockAcquire (lockmethodid=1, locktag=0x1, xid=2710496152, lockmode=7, dontWait=0 '\0') at lock.c:754
#5 0x0000000000531aa3 in LockPage (relation=0x274801d, blkno=3220402448, lockmode=7) at lmgr.c:267
#6 0x000000000044a98d in _bt_getbuf (rel=0x2aa2466168, blkno=3220402448, access=2) at nbtpage.c:490
#7 0x0000000000448c87 in _bt_split (rel=0x2aa2466168, buf=16355, firstright=89, newitemoff=119, newitemsz=40, newitem=0x985828,
newitemonleft=0 '\0', itup_off=0x7fbff374c6, itup_blkno=0x7fbff374c8) at nbtinsert.c:683
#8 0x00000000004486ba in _bt_insertonpg (rel=0x2aa2466168, buf=16355, stack=0x9a2a70, keysz=1, scankey=0x984a60, btitem=0x985828,
afteritem=0, split_only_page=0 '\0') at nbtinsert.c:500
#9 0x00000000004481eb in _bt_doinsert (rel=0x2aa2466168, btitem=0x985828, index_is_unique=1 '\001', heapRel=0x2aa24656e8)
at nbtinsert.c:141
#10 0x000000000044bb71 in btinsert (fcinfo=0x274801d) at nbtree.c:257
#11 0x00000000005a44aa in OidFunctionCall6 (functionId=41189405, arg1=183111147880, arg2=548681250960, arg3=548681250928, arg4=10030788,
arg5=183111145192, arg6=18446744073709551612) at fmgr.c:1487
#12 0x00000000004476a5 in index_insert (indexRelation=0x2aa2466168, datums=0x7fbff37890, nulls=0x7fbff37870 " î", heap_t_ctid=0x990ec4,
heapRelation=0x2aa24656e8, check_uniqueness=1 '\001') at indexam.c:226
#13 0x00000000004cf3cf in ExecInsertIndexTuples (slot=0x0, tupleid=0x7fbff37110, estate=0x9828a0, is_vacuum=0 '\0') at execUtils.c:859
#14 0x000000000049c1d1 in CopyFrom (rel=0x2aa24656e8, attnumlist=0x9a25f0, binary=0 '\0', oids=0 '\0', delim=0x63e4cd "\t",
null_print=0x608614 "\\N", csv_mode=0 '\0', quote=0x0, escape=0x0, force_notnull_atts=0x9849d0) at copy.c:1958
#15 0x000000000049a34f in DoCopy (stmt=0x274801d) at copy.c:1043
#16 0x000000000053d7b9 in PortalRunUtility (portal=0x906b70, query=0x8fa620, dest=0x8fa940, completionTag=0x7fbff37f60 "") at pquery.c:839
#17 0x000000000053da41 in PortalRunMulti (portal=0x906b70, dest=0x8fa940, altdest=0x8fa940, completionTag=0x7fbff37f60 "") at pquery.c:902
#18 0x000000000053d230 in PortalRun (portal=0x906b70, count=9223372036854775807, dest=0x8fa940, altdest=0x8fa940,
completionTag=0x7fbff37f60 "") at pquery.c:543
#19 0x0000000000539c59 in exec_simple_query (
query_string=0x8fa730 "COPY feature_link from '/anniedev1/impseb/datastore/results/2004/12/29/22/38/bio:query:ncbi-blast:10562060.out_featurelink'") at postgres.c:924
#20 0x000000000053bf6d in PostgresMain (argc=9414448, argv=0x86f028, username=0x86eff0 "annieseb") at postgres.c:2970
#21 0x0000000000514db7 in BackendRun (port=0x89c650) at postmaster.c:2848
#22 0x0000000000514850 in BackendStartup (port=0x89c650) at postmaster.c:2470
#23 0x0000000000512fde in ServerLoop () at postmaster.c:1215
#24 0x0000000000512446 in PostmasterMain (argc=1, argv=0x804850) at postmaster.c:898
#25 0x00000000004e3206 in main (argc=1, argv=0x804850) at main.c:265

Happy new year! (nearly 2 AM MET here ;)
Best wishes, Mike

--
Do not feel safe. The poet remembers. DI Michael Wildpaner
You can kill one, but another is born. Ph.D. Student
The words are written down,
the deed, the date. (Czeslaw Milosz)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2005-01-01 01:03:59 Re: TODO item: make world safe for spaces in build/install
Previous Message Tom Lane 2005-01-01 00:42:20 Re: 'COPY ... FROM' inserts to btree, blocks on buffer writeout