background processes vs. hot standby
От | Robert Haas |
---|---|
Тема | background processes vs. hot standby |
Дата | |
Msg-id | CA+TgmobguVO+qHnHvxBA2TFkDhw67Y=4Bp405FVABEc_EtO4VQ@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: background processes vs. hot standby
|
Список | pgsql-hackers |
CheckRequiredParameterValues() has some code that, when hot standby is in use, checks the values of max_connections, max_prepared_transactions, and max_locks_per_transaction against the master. The comment says "we must have at least as many backend slots as the primary" ... but the code no longer enforces that, because we now compute MaxBackends like this: MaxBackends = MaxConnections + autovacuum_max_workers + 1 + GetNumShmemAttachedBgworkers(); If GetNumShmemAttachedBgworkers() returns a lower value on the standby than it did on the master, then we might well have fewer backend slots on the standby. I'm having trouble remembering why it's a problem to have fewer backend slots on the standby than the master, but if we need to prevent that then this code is no longer adequate to the task. The comment doesn't explain why we check max_locks_per_transaction. I thought the reason for that check was that we needed to ensure that there were at least as many lock table slots on the standby as there were on the master, to prevent bad things from happening later. That was already not true, since the existing code didn't enforce any limitation on autovacuum_max_workers on the standby side. Maybe that doesn't matter, since autovacuum workers can't run in hot standby mode; not sure. But the addition of background workers to MaxBackends provides another way for that to be not true. Here's how we compute the size of the lock table: #define NLOCKENTS() \ mul_size(max_locks_per_xact, add_size(MaxBackends, max_prepared_xacts)) Thoughts? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: