Re: Support for N synchronous standby servers - take 2

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: masao(dot)fujii(at)gmail(dot)com
Cc: sawada(dot)mshk(at)gmail(dot)com, michael(dot)paquier(at)gmail(dot)com, robertmhaas(at)gmail(dot)com, thom(at)linux(dot)com, thomas(dot)munro(at)enterprisedb(dot)com, memissemerson(at)gmail(dot)com, josh(at)agliodbs(dot)com, amit(dot)kapila16(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Support for N synchronous standby servers - take 2
Date: 2016-02-23 08:44:44
Message-ID: 20160223.174444.178687579.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

Hello,

At Mon, 22 Feb 2016 22:52:29 +0900, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote in <CAHGQGwENujogaQvcc=u0tffNfFGtwXNb1yFcphdTYCJdG1_j1A(at)mail(dot)gmail(dot)com>
> On Tue, Feb 16, 2016 at 4:19 PM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> > On Mon, Feb 15, 2016 at 2:54 PM, Michael Paquier
> > <michael(dot)paquier(at)gmail(dot)com> wrote:
> >> On Mon, Feb 15, 2016 at 2:11 PM, Kyotaro HORIGUCHI wrote:
> >>> Surprizingly yes. The list is handled as an identifier list and
> >>> parsed by SplitIdentifierString thus it can accept double-quoted
> >>> names.
> >>
> >
> > Attached latest version patch which has only feature logic so far.
> > I'm writing document patch about this feature now, so this version
> > patch doesn't have document and regression test patch.
>
> Thanks for updating the patch!
>
> When I changed s_s_names to 'hoge*' and reloaded the configuration file,
> the server crashed unexpectedly with the following error message.
> This is obviously a bug.
>
> FATAL: syntax error

I had a glance on the lexer part in the new patch. It'd be
better to design the lexer from the beginning according to the
required behavior.

The documentation for the syntax is saying as the following,

http://www.postgresql.org/docs/current/static/runtime-config-logging.html

> application_name (string)
>
> The application_name can be any string of less than NAMEDATALEN
> characters (64 characters in a standard build). <snip> Only
> printable ASCII characters may be used in the application_name
> value. Other characters will be replaced with question marks (?).

And according to what some functions mentioned so far do, totally
an application_name is treated as follwoing, I suppose.

- check_application_name() currently allows [\x20-\x7e], which
differs from the definition of the SQL identifiers.

- SplitIdentifierString() and syncrep code

- allows any byte except a double quote in double-quoted
representation. A double-quote just after a delimiter can open
quoted representation.

- Non-quoted name can contain any character including double
quotes except ',' and white spaces.

- The syncrep code does case-insensitive matching with the
application_name.

So, to preserve or following the current behavior expct the last
one, the following pattern definitions would do. The
lexer/grammer for the new format of s_s_names could be simpler
than what it is.

space [ \n\r\f\t\v] /* See the definition of isspace(3) */
whitespace {space}+
dquote \"
app_name_chars [\x21-\x2b\x2d-\x7e] /* excluding ' ', ',' */
app_name_indq_chars [\x20\x21\x23-\x7e] /* excluding '"' */
app_name_dq_chars ({app_name_indq_chars}|{dquote}{dquote})
delimiter {whitespace}*,{whitespace}*
app_name ({app_name_chars}+|{dquote}{app_name_dq_chars}+{dquote})
s_s_names {app_name}({delimiter}{app_name})*

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2016-02-23 10:01:42 Re: WIP: Failover Slots
Previous Message Michael Paquier 2016-02-23 07:17:36 Password identifiers, protocol aging and SCRAM protocol