"initdb -t" destroys all databases
От | Richard Poole |
---|---|
Тема | "initdb -t" destroys all databases |
Дата | |
Msg-id | 20000925183246.M3414@office.vi.net обсуждение исходный текст |
Ответы |
Re: "initdb -t" destroys all databases
|
Список | pgsql-hackers |
No response to this one on -general, so here goes... The documentation for initdb says that the "-t" (== "--template") option recreates the template1 database but doesn't touch anything else. But it seems that if it detects a failure it will abort and remove anything it *might* have created: -- begin cut-and-paste [barbra rp]/usr/lib/postgresql/bin/initdb -t -D /home/rp/tmp/pgtest Updating template1 database only. This database system will be initialized with username "rp". This user will own all the data files and must also own the server process. Creating template database in /home/rp/tmp/pgtest/base/template1 000925.16:49:28.545 [5432] FATAL 2: BootStrapXLOG failed to create control file (/home/rp/tmp/pgtest/pg_control): 17 000925.16:49:28.545 [5432] FATAL 2: BootStrapXLOG failed to create control file (/home/rp/tmp/pgtest/pg_control): 17 initdb failed. Removing /home/rp/tmp/pgtest. Removing temp file /tmp/initdb.5412. -- end cut-and-paste It seems that initdb starts a single-user backend but gives it the "-x" option, which makes it call BootStrapXLOG, which fails because it expects to be called only on absolutely first-time system startup (?). initdb sees the failure and removes everything under the data directory, which is the wrong behaviour here. Everything seems to be OK if I fix initdb not to pass "-x" to postgres if it's been given "-t", but I don't know enough to know that this is really the right thing. If it is, I'll submit a patch; any opinions? Richard
В списке pgsql-hackers по дате отправления: