On Tue, Sep 17, 2013 at 8:43 AM, Thom Brown <t...@linux.com> wrote:
> On 17 September 2013 14:37, Jaime Casanova <ja...@2ndquadrant.com> wrote:
>>
>> On Tue, Sep 17, 2013 at 3:30 AM, Thom Brown <t...@linux.com> wrote:
>> > On 17 September 2013 07:20, Jaime Casanova <ja...@2ndquadrant.com>
>> > wrote:
>> >>
>> >> On Mon, Sep 16, 2013 at 3:47 AM, Thom Brown <t...@linux.com> wrote:
>> >> > On 15 September 2013 01:14, Alvaro Herrera <alvhe...@2ndquadrant.com>
>> >> > wrote:
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> Here's a reviewable version of what I've dubbed Minmax indexes.
>> >> >>
>> >> > Thanks for the patch, but I seem to have immediately hit a snag:
>> >> >
>> >> > pgbench=# CREATE INDEX minmaxtest ON pgbench_accounts USING minmax
>> >> > (aid);
>> >> > PANIC:  invalid xlog record length 0
>> >> >
>> >>
>> >> fwiw, this seems to be triggered by ANALYZE.
>> >> At least i can trigger it by executing ANALYZE on the table (attached
>> >> is a stacktrace of a backend exhibiting the failure)
>> >>
>> >
>> > I'm able to run ANALYSE manually without it dying:
>> >
>>
>> try inserting some data before the ANALYZE, that will force a
>> resumarization which is mentioned in the stack trace of the failure
>
>
> I've tried inserting 1 row then ANALYSE and 10,000 rows then ANALYSE, and in
> both cases there's no error.  But then trying to create the index again
> results in my original error.
>

Ok

So, please confirm if this is the pattern you are following:

CREATE TABLE t1(i int);
INSERT INTO t1 SELECT generate_series(1, 10000);
CREATE INDEX idx1 ON t1 USING minmax (i);

if that, then the attached stack trace (index_failure_thom.txt) should
correspond to the failure you are looking.

My test was slightly different:

CREATE TABLE t1(i int);
CREATE INDEX idx1 ON t1 USING minmax (i);
INSERT INTO t1 SELECT generate_series(1, 10000);
ANALYZE t1;

and the failure happened in a different time, in resumarization
(attached index_failure_jcm.txt)

but in the end, both failures seems to happen for the same reason: a
record of length 0... at XLogInsert time

#4  XLogInsert at xlog.c:966
#5  mmSetHeapBlockItemptr at mmrevmap.c:169
#6  mm_doinsert at minmax.c:1410

actually, if you create a temp table both tests works fine

-- 
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitaciĆ³n
Phone: +593 4 5107566         Cell: +593 987171157
Program received signal SIGABRT, Aborted.
0x00007f4428819475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No existe el fichero o el 
directorio.
(gdb) bt
#0  0x00007f4428819475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007f442881c6f0 in *__GI_abort () at abort.c:92
#2  0x000000000076d6ac in errfinish (dummy=dummy@entry=0) at elog.c:546
#3  0x000000000076fdca in elog_finish (elevel=elevel@entry=22, 
fmt=fmt@entry=0x7d2aa7 "invalid xlog record length %u") at elog.c:1304
#4  0x00000000004e1eba in XLogInsert (rmid=rmid@entry=17 '\021', 
info=info@entry=48 '0', rdata=rdata@entry=0x7fffc836ea10) at xlog.c:966
#5  0x00000000004a9bb9 in mmSetHeapBlockItemptr 
(rmAccess=rmAccess@entry=0x1b3af38, heapBlk=heapBlk@entry=0, 
blkno=blkno@entry=6, offno=offno@entry=1)
    at mmrevmap.c:169
#6  0x00000000004a73e8 in mm_doinsert (idxrel=0x7f4429054c88, 
rmAccess=0x1b3af38, buffer=buffer@entry=0x7f441f7e718c, heapblkno=0, 
tup=tup@entry=0x7f441f84cff8, 
    itemsz=16) at minmax.c:1410
#7  0x00000000004a9464 in rerun_summarization (numnonsummarized=22, 
nonsummarized=0x1b3a408, rmAccess=0x1b3af38, heapRel=0x7f4429052e68, 
idxRel=0x7f4429054c88)
    at minmax.c:1205
#8  mmvacuumcleanup (fcinfo=<optimized out>) at minmax.c:1268
#9  0x000000000077388f in FunctionCall2Coll 
(flinfo=flinfo@entry=0x7fffc836f0a0, collation=collation@entry=0, 
arg1=arg1@entry=140736552432368, arg2=arg2@entry=0)
    at fmgr.c:1326
#10 0x00000000004a6c2d in index_vacuum_cleanup (info=info@entry=0x7fffc836f2f0, 
stats=stats@entry=0x0) at indexam.c:715
#11 0x00000000005570d1 in do_analyze_rel (onerel=onerel@entry=0x7f4429052e68, 
acquirefunc=0x556020 <acquire_sample_rows>, relpages=45, inh=inh@entry=0 
'\000', 
    elevel=elevel@entry=13, vacstmt=<error reading variable: Unhandled dwarf 
expression opcode 0xfa>, 
    vacstmt=<error reading variable: Unhandled dwarf expression opcode 0xfa>) 
at analyze.c:634
#12 0x0000000000557fef in analyze_rel (relid=relid@entry=16384, 
vacstmt=vacstmt@entry=0x1af5678, bstrategy=<optimized out>) at analyze.c:267
---Type <return> to continue, or q <return> to quit---
#13 0x00000000005aa224 in vacuum (vacstmt=vacstmt@entry=0x1af5678, 
relid=relid@entry=0, do_toast=do_toast@entry=1 '\001', bstrategy=<optimized 
out>, 
    bstrategy@entry=0x0, for_wraparound=for_wraparound@entry=0 '\000', 
isTopLevel=isTopLevel@entry=1 '\001') at vacuum.c:249
#14 0x000000000069f417 in standard_ProcessUtility (parsetree=0x1af5678, 
queryString=<optimized out>, context=<optimized out>, params=0x0, 
dest=<optimized out>, 
    completionTag=<optimized out>) at utility.c:682
#15 0x000000000069c587 in PortalRunUtility (portal=0x1b33198, 
utilityStmt=0x1af5678, isTopLevel=1 '\001', dest=0x1af5a00, 
completionTag=0x7fffc836f920 "")
    at pquery.c:1187
#16 0x000000000069d299 in PortalRunMulti (portal=portal@entry=0x1b33198, 
isTopLevel=isTopLevel@entry=1 '\001', dest=dest@entry=0x1af5a00, 
    altdest=altdest@entry=0x1af5a00, 
completionTag=completionTag@entry=0x7fffc836f920 "") at pquery.c:1318
#17 0x000000000069df32 in PortalRun (portal=portal@entry=0x1b33198, 
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=1 '\001', 
    dest=dest@entry=0x1af5a00, altdest=altdest@entry=0x1af5a00, 
completionTag=completionTag@entry=0x7fffc836f920 "") at pquery.c:816
#18 0x000000000069afdb in exec_simple_query (query_string=0x1af4c18 "analyze 
t1;") at postgres.c:1048
#19 PostgresMain (argc=<optimized out>, argv=argv@entry=0x1ab0a70, 
dbname=0x1ab08f0 "postgres", username=<optimized out>) at postgres.c:3992
#20 0x000000000046559e in BackendRun (port=0x1ab2770) at postmaster.c:4083
#21 BackendStartup (port=0x1ab2770) at postmaster.c:3772
#22 ServerLoop () at postmaster.c:1583
#23 0x000000000065230e in PostmasterMain (argc=argc@entry=3, 
argv=argv@entry=0x1a8df00) at postmaster.c:1239
#24 0x0000000000465ec5 in main (argc=3, argv=0x1a8df00) at main.c:196
(gdb) bt
#0  0x00007fa3d8f0b475 in *__GI_raise (sig=<optimized out>) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007fa3d8f0e6f0 in *__GI_abort () at abort.c:92
#2  0x000000000076d6ac in errfinish (dummy=dummy@entry=0) at elog.c:546
#3  0x000000000076fdca in elog_finish (elevel=elevel@entry=22, 
fmt=fmt@entry=0x7d2aa7 "invalid xlog record length %u") at elog.c:1304
#4  0x00000000004e1eba in XLogInsert (rmid=rmid@entry=17 '\021', 
info=info@entry=48 '0', rdata=rdata@entry=0x7ffff162fc40) at xlog.c:966
#5  0x00000000004a9bb9 in mmSetHeapBlockItemptr 
(rmAccess=rmAccess@entry=0x16729a0, heapBlk=heapBlk@entry=0, 
blkno=blkno@entry=1, offno=offno@entry=1)
    at mmrevmap.c:169
#6  0x00000000004a73e8 in mm_doinsert (idxrel=0x7fa3d974d7d8, 
rmAccess=0x16729a0, buffer=buffer@entry=0x1666754, heapblkno=0, 
tup=tup@entry=0x1672068, itemsz=16)
    at minmax.c:1410
#7  0x00000000004a7b85 in mmbuildCallback (index=index@entry=0x7fa3d974d7d8, 
htup=htup@entry=0x1671a40, values=values@entry=0x7ffff162fe30, 
    isnull=isnull@entry=0x7ffff162fe10 "", tupleIsAlive=tupleIsAlive@entry=1 
'\001', state=state@entry=0x1666748) at minmax.c:595
#8  0x00000000004f8216 in IndexBuildHeapRangeScan 
(heapRelation=heapRelation@entry=0x7fa3d974bc60, 
indexRelation=indexRelation@entry=0x7fa3d974d7d8, 
    indexInfo=indexInfo@entry=0x166eb08, allow_sync=allow_sync@entry=0 '\000', 
start_blockno=start_blockno@entry=0, numblocks=numblocks@entry=4294967295, 
    callback=callback@entry=0x4a78d0 <mmbuildCallback>, 
callback_state=callback_state@entry=0x1666748) at index.c:2497
#9  0x00000000004f860e in IndexBuildHeapScan 
(heapRelation=heapRelation@entry=0x7fa3d974bc60, 
indexRelation=indexRelation@entry=0x7fa3d974d7d8, 
    indexInfo=indexInfo@entry=0x166eb08, allow_sync=allow_sync@entry=0 '\000', 
callback=callback@entry=0x4a78d0 <mmbuildCallback>, 
    callback_state=callback_state@entry=0x1666748) at index.c:2119
#10 0x00000000004a89b5 in mmbuild (fcinfo=<optimized out>) at minmax.c:830
#11 0x0000000000774158 in OidFunctionCall3Coll 
(functionId=functionId@entry=3185, collation=collation@entry=0, 
arg1=arg1@entry=140341704703072, 
    arg2=arg2@entry=140341704710104, arg3=arg3@entry=23522056) at fmgr.c:1652
#12 0x00000000004f6966 in index_build 
(heapRelation=heapRelation@entry=0x7fa3d974bc60, 
indexRelation=indexRelation@entry=0x7fa3d974d7d8, 
    indexInfo=indexInfo@entry=0x166eb08, isprimary=isprimary@entry=0 '\000', 
isreindex=isreindex@entry=0 '\000') at index.c:1982
#13 0x00000000004f79e0 in index_create 
(heapRelation=heapRelation@entry=0x7fa3d974bc60, 
indexRelationName=indexRelationName@entry=0x1642fe0 "idx_t1_i", 
    indexRelationId=40963, indexRelationId@entry=0, relFileNode=0, 
indexInfo=indexInfo@entry=0x166eb08, 
indexColNames=indexColNames@entry=0x166e860, 
    accessMethodObjectId=accessMethodObjectId@entry=3847, 
tableSpaceId=tableSpaceId@entry=0, 
collationObjectId=collationObjectId@entry=0x1671e30, 
    classObjectId=classObjectId@entry=0x1671e50, 
coloptions=coloptions@entry=0x1671e70, reloptions=reloptions@entry=0, 
isprimary=0 '\000', isconstraint=0 '\000', 
    deferrable=0 '\000', initdeferred=0 '\000', allow_system_table_mods=0 
'\000', skip_build=0 '\000', concurrent=0 '\000', is_internal=0 '\000') at 
index.c:1081
#14 0x00000000005797af in DefineIndex (stmt=0x1642f48, 
indexRelationId=indexRelationId@entry=0, is_alter_table=is_alter_table@entry=0 
'\000', 
    check_rights=check_rights@entry=1 '\001', skip_build=skip_build@entry=0 
'\000', quiet=quiet@entry=0 '\000') at indexcmds.c:595
#15 0x000000000069fe38 in ProcessUtilitySlow 
(parsetree=parsetree@entry=0x15def28, queryString=0x15de378 "create index 
idx_t1_i on t1 using minmax(i);", 
    context=<optimized out>, params=params@entry=0x0, 
completionTag=0x7ffff1630e80 "", dest=<error reading variable: Unhandled dwarf 
expression opcode 0xfa>)
    at utility.c:1162
#16 0x000000000069f07c in standard_ProcessUtility (parsetree=0x15def28, 
queryString=<optimized out>, context=<optimized out>, params=0x0, 
dest=<optimized out>, 
    completionTag=<optimized out>) at utility.c:872
#17 0x000000000069c587 in PortalRunUtility (portal=0x16684e8, 
utilityStmt=0x15def28, isTopLevel=1 '\001', dest=0x15df310, 
completionTag=0x7ffff1630e80 "")
    at pquery.c:1187
#18 0x000000000069d299 in PortalRunMulti (portal=portal@entry=0x16684e8, 
isTopLevel=isTopLevel@entry=1 '\001', dest=dest@entry=0x15df310, 
    altdest=altdest@entry=0x15df310, 
completionTag=completionTag@entry=0x7ffff1630e80 "") at pquery.c:1318
#19 0x000000000069df32 in PortalRun (portal=portal@entry=0x16684e8, 
count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=1 '\001', 
    dest=dest@entry=0x15df310, altdest=altdest@entry=0x15df310, 
completionTag=completionTag@entry=0x7ffff1630e80 "") at pquery.c:816
#20 0x000000000069afdb in exec_simple_query (query_string=0x15de378 "create 
index idx_t1_i on t1 using minmax(i);") at postgres.c:1048
#21 PostgresMain (argc=<optimized out>, argv=argv@entry=0x15c6e08, 
dbname=0x15c6c68 "postgres", username=<optimized out>) at postgres.c:3992
#22 0x000000000046559e in BackendRun (port=0x15e5740) at postmaster.c:4083
#23 BackendStartup (port=0x15e5740) at postmaster.c:3772
#24 ServerLoop () at postmaster.c:1583
#25 0x000000000065230e in PostmasterMain (argc=argc@entry=3, 
argv=argv@entry=0x15c2ee0) at postmaster.c:1239
#26 0x0000000000465ec5 in main (argc=3, argv=0x15c2ee0) at main.c:196
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to