On Wed, Apr 20, 2011 at 9:57 AM, Noah Misch <[email protected]> wrote:
> On Tue, Apr 19, 2011 at 10:36:14PM -0400, Robert Haas wrote:
>> On Mon, Apr 18, 2011 at 7:50 PM, Noah Misch <[email protected]> wrote:
>> > On Fri, Apr 15, 2011 at 11:58:30AM -0400, Noah Misch wrote:
>> >> When we're done with the relkind-restriction patch, I'll post a new
>> >> version of
>> >> this one. ?It will remove the circularity check and add a relkind check.
>> >
>> > Here it is. ?Changes from tt1v1-alter-of.patch to tt1v2-alter-of.patch:
>> > * Use transformOfType()'s relkind check in ATExecAddOf()
>> > * Remove circularity check
>> > * Open pg_inherits with AccessShareLock
>> > * Fix terminology in ATExecDropOf() comment
>> > * Rebase over pgindent changes
>> >
>> > Changes from tt2v1-binary-upgrade.patch to tt2v2-binary-upgrade.patch:
>> > * Rebase over dumpCompositeType() changes from commit acfa1f45
>>
>> I think there's a bug in the tt1v1 patch. I'm getting intermittent
>> regression test failures at this point:
>>
>> ALTER TABLE tt7 OF tt_t1; -- reassign an
>> already-typed table
>> server closed the connection unexpectedly
>> This probably means the server terminated abnormally
>> before or while processing the request.
>> connection to server was lost
>>
>> In src/test/regress/log/postmaster.log:
>>
>> TRAP: FailedAssertion("!(((bool)((relation)->rd_refcnt == 0)))", File:
>> "relcache.c", Line: 1756)
>
> How frequently does it happen for you? I ran `make check' about fifteen times
> without hitting an error. I ran the new test cases under valgrind, and that
> also came out clean.
>
> Could you try a fresh build and see if it still happens? If it does, could
> you
> grab a "bt full" and "p *relation->rd_rel" in gdb?
I reproduced it this morning after git clean -dfx, updating to the
latest master branch, and re-applying your patch. The most recent
time I reproduced it, it took 7 tries, but I think the average
frequency of failure is around 25%.
gdb info attached, courtesy of defining SLEEP_ON_ASSERT to 1 in
pg_config_manual.h
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
(gdb) bt full
#0 0x00007fff884caf8a in __semwait_signal ()
No symbol table info available.
#1 0x00007fff884cae19 in nanosleep ()
No symbol table info available.
#2 0x00007fff88517df0 in sleep ()
No symbol table info available.
#3 0x00000001002f9d77 in ExceptionalCondition (conditionName=<value
temporarily unavailable, due to optimizations>, errorType=<value temporarily
unavailable, due to optimizations>, fileName=<value temporarily unavailable,
due to optimizations>, lineNumber=<value temporarily unavailable, due to
optimizations>) at assert.c:54
No locals.
#4 0x00000001002ed3bf in RelationDestroyRelation (relation=0x100faae20) at
relcache.c:1756
No locals.
#5 0x00000001002f1d58 in RelationClearRelation (relation=0x100faae20,
rebuild=<value temporarily unavailable, due to optimizations>) at
relcache.c:1930
newrel = (Relation) 0x0
save_relid = 41137
keep_tupdesc = <value temporarily unavailable, due to optimizations>
#6 0x00000001002f22a2 in RelationCacheInvalidateEntry (relationId=41137) at
relcache.c:2027
relation = (Relation) #7 0x00000001002e9bf6 in
LocalExecuteInvalidationMessage (msg=0x10114b660) at inval.c:501
i = <value temporarily unavailable, due to optimizations>
#8 0x00000001002e93df in ProcessInvalidationMessages (hdr=0x10114ae48,
func=0x1002e9ab0 <LocalExecuteInvalidationMessage>) at inval.c:391
_cindex = <value temporarily unavailable, due to optimizations>
_chunk = (InvalidationChunk *) 0x10114b650
#9 0x00000001002e9480 in CommandEndInvalidationMessages () at inval.c:1047
No locals.
#10 0x0000000100124294 in ATRewriteCatalogs [inlined] () at
/Users/rhaas/pgsql/src/backend/commands/tablecmds.c:3022
rel = (Relation) 0x100faae20
lcmd = (ListCell *) 0x101175858
pass = 8
ltab = (ListCell *) 0x10118ea90
lockmode = #11 0x0000000100124294 in ATController (rel=<value
temporarily unavailable, due to optimizations>, cmds=<value temporarily
unavailable, due to optimizations>, recurse=<value temporarily unavailable, due
to optimizations>, lockmode=4) at tablecmds.c:2756
rel = (Relation) 0x100faae20
lcmd = (ListCell *) 0x101175858
pass = 8
ltab = (ListCell *) 0x10118ea90
lockmode = #12 0x000000010023b185 in standard_ProcessUtility
(parsetree=0x101041a40, queryString=0x101040e38 "ALTER TABLE tt0 OF tt_t0;",
params=0x0, isTopLevel=1 '\001', dest=0x101041dc8, completionTag=<value
temporarily unavailable, due to optimizations>) at utility.c:781
stmt = <value temporarily unavailable, due to optimizations>
stmts = <value temporarily unavailable, due to optimizations>
l = (ListCell *) 0x10118e850
validnsps = {0x100389abe "toast", 0x0}
#13 0x000000010023628b in MemoryContextSwitchTo [inlined] () at
/Users/rhaas/pgsql/src/include/utils/palloc.h:1184
No locals.
#14 0x000000010023628b in PortalRunUtility (portal=0x1010f5a38,
utilityStmt=0x101041a40, isTopLevel=<value temporarily unavailable, due to
optimizations>, dest=0x101041dc8, completionTag=0x7fff5fbfdd30 "") at
pquery.c:1192
context = (MemoryContext) #15 0x0000000100237a45 in PortalRunMulti
(portal=0x1010f5a38, isTopLevel=<value temporarily unavailable, due to
optimizations>, dest=0x101041dc8, altdest=0x101041dc8,
completionTag=0x7fff5fbfdd30 "") at pquery.c:1315
stmt = (Node *) 0x101041a40
active_snapshot_set = 0 '\0'
stmtlist_item = (ListCell *) 0x101041d68
#16 0x00000001002383e8 in PortalRun (portal=0x1010f5a38,
count=9223372036854775807, isTopLevel=<value temporarily unavailable, due to
optimizations>, dest=0x101041dc8, altdest=0x101041dc8,
completionTag=0x7fff5fbfdd30 "") at pquery.c:813
save_exception_stack = (sigjmp_buf *) 0x7fff5fbfde60
save_context_stack = (ErrorContextCallback *) 0x0
local_sigjmp_buf = {17046984, 1, 1606409424, 32767, 1606409136, 32767,
17783352, 1, 17046080, 1, 3552322, 1, 17046136, 1, 2326934, 1, 530, 0, 8096,
895, 17026896, 0, 17046080, 1, 3552322, 1, 17046136, 1, 1606409392, 32767,
3264283, 1, 2, 0, 17783352, 1, 1606409424, 32767}
saveTopTransactionResourceOwner = (ResourceOwner) 0x101146b90
saveTopTransactionContext = (MemoryContext) 0x10106e858
saveActivePortal = (Portal) 0x0
saveResourceOwner = (ResourceOwner) 0x101146b90
savePortalContext = (MemoryContext) 0x0
saveMemoryContext = (MemoryContext) 0x10106e858
#17 0x000000010023437d in exec_simple_query (query_string=0x101040e38 "ALTER
TABLE tt0 OF tt_t0;") at postgres.c:1018
parsetree = (Node *) 0x101041a40
portal = (Portal) 0x1010f5a38
commandTag = 0x100363442 "ALTER TABLE"
completionTag =
"\000ݿ_?\000\000J?0\000\001\000\000\000\002\000\000\000\000\000\000\000
߿\000\006\000\000\000x?\003\001\001\000\000\000\006\000\000\000\000\000\000\000?AQ\000\001\000\000\000\002\000\000\000\000\000\000"
querytree_list = <value temporarily unavailable, due to optimizations>
plantree_list = <value temporarily unavailable, due to optimizations>
receiver = (DestReceiver *) 0x101041dc8
format = 0
dest = DestRemote
oldcontext = (MemoryContext) 0x10106e858
parsetree_list = (List *) 0x101041aa0
parsetree_item = (ListCell *) 0x101041a78
save_log_statement_stats = 0 '\0'
was_logged = 0 '\0'
msec_str =
"\031\000\000\000\000\000\000\0008\016\004\001\001\000\000\000?ݿ_?\000\000|?0\000\001\000\000"
#18 0x0000000100234f31 in PostgresMain (argc=2, argv=<value temporarily
unavailable, due to optimizations>, username=<value temporarily unavailable,
due to optimizations>) at postgres.c:3919
query_string = 0x101040e38 "ALTER TABLE tt0 OF tt_t0;"
dbname = <value temporarily unavailable, due to optimizations>
firstchar = 81
stack_base = 0 '\0'
input_message = {
data = 0x101040e38 "ALTER TABLE tt0 OF tt_t0;",
len = 26,
maxlen = 1024,
cursor = 26
}
local_sigjmp_buf = {1606409984, 32767, 1606410208, 32767, 1606409696,
32767, 11575168, 1, 2, 0, 17028800, 1, 17029496, 1, 2312734, 1, 530, 0, 8096,
895, 0, 1, 4, 0, 1606410128, 32767, -455871145, -1979638038, 0, 0, 1606410160,
32767, 1606410032, 32767, 17028800, 1, 17028832, 1}
send_ready_for_query = 0 '\0'
#19 0x00000001001e818c in ServerLoop () at postmaster.c:3590
port = (Port *) #20 0x00000001001e90f1 in PostmasterMain (argc=6,
argv=0x100b08f30) at postmaster.c:1110
opt = <value temporarily unavailable, due to optimizations>
status = <value temporarily unavailable, due to optimizations>
userDoption = 0x100b08fe0
"/Users/rhaas/pgsql/src/test/regress/./tmp_check/data"
listen_addr_saved = 0 '\0'
#21 0x000000010017c485 in main (argc=6, argv=0x100b08f30) at main.c:199
No locals.
(gdb) fr 4
#4 0x00000001002ed3bf in RelationDestroyRelation (relation=0x100faae20) at
relcache.c:1756
1756 Assert(RelationHasReferenceCountZero(relation));
(gdb) p *relation
$1 = {
rd_node = {
spcNode = 1663,
dbNode = 16384,
relNode = 41137
},
rd_smgr = 0x0,
rd_refcnt = 1,
rd_backend = -1,
rd_isnailed = 0 '\0',
rd_isvalid = 0 '\0',
rd_indexvalid = 0 '\0',
rd_createSubid = 0,
rd_newRelfilenodeSubid = 0,
rd_rel = 0x100e1b590,
rd_att = 0x100fc0090,
rd_id = 41137,
rd_indexlist = 0x0,
rd_indexattr = 0x0,
rd_oidindex = 0,
rd_lockInfo = {
lockRelId = {
relId = 41137,
dbId = 16384
}
},
rd_rules = 0x0,
rd_rulescxt = 0x0,
trigdesc = 0x0,
rd_options = 0x0,
rd_index = 0x0,
rd_indextuple = 0x0,
rd_am = 0x0,
rd_indexcxt = 0x0,
rd_aminfo = 0x0,
rd_opfamily = 0x0,
rd_opcintype = 0x0,
rd_support = 0x0,
rd_supportinfo = 0x0,
rd_indoption = 0x0,
rd_indexprs = 0x0,
rd_indpred = 0x0,
rd_exclops = 0x0,
rd_exclprocs = 0x0,
rd_exclstrats = 0x0,
rd_amcache = 0x0,
rd_indcollation = 0x0,
rd_toastoid = 0,
pgstat_info = 0x101158e78
}
(gdb) p *relation->rd_rel
$2 = {
relname = {
data = "tt0", '\0' <repeats 60 times>
},
relnamespace = 2200,
reltype = 41139,
reloftype = 0,
relowner = 10,
relam = 0,
relfilenode = 41137,
reltablespace = 0,
relpages = 0,
reltuples = 0,
reltoastrelid = 0,
reltoastidxid = 0,
relhasindex = 0 '\0',
relisshared = 0 '\0',
relpersistence = 112 'p',
relkind = 114 'r',
relnatts = 2,
relchecks = 0,
relhasoids = 0 '\0',
relhaspkey = 0 '\0',
relhasrules = 0 '\0',
relhastriggers = 0 '\0',
relhassubclass = 1 '\001',
relfrozenxid = 5822,
relacl = {17222296},
reloptions = {{
vl_len_ = "\001\000\000",
vl_dat = ""
}}
}
(gdb) q
The program is running. Quit anyway (and detach it)? (y or n) y
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers