pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
REL9_3_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/baa94ebe2cc819c118f844c08a28fc52eb88c949

Modified Files
--------------
src/backend/utils/adt/nabstime.c  |  3 +++
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/18c725413fad42e6edbead22751382ee45c01166

Modified Files
--------------
src/backend/utils/adt/nabstime.c  |  3 +++
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3dfef0c519de40a196dc26b76604151347bf5454

Modified Files
--------------
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d112682373784b72bb293f6b78b7d8cec0c0aa93

Modified Files
--------------
src/backend/utils/adt/nabstime.c  |  3 +++
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d64a54fb9c81c644879e095ab7de6b4c64a6896b

Modified Files
--------------
src/backend/utils/adt/nabstime.c  |  3 +++
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5ef71d4bd3226bfd4e733a2fc0b6598df0cc26cf

Modified Files
--------------
src/backend/utils/adt/nabstime.c  |  3 +++
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Avoid statically allocating gmtsub()'s timezone workspace.
@ 2018-10-16 15:50  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2018-10-16 15:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid statically allocating gmtsub()'s timezone workspace.

localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/27ba589b745f864165005f08f1616a249383955e

Modified Files
--------------
src/backend/utils/adt/nabstime.c  |  3 +++
src/backend/utils/adt/timestamp.c |  3 +++
src/timezone/localtime.c          | 11 ++++++-----
3 files changed, 12 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2018-10-16 15:50 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>
2018-10-16 15:50 pgsql: Avoid statically allocating gmtsub()'s timezone workspace. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox