Commit fe2bc29
Support writing to Pubsub with ordering key; Add PubsubMessage SchemaCoder (#31608)
* support writing pubsub messages with ordering key
* Add ordering key size validation to validatePubsubMessageSize
* Refactor writeMessagesWithOrderingKey into withOrderingKey
* Route to bad records if key is defined, but would be dropped silently
* Add publishBatchWithOrderingKey to PubsubUnboundedSink
* Abort override if PubsubUnboundedSink set publishBatchWithOrderingKey
* Add support for ordering keys in PubsubBoundedWriter
* Add support for ordering keys in PubsubUnboundedSink
* Remove nullable ordering keys, null and empty are equivalent
* Construct OutgoingMessage with Beam PubsubMessage to reduce repetition
* Improve readability of PubsubUnboundedSink batch assignment
* Add size validation TODOs
* Replace auto-sharding sink comment with FR link, move to relevant place
* Add links to Pub/Sub documentation
* Refine comment about lack of ordering key support in Dataflow's sink
Co-authored-by: Ahmed Abualsaud <65791736+ahmedabu98@users.noreply.github.com>
* Add TODO to remove ordering key check once all sinks support this
* Add missing return statement
Co-authored-by: Ahmed Abualsaud <65791736+ahmedabu98@users.noreply.github.com>
* Remove duplicated statements
* Apply Spotless
* Add notable changes
* address comments
* allow messages with ordering keys even when the sink isn't configured to accept ordering keys
* spotless
* spotless
* add warning log when ordering key is not configured
* address comments
* Distribute ordering keys across shards with consistent hashing
* Drop the ordering key field if ordering key writes are disabled
* Add more context to TODOs and remove one TODO occurrence
* Add soft deprecation notice to coders for maintainers of PubsubIO
* Use attachValues instead of constructing a map of named fields
* Apply suggestions from code review
* Add missing import of Nullable
* Fix row builder
* Add missing nullable annotation to attachValues
* Remove unused field pubishBatchSize
* Rewrite integration test for ordering key writes
* Fix assertion failure on empty ordering key
* Add comments
* Add unit tests for ordering key writes
* Unconditionally reset test client state to prevent global state corruption across tests
* Shuffle input for multiple ordering key batches
* Add comment above call to shuffle
---------
Co-authored-by: Steven van Rossum <sjvanrossum@google.com>
Co-authored-by: Steven van Rossum <stevenvanrossum@gmail.com>1 parent e038ad3 commit fe2bc29
File tree
20 files changed
+678
-78
lines changed- runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow
- sdks/java
- core/src/main/java/org/apache/beam/sdk/values
- io/google-cloud-platform/src
- main/java/org/apache/beam/sdk/io/gcp/pubsub
- test/java/org/apache/beam/sdk/io/gcp/pubsub
20 files changed
+678
-78
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
2150 | 2151 | | |
2151 | 2152 | | |
2152 | 2153 | | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
2153 | 2163 | | |
2154 | 2164 | | |
2155 | 2165 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
832 | | - | |
| 832 | + | |
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
| |||
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
| 48 | + | |
43 | 49 | | |
44 | | - | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
69 | 89 | | |
70 | 90 | | |
71 | 91 | | |
| |||
125 | 145 | | |
126 | 146 | | |
127 | 147 | | |
| 148 | + | |
128 | 149 | | |
129 | 150 | | |
130 | 151 | | |
131 | 152 | | |
132 | 153 | | |
133 | 154 | | |
| 155 | + | |
134 | 156 | | |
135 | 157 | | |
136 | 158 | | |
| |||
179 | 201 | | |
180 | 202 | | |
181 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
182 | 214 | | |
183 | 215 | | |
184 | 216 | | |
| |||
Lines changed: 58 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
1378 | 1377 | | |
1379 | 1378 | | |
1380 | 1379 | | |
| 1380 | + | |
| 1381 | + | |
1381 | 1382 | | |
1382 | 1383 | | |
1383 | 1384 | | |
| |||
1393 | 1394 | | |
1394 | 1395 | | |
1395 | 1396 | | |
| 1397 | + | |
1396 | 1398 | | |
1397 | 1399 | | |
1398 | 1400 | | |
| |||
1425 | 1427 | | |
1426 | 1428 | | |
1427 | 1429 | | |
| 1430 | + | |
| 1431 | + | |
1428 | 1432 | | |
1429 | 1433 | | |
1430 | 1434 | | |
| |||
1510 | 1514 | | |
1511 | 1515 | | |
1512 | 1516 | | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1513 | 1530 | | |
1514 | 1531 | | |
1515 | 1532 | | |
| |||
1586 | 1603 | | |
1587 | 1604 | | |
1588 | 1605 | | |
| 1606 | + | |
1589 | 1607 | | |
1590 | 1608 | | |
1591 | 1609 | | |
| |||
1597 | 1615 | | |
1598 | 1616 | | |
1599 | 1617 | | |
1600 | | - | |
1601 | | - | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
1602 | 1624 | | |
1603 | 1625 | | |
1604 | 1626 | | |
| |||
1618 | 1640 | | |
1619 | 1641 | | |
1620 | 1642 | | |
| 1643 | + | |
1621 | 1644 | | |
1622 | 1645 | | |
1623 | 1646 | | |
| |||
1679 | 1702 | | |
1680 | 1703 | | |
1681 | 1704 | | |
1682 | | - | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
1683 | 1708 | | |
1684 | 1709 | | |
1685 | 1710 | | |
| |||
1710 | 1735 | | |
1711 | 1736 | | |
1712 | 1737 | | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1713 | 1741 | | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
1718 | 1751 | | |
1719 | 1752 | | |
1720 | 1753 | | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
| 1754 | + | |
1733 | 1755 | | |
1734 | 1756 | | |
1735 | | - | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
1739 | | - | |
1740 | | - | |
1741 | | - | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
1745 | 1769 | | |
1746 | 1770 | | |
1747 | | - | |
1748 | | - | |
1749 | | - | |
1750 | | - | |
1751 | | - | |
| 1771 | + | |
| 1772 | + | |
1752 | 1773 | | |
1753 | 1774 | | |
1754 | 1775 | | |
1755 | 1776 | | |
1756 | | - | |
1757 | | - | |
| 1777 | + | |
| 1778 | + | |
1758 | 1779 | | |
1759 | 1780 | | |
1760 | 1781 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | | - | |
233 | | - | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
115 | 125 | | |
116 | 126 | | |
117 | 127 | | |
| |||
0 commit comments