forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit37c87e6
committed
Change relpath() et al to return path by value
For AIO, and also some other recent patches, we need the ability to callrelpath() in a critical section. Until now that was not feasible, as itallocated memory.The fact that relpath() allocated memory also made it awkward to use in logmessages because we had to take care to free the memory afterwards. Which wee.g. didn't do for when zeroing out an invalid buffer.We discussed other solutions, e.g. filling a pre-allocated buffer that'spassed to relpath(), but they all came with plenty downsides or were largerprojects. The easiest fix seems to be to make relpath() return the path byvalue.To be able to return the path by value we need to determine the maximum lengthof a relation path. This patch adds a long #define that computes the exactmaximum, which is verified to be correct in a regression test.As this change the signature of relpath(), extensions using it will need toadapt their code. We discussed leaving a backward-compat shim in place, butdecided it's not worth it given the use of relpath() doesn't seem widespread.Discussion:https://postgr.es/m/xeri5mla4b5syjd5a25nok5iez2kr3bm26j2qn4u7okzof2bmf@kwdh2vf7npra1 parent32c393f commit37c87e6
File tree
18 files changed
+218
-159
lines changed- src
- backend
- access
- rmgrdesc
- transam
- backup
- catalog
- replication/logical
- storage
- buffer
- smgr
- utils/adt
- bin/pg_rewind
- common
- include/common
- test/regress
- expected
- sql
- tools/pgindent
18 files changed
+218
-159
lines changedLines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
30 | 29 |
| |
31 |
| - | |
32 |
| - | |
| 30 | + | |
| 31 | + | |
33 | 32 |
| |
34 | 33 |
| |
35 | 34 |
| |
36 | 35 |
| |
37 |
| - | |
38 | 36 |
| |
39 |
| - | |
| 37 | + | |
| 38 | + | |
40 | 39 |
| |
41 |
| - | |
42 | 40 |
| |
43 | 41 |
| |
44 | 42 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
287 | 287 |
| |
288 | 288 |
| |
289 | 289 |
| |
290 |
| - | |
291 |
| - | |
292 |
| - | |
293 |
| - | |
| 290 | + | |
| 291 | + | |
294 | 292 |
| |
295 | 293 |
| |
296 | 294 |
| |
|
Lines changed: 9 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
86 | 86 |
| |
87 | 87 |
| |
88 | 88 |
| |
89 |
| - | |
| 89 | + | |
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
93 |
| - | |
| 93 | + | |
94 | 94 |
| |
95 | 95 |
| |
96 |
| - | |
97 |
| - | |
| 96 | + | |
98 | 97 |
| |
99 | 98 |
| |
100 | 99 |
| |
| |||
180 | 179 |
| |
181 | 180 |
| |
182 | 181 |
| |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
191 | 185 |
| |
192 | 186 |
| |
193 | 187 |
| |
| |||
213 | 207 |
| |
214 | 208 |
| |
215 | 209 |
| |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
224 | 213 |
| |
225 | 214 |
| |
226 | 215 |
| |
|
Lines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
625 | 625 |
| |
626 | 626 |
| |
627 | 627 |
| |
628 |
| - | |
| 628 | + | |
629 | 629 |
| |
630 | 630 |
| |
631 | 631 |
| |
632 | 632 |
| |
633 | 633 |
| |
634 | 634 |
| |
635 |
| - | |
| 635 | + | |
636 | 636 |
| |
637 | 637 |
| |
638 | 638 |
| |
639 | 639 |
| |
640 |
| - | |
| 640 | + | |
641 | 641 |
| |
642 |
| - | |
643 |
| - | |
644 |
| - | |
| 642 | + | |
645 | 643 |
| |
646 | 644 |
| |
647 | 645 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
528 | 528 |
| |
529 | 529 |
| |
530 | 530 |
| |
531 |
| - | |
| 531 | + | |
532 | 532 |
| |
533 | 533 |
| |
534 | 534 |
| |
| |||
580 | 580 |
| |
581 | 581 |
| |
582 | 582 |
| |
583 |
| - | |
| 583 | + | |
584 | 584 |
| |
585 | 585 |
| |
586 | 586 |
| |
| |||
596 | 596 |
| |
597 | 597 |
| |
598 | 598 |
| |
599 |
| - | |
600 |
| - | |
601 | 599 |
| |
602 | 600 |
| |
603 | 601 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
524 | 524 |
| |
525 | 525 |
| |
526 | 526 |
| |
527 |
| - | |
| 527 | + | |
528 | 528 |
| |
529 | 529 |
| |
530 | 530 |
| |
531 | 531 |
| |
532 | 532 |
| |
533 | 533 |
| |
534 |
| - | |
| 534 | + | |
535 | 535 |
| |
536 | 536 |
| |
537 | 537 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2329 | 2329 |
| |
2330 | 2330 |
| |
2331 | 2331 |
| |
2332 |
| - | |
| 2332 | + | |
2333 | 2333 |
| |
2334 | 2334 |
| |
2335 | 2335 |
| |
2336 | 2336 |
| |
2337 | 2337 |
| |
2338 | 2338 |
| |
2339 | 2339 |
| |
2340 |
| - | |
| 2340 | + | |
2341 | 2341 |
| |
2342 | 2342 |
| |
2343 | 2343 |
| |
|
Lines changed: 18 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1541 | 1541 |
| |
1542 | 1542 |
| |
1543 | 1543 |
| |
1544 |
| - | |
| 1544 | + | |
1545 | 1545 |
| |
1546 | 1546 |
| |
1547 | 1547 |
| |
1548 | 1548 |
| |
1549 | 1549 |
| |
1550 | 1550 |
| |
1551 | 1551 |
| |
1552 |
| - | |
| 1552 | + | |
1553 | 1553 |
| |
1554 | 1554 |
| |
1555 | 1555 |
| |
| |||
2284 | 2284 |
| |
2285 | 2285 |
| |
2286 | 2286 |
| |
2287 |
| - | |
| 2287 | + | |
2288 | 2288 |
| |
2289 | 2289 |
| |
2290 | 2290 |
| |
| |||
2355 | 2355 |
| |
2356 | 2356 |
| |
2357 | 2357 |
| |
2358 |
| - | |
| 2358 | + | |
| 2359 | + | |
2359 | 2360 |
| |
2360 | 2361 |
| |
2361 | 2362 |
| |
| |||
3663 | 3664 |
| |
3664 | 3665 |
| |
3665 | 3666 |
| |
3666 |
| - | |
3667 | 3667 |
| |
3668 | 3668 |
| |
3669 | 3669 |
| |
| |||
3683 | 3683 |
| |
3684 | 3684 |
| |
3685 | 3685 |
| |
3686 |
| - | |
3687 |
| - | |
3688 | 3686 |
| |
3689 | 3687 |
| |
3690 | 3688 |
| |
3691 |
| - | |
| 3689 | + | |
| 3690 | + | |
| 3691 | + | |
3692 | 3692 |
| |
3693 | 3693 |
| |
3694 |
| - | |
3695 | 3694 |
| |
3696 | 3695 |
| |
3697 | 3696 |
| |
| |||
5611 | 5610 |
| |
5612 | 5611 |
| |
5613 | 5612 |
| |
5614 |
| - | |
5615 |
| - | |
5616 |
| - | |
5617 |
| - | |
5618 | 5613 |
| |
5619 | 5614 |
| |
5620 | 5615 |
| |
5621 |
| - | |
| 5616 | + | |
| 5617 | + | |
| 5618 | + | |
5622 | 5619 |
| |
5623 |
| - | |
5624 | 5620 |
| |
5625 | 5621 |
| |
5626 | 5622 |
| |
| |||
5637 | 5633 |
| |
5638 | 5634 |
| |
5639 | 5635 |
| |
5640 |
| - | |
5641 |
| - | |
5642 |
| - | |
5643 |
| - | |
5644 | 5636 |
| |
5645 |
| - | |
5646 |
| - | |
5647 |
| - | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
5648 | 5640 |
| |
5649 | 5641 |
| |
5650 | 5642 |
| |
| |||
5656 | 5648 |
| |
5657 | 5649 |
| |
5658 | 5650 |
| |
5659 |
| - | |
5660 |
| - | |
5661 |
| - | |
5662 |
| - | |
5663 |
| - | |
5664 | 5651 |
| |
5665 |
| - | |
5666 |
| - | |
5667 |
| - | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
5668 | 5656 |
| |
5669 | 5657 |
| |
5670 | 5658 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
360 | 360 |
| |
361 | 361 |
| |
362 | 362 |
| |
363 |
| - | |
| 363 | + | |
364 | 364 |
| |
365 | 365 |
| |
366 | 366 |
| |
| |||
510 | 510 |
| |
511 | 511 |
| |
512 | 512 |
| |
513 |
| - | |
| 513 | + | |
514 | 514 |
| |
515 | 515 |
| |
516 | 516 |
| |
| |||
555 | 555 |
| |
556 | 556 |
| |
557 | 557 |
| |
558 |
| - | |
| 558 | + | |
559 | 559 |
| |
560 | 560 |
| |
561 | 561 |
| |
|
0 commit comments
Comments
(0)