Re: [HACKERS] Getting server crash on Windows when using ICU collation

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: [HACKERS] Getting server crash on Windows when using ICU collation
Дата
Msg-id CAA4eK1+3_9Fmr_8xTAR3v8DCP5E-PBV5030X7SpmTSONxy_UKA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Getting server crash on Windows when using ICU collation  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Ответы Re: [HACKERS] Getting server crash on Windows when using ICU collation  (Ashutosh Sharma <ashu.coek88@gmail.com>)
Список pgsql-hackers
On Mon, Jun 12, 2017 at 10:08 AM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> PFA patch that fixes the issue described in above thread. As mentioned
> in the above thread, the crash is basically happening in varstr_cmp()
> function and  it's  only happening on Windows because in varstr_cmp(),
> if the collation provider is ICU, we don't even think of calling ICU
> functions to compare the string. Infact, we directly attempt to call
> the OS function wsccoll*() which is not expected. Thanks.
>

Your analysis is right, basically, when ICU is enabled we need to use
ICU related functions and use corresponding information in the
pg_locale structure. However, I see few problems with your patch.

+ if (mylocale)
+ {
+ if (mylocale->provider == COLLPROVIDER_ICU)
+ {
+#ifdef USE_ICU
+#ifdef HAVE_UCOL_STRCOLLUTF8
+ if (GetDatabaseEncoding() == PG_UTF8)
+ {
+ UErrorCode status;
+
+ status = U_ZERO_ERROR;
+ result = ucol_strcollUTF8(mylocale->info.icu.ucol,
+  arg1, len1,
+  arg2, len2,
+  &status);

On Windows, we need to map UTF-8 strings to UTF-16 as we are doing in
this function for other Windows specific comparisons for UTF-8
strings.  Also, we don't want to screw memcmp optimization we have in
this function, so do this ICU specific checking after memcmp check.


-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: "Daniel Verite"
Дата:
Сообщение: Re: [HACKERS] Disallowing multiple queries per PQexec()
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] WIP Patch: Pgbench Serialization and deadlock errors