Re: Sync Rep v17 - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Sync Rep v17
Date
Msg-id 1298918440.12992.1719.camel@ebony
Whole thread Raw
In response to Re: Sync Rep v17  (Yeb Havinga <yebhavinga@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Sync Rep v17
Next
From: Alvaro Herrera
Date:
Subject: Re: WIP: cross column correlation ...