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