forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf3b141c
committed
Fix relation leak for subscribers firing triggers in logical replication
Creating a trigger on a relation to which an apply operation istriggered would cause a relation leak once the change gets committed,as the executor would miss that the relation needs to be closedbeforehand. This issue got introduced with the refactoring done in1375422, where it becomes necessary to track relations withines_opened_result_relations to make sure that they are closed.We have discussed using ExecInitResultRelation() coupled withExecCloseResultRelations() for the relations in need of tracking by theapply operations in the subscribers, which would simplify greatly theopening and closing of indexes, but this requires a larger rework andreorganization of the worker code, particularly for the tuple routingpart. And that's not really welcome post feature freeze. So, for now,settle down to the same solution as TRUNCATE which is to fill ines_opened_result_relations with the relation opened, to make sure thatExecGetTriggerResultRel() finds them and that they get closed.The code is lightly refactored so as a relation is not registered threetimes for each DML code path, making the whole a bit easier to follow.Reported-by: Tang Haiying, Shi Yu, Hou ZhijieAuthor: Amit Langote, Masahiko Sawada, Hou ZhijieReviewed-by: Amit Kapila, Michael PaquierDiscussion:https://postgr.es/m/OS0PR01MB611383FA0FE92EB9DE21946AFB769@OS0PR01MB6113.jpnprd01.prod.outlook.com1 parent1599e7b commitf3b141c
1 file changed
+47
-26
lines changedLines changed: 47 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
338 | 338 |
| |
339 | 339 |
| |
340 | 340 |
| |
341 |
| - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
342 | 344 |
| |
343 | 345 |
| |
344 |
| - | |
| 346 | + | |
| 347 | + | |
345 | 348 |
| |
346 | 349 |
| |
347 | 350 |
| |
| |||
355 | 358 |
| |
356 | 359 |
| |
357 | 360 |
| |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
358 | 382 |
| |
359 | 383 |
| |
360 | 384 |
| |
| |||
363 | 387 |
| |
364 | 388 |
| |
365 | 389 |
| |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
366 | 405 |
| |
367 | 406 |
| |
368 | 407 |
| |
| |||
1168 | 1207 |
| |
1169 | 1208 |
| |
1170 | 1209 |
| |
1171 |
| - | |
| 1210 | + | |
1172 | 1211 |
| |
1173 | 1212 |
| |
1174 | 1213 |
| |
1175 |
| - | |
1176 |
| - | |
1177 | 1214 |
| |
1178 | 1215 |
| |
1179 | 1216 |
| |
| |||
1194 | 1231 |
| |
1195 | 1232 |
| |
1196 | 1233 |
| |
1197 |
| - | |
1198 |
| - | |
1199 |
| - | |
1200 |
| - | |
1201 |
| - | |
| 1234 | + | |
1202 | 1235 |
| |
1203 | 1236 |
| |
1204 | 1237 |
| |
| |||
1293 | 1326 |
| |
1294 | 1327 |
| |
1295 | 1328 |
| |
1296 |
| - | |
| 1329 | + | |
1297 | 1330 |
| |
1298 | 1331 |
| |
1299 | 1332 |
| |
1300 |
| - | |
1301 |
| - | |
1302 | 1333 |
| |
1303 | 1334 |
| |
1304 | 1335 |
| |
| |||
1345 | 1376 |
| |
1346 | 1377 |
| |
1347 | 1378 |
| |
1348 |
| - | |
1349 |
| - | |
1350 |
| - | |
1351 |
| - | |
1352 |
| - | |
| 1379 | + | |
1353 | 1380 |
| |
1354 | 1381 |
| |
1355 | 1382 |
| |
| |||
1450 | 1477 |
| |
1451 | 1478 |
| |
1452 | 1479 |
| |
1453 |
| - | |
| 1480 | + | |
1454 | 1481 |
| |
1455 | 1482 |
| |
1456 | 1483 |
| |
1457 |
| - | |
1458 |
| - | |
1459 | 1484 |
| |
1460 | 1485 |
| |
1461 | 1486 |
| |
| |||
1474 | 1499 |
| |
1475 | 1500 |
| |
1476 | 1501 |
| |
1477 |
| - | |
1478 |
| - | |
1479 |
| - | |
1480 |
| - | |
1481 |
| - | |
| 1502 | + | |
1482 | 1503 |
| |
1483 | 1504 |
| |
1484 | 1505 |
| |
|
0 commit comments
Comments
(0)