pgsql: Use type "int64" for memory accounting in tuplesort.c/tuplestore

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use type "int64" for memory accounting in tuplesort.c/tuplestore
Date: 2013-07-05 03:15:10
Message-ID: E1UuwUI-0006N7-5J@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use type "int64" for memory accounting in tuplesort.c/tuplestore.c.

Commit 263865a48973767ce8ed7b7788059a38a24a9f37 switched tuplesort.c and
tuplestore.c variables representing memory usage from type "long" to
type "Size". This was unnecessary; I thought doing so avoided overflow
scenarios on 64-bit Windows, but guc.c already limited work_mem so as to
prevent the overflow. It was also incomplete, not touching the logic
that assumed a signed data type. Change the affected variables to
"int64". This is perfect for 64-bit platforms, and it reduces the need
to contemplate platform-specific overflow scenarios. It also puts us
close to being able to support work_mem over 2 GiB on 64-bit Windows.

Per report from Andres Freund.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/79e0f87a15643efa9a94e011da509746dbb96798

Modified Files
--------------
src/backend/utils/sort/tuplesort.c | 30 ++++++++++++++++--------------
src/backend/utils/sort/tuplestore.c | 14 ++++++++------
src/include/utils/tuplesort.h | 2 +-
3 files changed, 25 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Kevin Hale Boyes 2013-07-05 04:28:18 [COMMITTERS] pgsql: Add new GUC, max_worker_processes, limiting number of bgworkers.
Previous Message Fujii Masao 2013-07-04 17:47:58 pgsql: Fix typo in comment.