mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Fix memory leak during long distributed insert
Tuple expression context memory context is not properly reset during chunk dispatch execution which eventually consumes all available memory during the query execution: INSERT INTO test_table SELECT now() - random() * interval '2 years', (i/100)::text, random() FROM generate_series(1,700000) AS sub(i); This problem does not reproduces for a distributed hypertables with disabled batching and for a regular hypertables. Because luckly the tuple expression context got freed during the ModifyTable node execution.
This commit is contained in:
parent
71e2c35d48
commit
6f5da9b5eb
@ -116,6 +116,9 @@ chunk_dispatch_exec(CustomScanState *node)
|
||||
if (TupIsNull(slot))
|
||||
return NULL;
|
||||
|
||||
/* Reset the per-tuple exprcontext */
|
||||
ResetPerTupleExprContext(estate);
|
||||
|
||||
/* Switch to the executor's per-tuple memory context */
|
||||
old = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user