Обсуждение: Multiple postmasters for one data directory...

Поиск
Список
Период
Сортировка

Multiple postmasters for one data directory...

От
Stef
Дата:
Hi all,

I've got a situation on certain machines where approximately
70 postmasters are running. Each with one database, and one
data directory.

This is fine most of the time, except for a certain time of the month,
when a very large consolidation process has to run on each database.

At this time it is impossible to have all databases started with more shared
memory, and I basically lose the benefits of using a cluster that can make
use of much more memory at a time.

I've managed to make such a database cluster on a separate postmaster,
and re-linked all the database directories to point to the data directories
of all the other postmasters.

Although this workaround seems to be working rather well, I know for one
thing that it could be disastrous to have two postmasters running on the
same data directory at the same time, so I'll ensure that that doesn't happen.

Is what I'm doing VERY bad, and are there more things I'm overlooking?
Can this setup possibly break everything?

Kind Regards
Stefan

Вложения

Re: Multiple postmasters for one data directory...

От
Tom Lane
Дата:
Stef <svb@ucs.co.za> writes:
> I've managed to make such a database cluster on a separate postmaster,
> and re-linked all the database directories to point to the data directories
> of all the other postmasters.

> Although this workaround seems to be working rather well, I know for one
> thing that it could be disastrous to have two postmasters running on the
> same data directory at the same time, so I'll ensure that that doesn't happen.

> Is what I'm doing VERY bad, and are there more things I'm overlooking?
> Can this setup possibly break everything?

I'm afraid you have already shot yourself in the foot.

The above cannot work because there is no way to share pg_xlog or
pg_clog across database clusters.  You have now got transaction numbers
from the "shared" postmaster inserted into the other databases, and when
you go back to separate postmasters you will have corruption.  I'm
surprised you do not already see inconsistencies, because if the
"shared" installation was a fresh one then it would probably see most of
the committed transaction numbers of the other databases as being "in
the future".

Get out your backup tapes, because what you have on disk now is just a
pile of inconsistent bits.

            regards, tom lane

Re: Multiple postmasters for one data directory...

От
Stef
Дата:
Tom Lane mentioned :
=> Get out your backup tapes, because what you have on disk now is just a
=> pile of inconsistent bits.

I haven't actually done anything but SELECT's from the shared postmaster,
and it was a test machine. Phew!! Glad I asked first...

I think the way I'll do it, is by using initlocation, as this will solve all my problems,
except for having to reload all databases.

Thanks for the enlightening answer!

Kind Regards
Stefan

Вложения