From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | shao bret <bret(dot)shao(at)outlook(dot)com> |
Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: 答复: [BUGS] BUG #14615: ReplicationOriginShmemInit Memory access cross-border |
Date: | 2017-04-11 15:22:14 |
Message-ID: | 20170411152214.gepn4iulxnje43t7@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2017-04-10 07:02:06 +0000, shao bret wrote:
> Hi Michael,
> Thanks for your quickly response!
> I think maybe you have a little misunderstanding with my solution.
>
> My solution is that
> if (!found)
> {
> int i;
> MemSet(replication_states_ctl, 0, ReplicationOriginShmemSize());
> replication_states_ctl->tranche_id = LWLockNewTrancheId();
> replication_states_ctl->tranche.name = "ReplicationOrigins";
> replication_states_ctl->tranche.array_base =
> &replication_states[0].lock;
> replication_states_ctl->tranche.array_stride =
> sizeof(ReplicationState);
>
> //MemSet(replication_states, 0, ReplicationOriginShmemSize());
>
> for (i = 0; i < max_replication_slots; i++)
> LWLockInitialize(&replication_states[i].lock,
> replication_states_ctl->tranche_id);
> }
> So I think it’s easier for understanding code.
> What do you think?
That's imo just more work to maintain if additional fields added.
- Andres
From | Date | Subject | |
---|---|---|---|
Next Message | Devrim Gündüz | 2017-04-11 16:15:09 | Re: BUG #14620: pgdg93 repo libevent conflict |
Previous Message | Andres Freund | 2017-04-11 15:20:49 | Re: BUG #14615: ReplicationOriginShmemInit Memory access cross-border |