Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcEd7-0007kP-AD for pgsql-bugs@arkaria.postgresql.org; Mon, 31 Jul 2017 17:37:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dcEd6-0002hQ-Mh for pgsql-bugs@arkaria.postgresql.org; Mon, 31 Jul 2017 17:37:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dcEd6-0002gl-0u for pgsql-bugs@postgresql.org; Mon, 31 Jul 2017 17:37:20 +0000 Received: from mail-pg0-x22b.google.com ([2607:f8b0:400e:c05::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dcEd2-0004fi-Iz for pgsql-bugs@postgresql.org; Mon, 31 Jul 2017 17:37:19 +0000 Received: by mail-pg0-x22b.google.com with SMTP id k190so75502147pgk.5 for ; Mon, 31 Jul 2017 10:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jlxYvvokilg8RRm+58mLGajn2ozTALfav7E2oFPVQw4=; b=lepaaFZc4A5vd4RxHoR/09rFU38IiiLtZ6jFbjRJN+UN8Zqwr01ij8tUck4+ipnUE+ fJQeFQWbxAz9gmskGHuxHUOCL4O3A/bQv8KCoZsnLSjsb3zc65LmNsWO/sLGnxrIWQ3l cDeKr3sGjizbQcCGIl6g/7iEdY7ZzMI6/0RcxPyHwjf+WKDoi3RfXg8cUScs/KkiXPni PNyVVdSWJEsqoVDLEUgd+2KOdQcbDDDSeCdc97bqz3nFN9t/8PZZqXtlMZh3y90/qEwC 1+n0WTJz3ebWCzmq05uuZZ1Kvk8Y6yCu11qlKUHgnuoKF5/JwD+D5toyq/SgeyRLafSC MRdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jlxYvvokilg8RRm+58mLGajn2ozTALfav7E2oFPVQw4=; b=bs8XuEVOD21MmR6fMKMRuHEe+K/rvp60WP3B4eo4ssf9Yfhi4DS8Lboa1jKJ/Vc1to F4RaRL5V/pd30qFqVSi4hzdCm5wTyROSARHsDyGMqvduqwcfz7QS+tDiSZaUIt59iwsp mDfu15awTiBhEbG7RLO6cDSNHhj10ZO71yNlxgFWYq1BNQsgtdfpFLawOufRRyky373+ pUtSIG+KwFtT4yvpeMtpTNgUNYMwbiRhDiwoMZF88qLVpNO4HrDEKC7tOQyUSMXBU2P4 NxKNBNxXa+W8xPL1E4tty36/C7n3boFDV5088UWV8A/wAh/IN68gTfY8mrkrnkc3Npwp ABKw== X-Gm-Message-State: AIVw110QEzBuT4rLy55ur3PpGzt3GpYtFoqZnt5G520gxEuTU8bsMMxq Ww5LF24aeP3m5XtHQlEOsQ== X-Received: by 10.84.132.106 with SMTP id 97mr17680867ple.105.1501522634398; Mon, 31 Jul 2017 10:37:14 -0700 (PDT) Received: from marmot ([162.217.72.7]) by smtp.gmail.com with ESMTPSA id d69sm6375618pfl.142.2017.07.31.10.37.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jul 2017 10:37:13 -0700 (PDT) Date: Mon, 31 Jul 2017 10:37:10 -0700 From: Peter Geoghegan To: Daniel Verite Cc: pgsql-bugs@postgresql.org Subject: Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values Message-ID: <20170731173710.GA19829@marmot> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Daniel Verite wrote: > SELECT count(distinct wordtext COLLATE :"collname") FROM words_test; > >Some of the collations that crash: > az-Latn-AZ-u-co-search-x-icu > bs-Latn-BA-u-co-search-x-icu > bs-x-icu > cs-CZ-u-co-search-x-icu > de-BE-u-co-phonebk-x-icu > sr-Latn-XK-x-icu > zh-Hans-CN-u-co-big5han-x-icu > >Trying all of them I had 146 crashes out of the 1741 ICU >entries in pg_collation created by initdb. > >The size of the table is 291MB, and work_mem to 128MB. > >Reducing the dataset tends to make the problem disappear: if I split >the table in halves based on row_number() to bisect on the data, >the queries on both parts pass without crashing. I think that this sensitivity to work_mem exists because abbreviated keys are used for quicksort operations that sort individual runs. As work_mem is increased, and less merging is required, affected codepaths are reached less frequently. You would probably find that the problem appears more consistently if varstr_sortsupport() is modified so that even ICU collations never use abbreviated keys; that would be a matter of "abbreviate" always being set to false within that function. I suggest using the new amcheck contrib module as part of this testing (you'll need to use CREATE INDEX to have an index to perform verification against). This will zero in on inconsistencies that may be far more subtle than a hard crash. I wouldn't assume that abbreviated key comparisons are correct here just because there is no hard crash. Does the crash always have ucol_strcollUseLatin1UTF8() in its backtrace? -- Peter Geoghegan -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs