"Martijn van Oosterhout" <kleptog@svana.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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to