Re: [HACKERS] pgbench tap tests & minor fixes

Поиск
Список
Период
Сортировка
От Nikolay Shaplov
Тема Re: [HACKERS] pgbench tap tests & minor fixes
Дата
Msg-id 2161488.LtOUyK07j0@x200m
обсуждение исходный текст
Ответ на Re: [HACKERS] pgbench tap tests & minor fixes  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: [HACKERS] pgbench tap tests & minor fixes  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
В письме от 30 мая 2017 17:24:26 Вы написали:


> > I still have three more questions. A new one:
> >
> > ========
> >
> >    my_command->line = expr_scanner_get_substring(sstate,
> >
> >                                                  start_offset,
> >
> > -                                                 end_offset);
> > +                                                 end_offset + 1);
> > ========
> >
> > I do not quite understand what are you fixing here,
>
> I fix a truncation which appears in an error message later on.
>
> > I did not find any mention of it in the patch introduction letter.
>
> Indeed. Just a minor bug fix to avoid an error message to be truncated. If
> you remove it, then you can get:
>
>   missing argument in command "sleep"
>   \slee
>
> Note the missing "p"...
>
> > And more, expr_scanner_get_substring is called twice in very similar
> > code, and it is fixed only once. Can you tell more about this fix.
>
> I fixed the one which was generating truncated messages. I did not notice
> other truncated messages while testing, so I assume that other calls are
> correct, but I did not investigate further, so I may be wrong. Maybe in
> other instances the truncation removes a "\n" which is intended?

I did some investigation: The code there really suppose that there is always
\n at the end of the line, and truncates the line. It is done in

/* Get location of the ending newline */
end_offset = expr_scanner_offset(sstate) - 1;

just two lines above the code we are discussing.

When you have one line code /sleep 2ms with no "end of line" symbol at the
end, it will cut off "s" instead of "\n"

You've fix it, but now it will leave \n, in all sleeps in multiline scripts.

So this should be fixed in both expr_scanner_get_substring cases, and keep last
symbol only if it is not "\n".

> Here is a v6.
>
>   - it uses "progress == 0"
>
>   - it does not change "nxacts <= 0" because of possible wrapping
>
>   - it fixes two typos in a perl comment about the checks_all function
>
>   - I kept "checks all" because this talks more to me than "like more"
>     if a native English speaker or someone else has an opinion, it is
>     welcome.
Ok, let's leave this for commiter to make final decision.

> Also, if someone could run a test on windows, it would be great.
I'll try to ask a friend of mine to run this on windows...

--
Nikolay Shaplov, independent Perl & C/C++ developer. Available for hire.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Challenges preventing us moving to 64 bit transactionid (XID)?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] BEFORE trigger can cause undetected partitionconstraint violation