Re: Sync Rep v17

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Yeb Havinga <yebhavinga(at)gmail(dot)com>
Cc: Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, Daniel Farina <daniel(at)heroku(dot)com>
Subject: Re: Sync Rep v17
Date: 2011-02-28 18:40:40
Message-ID: 1298918440.12992.1719.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2011-02-25 at 16:41 +0100, Yeb Havinga wrote:

> --- a/src/backend/replication/syncrep.c
> +++ b/src/backend/replication/syncrep.c
> @@ -274,6 +274,8 @@ SyncRepRemoveFromQueue(void)
> }
> else
> {
> + bool found = false;
> +
> while (proc->lwWaitLink != NULL)
> {
> /* Are we the next proc in our traversal of the
> queue? */
> @@ -284,17 +286,19 @@ SyncRepRemoveFromQueue(void)
> * No need to touch head or tail.
> */
> proc->lwWaitLink = MyProc->lwWaitLink;
> + found = true;
> + break;
> }
>
> - if (proc->lwWaitLink == NULL)
> - elog(WARNING, "could not locate
> ourselves on wait queue");
> proc = proc->lwWaitLink;
> }
> + if (!found)
> + elog(WARNING, "could not locate ourselves on
> wait queue");
>
> - if (proc->lwWaitLink == NULL) /* At tail */
> + /* If MyProc was removed from the tail, maintain list
> invariant head==tail */
> + if (proc->lwWaitLink == NULL)
> {
> - Assert(proc == MyProc);
> - /* Remove ourselves from tail of queue */
> + Assert(proc != MyProc); /* impossible since that
> is the head=MyProc branch above */
> Assert(queue->tail == MyProc);
> queue->tail = proc;
> proc->lwWaitLink = NULL;

Used your suggested fix
Code available at git://github.com/simon2ndQuadrant/postgres.git

> I needed to add this to make the documentation compile
>
> --- a/doc/src/sgml/config.sgml
> +++ b/doc/src/sgml/config.sgml
> @@ -2010,6 +2010,9 @@ SET ENABLE_SEQSCAN TO OFF;
> You should also consider setting <varname>hot_standby_feedback</>
> as an alternative to using this parameter.
> </para>
> + </listitem>
> + </varlistentry>
> + </variablelist></sect2>
>
> <sect2 id="runtime-config-sync-rep">

Separate bug, will fix

--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-02-28 18:44:08 Re: WIP: cross column correlation ...
Previous Message Simon Riggs 2011-02-28 18:40:33 Re: Sync Rep v17