public inbox for [email protected]help / color / mirror / Atom feed
[PATCH v3 3/3] Fix sizing of tape read buffers. 23+ messages / 3 participants [nested] [flat]
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v3 3/3] Fix sizing of tape read buffers. @ 2021-01-22 20:59 Heikki Linnakangas <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Heikki Linnakangas @ 2021-01-22 20:59 UTC (permalink / raw) --- src/backend/utils/sort/tuplesort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 14104643e78..aff2f201f52 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -2658,7 +2658,7 @@ merge_read_buffer_size(int64 avail_mem, int nInputTapes, int nInputRuns, * we derive the input buffer size from the amount of memory available, * and M and N. */ - return (avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes; + return Max((avail_mem - TAPE_BUFFER_OVERHEAD * nOutputTapes) / nInputTapes, 0); } /* -- 2.29.2 --------------631E0A48DCAEA386819DFCEC-- ^ permalink raw reply [nested|flat] 23+ messages in thread
* Re: pg17.3 PQescapeIdentifier() ignores len @ 2025-02-13 16:59 Ranier Vilela <[email protected]> 0 siblings, 1 reply; 23+ messages in thread From: Ranier Vilela @ 2025-02-13 16:59 UTC (permalink / raw) To: Justin Pryzby <[email protected]>; +Cc: [email protected] Em qui., 13 de fev. de 2025 às 13:51, Justin Pryzby <[email protected]> escreveu: > I found errors in our sql log after upgrading to 17.3. > > error_severity | ERROR > message | schema > "rptcache.44e3955c33bb79f55750897da0c5ab1fa2004af1_20250214" does not exist > query | copy > "rptcache.44e3955c33bb79f55750897da0c5ab1fa2004af1_20250214"."44e3955c33bb79f55750897da0c5ab1fa2004af1_20250214" > from stdin > > The copy command is from pygresql's inserttable(), which does: > > do { > t = strchr(s, '.'); > if (!t) > t = s + strlen(s); > table = PQescapeIdentifier(self->cnx, s, (size_t)(t - s)); > fprintf(stderr, "table %s len %ld => %s\n", s, t-s, table); > if (bufpt < bufmax) > bufpt += snprintf(bufpt, (size_t)(bufmax - bufpt), "%s", > table); > PQfreemem(table); > s = t; > if (*s && bufpt < bufmax) > *bufpt++ = *s++; > } while (*s); > > The fprintf suggests that since 5dc1e42b4 PQescapeIdentifier ignores its > len. > Interesting, Coverity has some new reports regarding PQescapeIdentifier. CID 1591290: (#1 of 1): Out-of-bounds access (OVERRUN) 2. alloc_strlen: Allocating insufficient memory for the terminating null of the string. [Note: The source code implementation of the function has been overridden by a builtin model.] Until now, I was in disbelief. best regards, Ranier Vilela ^ permalink raw reply [nested|flat] 23+ messages in thread
* Re: pg17.3 PQescapeIdentifier() ignores len @ 2025-02-13 19:05 Tom Lane <[email protected]> parent: Ranier Vilela <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Tom Lane @ 2025-02-13 19:05 UTC (permalink / raw) To: Ranier Vilela <[email protected]>; +Cc: Justin Pryzby <[email protected]>; [email protected] Ranier Vilela <[email protected]> writes: > Interesting, Coverity has some new reports regarding PQescapeIdentifier. > CID 1591290: (#1 of 1): Out-of-bounds access (OVERRUN) > 2. alloc_strlen: Allocating insufficient memory for the terminating null of > the string. [Note: The source code implementation of the function has been > overridden by a builtin model.] That's not new, we've been seeing those for awhile. I've been ignoring them on the grounds that (a) if the code actually had such a problem, valgrind testing would have found it, and (b) the message is saying in so many words that they're ignoring our code in favor of somebody's apparently-inaccurate model of said code. regards, tom lane ^ permalink raw reply [nested|flat] 23+ messages in thread
end of thread, other threads:[~2025-02-13 19:05 UTC | newest] Thread overview: 23+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2021-01-22 20:59 [PATCH v3 3/3] Fix sizing of tape read buffers. Heikki Linnakangas <[email protected]> 2025-02-13 16:59 Re: pg17.3 PQescapeIdentifier() ignores len Ranier Vilela <[email protected]> 2025-02-13 19:05 ` Re: pg17.3 PQescapeIdentifier() ignores len Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox