This is an automated email from the ASF dual-hosted git repository.
scwhittle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 7e4dc66ba20 Change pubsub message cap size from 10MiB to 10MB (#29791)
7e4dc66ba20 is described below
commit 7e4dc66ba208a8bc53c03f52945b95713b74fbaf
Author: Arun Pandian <[email protected]>
AuthorDate: Thu Dec 21 09:49:45 2023 -0800
Change pubsub message cap size from 10MiB to 10MB (#29791)
Pubsub's max allowed message size is 10million bytes and not 10 * 2^20
bytes https://cloud.google.com/pubsub/quotas
Co-authored-by: Arun Pandian <[email protected]>
---
.../src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java | 2 +-
sdks/python/apache_beam/io/gcp/pubsub.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
index f79299aea5f..e281e559a54 100644
---
a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
+++
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubIO.java
@@ -194,7 +194,7 @@ public class PubsubIO {
private static final Pattern PUBSUB_NAME_REGEXP =
Pattern.compile("[a-zA-Z][-._~%+a-zA-Z0-9]+");
- static final int PUBSUB_MESSAGE_MAX_TOTAL_SIZE = 10 << 20;
+ static final int PUBSUB_MESSAGE_MAX_TOTAL_SIZE = 10_000_000;
private static final int PUBSUB_NAME_MIN_LENGTH = 3;
private static final int PUBSUB_NAME_MAX_LENGTH = 255;
diff --git a/sdks/python/apache_beam/io/gcp/pubsub.py
b/sdks/python/apache_beam/io/gcp/pubsub.py
index af58006d6e7..d0785fa1f21 100644
--- a/sdks/python/apache_beam/io/gcp/pubsub.py
+++ b/sdks/python/apache_beam/io/gcp/pubsub.py
@@ -150,7 +150,7 @@ class PubsubMessage(object):
containing the payload of this object.
"""
msg = pubsub.types.PubsubMessage()
- if len(self.data) > (10 << 20):
+ if len(self.data) > (10_000_000):
raise ValueError('A pubsub message data field must not exceed 10MB')
msg.data = self.data
@@ -179,7 +179,7 @@ class PubsubMessage(object):
msg.ordering_key = self.ordering_key
serialized = pubsub.types.PubsubMessage.serialize(msg)
- if len(serialized) > (10 << 20):
+ if len(serialized) > (10_000_000):
raise ValueError(
'Serialized pubsub message exceeds the publish request limit of
10MB')
return serialized