forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7259736

Amit Kapila
Implement streaming mode in ReorderBuffer.
Instead of serializing the transaction to disk after reaching thelogical_decoding_work_mem limit in memory, we consume the changes we havein memory and invoke stream API methods added by commit45fdc97.However, sometimes if we have incomplete toast or speculative insert wespill to the disk because we can't generate the complete tuple and stream.And, as soon as we get the complete tuple we stream the transactionincluding the serialized changes.We can do this incremental processing thanks to having assignments(associating subxact with toplevel xacts) in WAL right away, andthanks to logging the invalidation messages at each command end. Thesefeatures are added by commits0bead9a andc55040c respectively.Now that we can stream in-progress transactions, the concurrent abortsmay cause failures when the output plugin consults catalogs (both systemand user-defined).We handle such failures by returning ERRCODE_TRANSACTION_ROLLBACKsqlerrcode from system table scan APIs to the backend or WALSenderdecoding a specific uncommitted transaction. The decoding logic on thereceipt of such a sqlerrcode aborts the decoding of the currenttransaction and continue with the decoding of other transactions.We have ReorderBufferTXN pointer in each ReorderBufferChange by which weknow which xact it belongs to. The output plugin can use this to decidewhich changes to discard in case of stream_abort_cb (e.g. when a subxactgets discarded).We also provide a new option via SQL APIs to fetch the changes beingstreamed.Author: Dilip Kumar, Tomas Vondra, Amit Kapila, Nikhil SontakkeReviewed-by: Amit Kapila, Kuntal Ghosh, Ajin CherianTested-by: Neha Sharma, Mahendra Singh Thalor and Ajin CherianDiscussion:https://postgr.es/m/688b0b7f-2f6c-d827-c27b-216a8e3ea700@2ndquadrant.com1 parent0a7d771 commit7259736
File tree
21 files changed
+1331
-106
lines changed- contrib/test_decoding
- expected
- sql
- doc/src/sgml
- src
- backend
- access
- heap
- index
- table
- transam
- replication/logical
- include
- access
- replication
21 files changed
+1331
-106
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
| 8 | + | |
9 | 9 |
| |
10 | 10 |
| |
11 | 11 |
| |
|
Lines changed: 94 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + |
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + |
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| 14 | + |
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
| 125 | + | |
125 | 126 |
| |
126 | 127 |
| |
127 | 128 |
| |
| |||
212 | 213 |
| |
213 | 214 |
| |
214 | 215 |
| |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
215 | 226 |
| |
216 | 227 |
| |
217 | 228 |
| |
| |||
221 | 232 |
| |
222 | 233 |
| |
223 | 234 |
| |
| 235 | + | |
| 236 | + | |
224 | 237 |
| |
225 | 238 |
| |
226 | 239 |
| |
|
Lines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
433 | 433 |
| |
434 | 434 |
| |
435 | 435 |
| |
436 |
| - | |
437 |
| - | |
438 |
| - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
439 | 442 |
| |
440 | 443 |
| |
441 | 444 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
42 | 64 |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1299 | 1299 |
| |
1300 | 1300 |
| |
1301 | 1301 |
| |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
1302 | 1312 |
| |
1303 | 1313 |
| |
1304 | 1314 |
| |
| |||
1956 | 1966 |
| |
1957 | 1967 |
| |
1958 | 1968 |
| |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
1959 | 1972 |
| |
1960 | 1973 |
| |
1961 | 1974 |
| |
|
Lines changed: 37 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1571 | 1571 |
| |
1572 | 1572 |
| |
1573 | 1573 |
| |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
1574 | 1591 |
| |
1575 |
| - | |
| 1592 | + | |
1576 | 1593 |
| |
1577 | 1594 |
| |
1578 | 1595 |
| |
| |||
1642 | 1659 |
| |
1643 | 1660 |
| |
1644 | 1661 |
| |
1645 |
| - | |
1646 |
| - | |
1647 |
| - | |
1648 |
| - | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1649 | 1681 |
| |
1650 | 1682 |
| |
1651 | 1683 |
| |
|
0 commit comments
Comments
(0)