Re: [HACKERS] max backends checking patch

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: t-ishii(at)sra(dot)co(dot)jp
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] max backends checking patch
Date: 1999-01-10 14:30:24
Message-ID: 3698B980.EB62133A@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tatsuo Ishii wrote:
>
> As of 6.4.2 (and snapshot, I guess), postmaser does not check if the
> number of backends exceeds MaxBackendId (defined in
> include/storage/sinvaladt.h). As a result (MaxBackendId+1)th backend
> gets started but failed in the middle of its initialising process.
> Typical error would be:
>
> NOTICE: SIAssignBackendId: discarding tag 2147430138
> Connection databese 'request' failed.
> FATAL 1: Backend cache invalidation initialization failed
>
> Then postmaster decides to re-initialize the shared memory and all
> running backends are killed. Too bad.
>
> Attached patches try to fix the problem.

Couldn't postmaster just keep # of backends running
in some variable, instead of examining BackendList ?

> + /*
> + * Count up number of chidren processes.
> + */
> + static int
> + CountChildren(void)
> + {
> + Dlelem *curr,
> + *next;
> + Backend *bp;
> + int mypid = getpid();
> + int cnt = 0;
> +
> + curr = DLGetHead(BackendList);
> + while (curr)
> + {
> + next = DLGetSucc(curr);
> + bp = (Backend *) DLE_VAL(curr);
> +
> + if (bp->pid != mypid)
> + {
> + cnt++;
> + }
> +
> + curr = next;
> + }
> + return(cnt);
> }

Vadim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 1999-01-10 15:00:01 Re: [HACKERS] max backends checking patch
Previous Message Tatsuo Ishii 1999-01-10 14:16:27 max backends checking patch