Re: Question about debugging bootstrapping and catalog entries

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question about debugging bootstrapping and catalog entries
Date: 2006-12-18 12:14:26
Message-ID: 87k60pbdul.fsf@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Martijn van Oosterhout" <kleptog(at)svana(dot)org> writes:

> Here's what I did: you can step over functions in initdb until it fails
> (although I alredy know which part it's failing I guess). Restart. Then
> you go into that function and step until the new backend has been
> started. At this point you attach another gdb to the backend and let it
> run.

Hm, I suppose. Though starting a second gdb is a pain. What I've done in the
past is introduce a usleep(30000000) in strategic points in the backend to
give me a chance to attach.

Perhaps what would be handy is having an option to initdb to just run the
backend under gdb automatically. I'm not sure if initdb runs the backend in
the terminal though. Or perhaps initdb should start the backend with an option
that instructs it to enter an infinite loop shortly after startup so you can
attach with gdb.

In the meantime this trivial patch saved my day:

diff -c -r1.225 bootstrap.c
*** src/backend/bootstrap/bootstrap.c 4 Oct 2006 00:29:49 -0000 1.225
--- src/backend/bootstrap/bootstrap.c 18 Dec 2006 12:11:11 -0000
***************
*** 1293,1298 ****
--- 1293,1300 ----
heap = heap_open(ILHead->il_heap, NoLock);
ind = index_open(ILHead->il_ind, NoLock);

+ elog(DEBUG4, "building index %s on %s", NameStr(ind->rd_rel->relname), NameStr(heap->rd_rel->relname));
+
index_build(heap, ind, ILHead->il_info, false);

index_close(ind, NoLock);

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gurjeet Singh 2006-12-18 12:22:40 Re: Question about debugging bootstrapping and catalog entries
Previous Message Zeugswetter Andreas ADI SD 2006-12-18 11:59:28 Re: Question about debugging bootstrapping and catalog entries