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: Race conditions in logical decoding
@ 2026-01-20 17:50 Andres Freund <[email protected]>
0 siblings, 0 replies; 22+ messages in thread
From: Andres Freund @ 2026-01-20 17:50 UTC (permalink / raw)
To: Antonin Houska <[email protected]>; +Cc: [email protected]
Hi,
On 2026-01-20 09:30:33 +0100, Antonin Houska wrote:
> Antonin Houska <[email protected]> wrote:
>
> > I'm not sure yet how to fix the problem. I tried to call XactLockTableWait()
> > from SnapBuildAddCommittedTxn() (like it happens in SnapBuildWaitSnapshot()),
> > but it made at least one regression test (subscription/t/010_truncate.pl)
> > stuck - probably a deadlock. I can spend more time on it, but maybe someone
> > can come up with a good idea sooner than me.
>
> Attached here is what I consider a possible fix - simply wait for the CLOG
> update before building a new snapshot.
I don't think that's enough - during non-timetravel visibility semantics, you
can only look at the clog if the transaction isn't marked as in-progress in
the procarray. ISTM that we need to do that here too?
Greetings,
Andres
^ permalink raw reply [nested|flat] 22+ messages in thread
end of thread, other threads:[~2026-01-20 17:50 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]>
2026-01-20 17:50 Re: Race conditions in logical decoding Andres Freund <[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