public inbox for [email protected]
help / color / mirror / Atom feed[PATCH v3 3/3] Fix sizing of tape read buffers.
22+ messages / 2 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ 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; 22+ 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] 22+ messages in thread
* Re: Detach shared memory in Postmaster child if not needed
@ 2024-07-29 11:44 Aleksander Alekseev <[email protected]>
0 siblings, 0 replies; 22+ messages in thread
From: Aleksander Alekseev @ 2024-07-29 11:44 UTC (permalink / raw)
To: pgsql-hackers; +Cc: Rui Zhao <[email protected]>; hlinnaka <[email protected]>; robertmhaas <[email protected]>; tgl <[email protected]>
Hi Rui,
> Prior to PG16, postmaster children would manually detach from shared memory
> if it was not needed. However, this behavior was removed in fork mode in
> commit aafc05d.
>
> Detaching shared memory when it is no longer needed is beneficial, as
> postmaster children (like syslogger) don't wish to take any risk of
> accidentally corrupting shared memory. Additionally, any panic in these
> processes will not reset shared memory.
>
> The attached patch addresses this issue by detaching shared memory after
> fork_process().
Thanks for the patch. How do you estimate its performance impact?
Note the comments for postmaster_child_launch(). This function is
exposed to the third-party code and guarantees to attach shared
memory. I doubt that there is much third-party code in existence to
break but you should change to comment.
--
Best regards,
Aleksander Alekseev
^ permalink raw reply [nested|flat] 22+ messages in thread
end of thread, other threads:[~2024-07-29 11:44 UTC | newest]
Thread overview: 22+ 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]>
2024-07-29 11:44 Re: Detach shared memory in Postmaster child if not needed Aleksander Alekseev <[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