Commit 8719d2f
FIX: Invalid relcache leak WARNING logged in autovacuum
The autovacuum launcher process periodically launches workers to vacuum the table.
During this process, the UDF `pg_catalog.gp_acquire_sample_rows` will be called.
Also the vacuum task always be canceled by launcher.
The plan of `pg_catalog.gp_acquire_sample_rows` is:
```
QUERY PLAN
---------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..45.02 rows=3000 width=32)
Output: (gp_acquire_sample_rows('17018'::oid, 1250, false))
-> ProjectSet (cost=0.00..5.02 rows=1000 width=32)
Output: gp_acquire_sample_rows('17018'::oid, 1250, false)
-> Result (cost=0.00..0.01 rows=1 width=0)
Optimizer: Postgres query optimizer
(6 rows)
```
In actual examples, we often encounter relcache leaks caused by `pg_catalog.gp_acquire_sample_rows`.
In fact, this warning is not caused by the UDF itself.
The following are the complete steps to reproduce(not stable reproduce)
1. User use the insert/update/delete SQL. Auto-vacuum is enabled.
2. The auto-vacuum worker process call the `pg_catalog.gp_acquire_sample_rows`
2.1 The vacuum launches in master cancel the vacuum query.
2.2 The vacuum worker in master process the interrupt in the intercontect.
So the gather motion will be aborted.
2.3 The segment do the tuple sender in the motion(`doSendTuple`).But it
found the connection is NOT alive. Also it have not recv the SIGN INT
in this time.
So segment mark the `StopRequested` to true, and finish the current motion,
and the function `pg_catalog.gp_acquire_sample_rows` in project set can't
call the `table_close` in this time.
2.4 The segment call the `PortalDrop` to destory the resowner which inside the current
portal, and current portal status won't be FAIL, because current segment still
have not recv the SIGN INT.
The resowner found the leaked relcache, log the WARNING.
3. After step2, segments recv the SIGN INT, But nothing to do.1 parent 3ead998 commit 8719d2f
File tree
6 files changed
+55
-4
lines changed- contrib/interconnect/udp
- src
- backend
- executor
- utils/mmgr
- include/utils
- test/regress
- expected
- sql
6 files changed
+55
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3965 | 3965 | | |
3966 | 3966 | | |
3967 | 3967 | | |
3968 | | - | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
3969 | 3972 | | |
3970 | 3973 | | |
3971 | 3974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
| 227 | + | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
| |||
587 | 588 | | |
588 | 589 | | |
589 | 590 | | |
590 | | - | |
| 591 | + | |
591 | 592 | | |
592 | 593 | | |
593 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
228 | 231 | | |
229 | 232 | | |
230 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
0 commit comments