Re: Use of 'cp -r' in CREATE DATABASE

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Use of 'cp -r' in CREATE DATABASE
Дата
Msg-id 3FEF8CF4.2030801@dunslane.net
обсуждение исходный текст
Ответ на Re: Use of 'cp -r' in CREATE DATABASE  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Use of 'cp -r' in CREATE DATABASE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

Tom Lane wrote:

>A final point is that implementing CREATE DATABASE via "cp -r" is and
>always has been fundamentally broken anyway, because of the lack of
>interlocking against other backends changing the source database.
>We have a very half-baked defense against that (erroring out if anyone
>else is connected to the source DB at the start of the copy) which
>I would dearly love to get rid of.  
>

It struck me this morning that we could strengthen that defense 
considerable with the addition of some checks after the copy on the 
mtimes of the copied files. The additional code could be quite small and 
fast.

Longer term, a robust mechanism for DB level locks would probably be 
preferable, I guess, so I'm not sure if my idea is worth doing in the 
mean time. Presumably it hasn't caused much of a problem up to now, 
since most people are not likely to monkey with their template dbs at 
the same time as trying to create dbs based on them.

cheers

andrew



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: select from table with unique values
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Use of 'cp -r' in CREATE DATABASE