Skip to content

Commit

Permalink
fix: Remove per-message byte limit in client (#435)
Browse files Browse the repository at this point in the history
* fix: Remove per-message byte limit in client

There still exists a 3.5MiB byte limit server side, and a protocol level 4MiB message limit.

* fix: clirr
  • Loading branch information
dpcollins-google committed Jan 12, 2021
1 parent 313b2e1 commit f7f36eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
5 changes: 5 additions & 0 deletions google-cloud-pubsublite/clirr-ignored-differences.xml
Expand Up @@ -6,6 +6,11 @@
<differenceType>8001</differenceType>
<className>com/google/cloud/pubsublite/ProjectLookupUtils</className>
</difference>
<difference>
<differenceType>6011</differenceType>
<className>com/google/cloud/pubsublite/Constants</className>
<field>MAX_PUBLISH_MESSAGE_BYTES</field>
</difference>
<!-- Blanket ignored files -->
<difference>
<differenceType>4001</differenceType>
Expand Down
Expand Up @@ -31,7 +31,6 @@ public class Constants {
.build();

public static final long MAX_PUBLISH_BATCH_COUNT = 1_000;
public static final long MAX_PUBLISH_MESSAGE_BYTES = 1_000_000;
public static final long MAX_PUBLISH_BATCH_BYTES = 3_500_000;

private Constants() {}
Expand Down
Expand Up @@ -26,7 +26,6 @@
import com.google.api.gax.batching.BatchingSettings;
import com.google.api.gax.rpc.ApiException;
import com.google.api.gax.rpc.StatusCode.Code;
import com.google.cloud.pubsublite.Constants;
import com.google.cloud.pubsublite.Message;
import com.google.cloud.pubsublite.Offset;
import com.google.cloud.pubsublite.internal.CheckedApiException;
Expand Down Expand Up @@ -208,21 +207,6 @@ private void terminateOutstandingPublishes(CheckedApiException e) {
@Override
public ApiFuture<Offset> publish(Message message) {
PubSubMessage proto = message.toProto();
if (proto.getSerializedSize() > Constants.MAX_PUBLISH_MESSAGE_BYTES) {
CheckedApiException error =
new CheckedApiException(
String.format(
"Tried to send message with serialized size %s larger than limit %s on the"
+ " stream.",
proto.getSerializedSize(), Constants.MAX_PUBLISH_MESSAGE_BYTES),
Code.FAILED_PRECONDITION);
try (CloseableMonitor.Hold h = monitor.enter()) {
if (!shutdown) {
onPermanentError(error);
}
}
return ApiFutures.immediateFailedFuture(error);
}
try (CloseableMonitor.Hold h = monitor.enter()) {
ApiService.State currentState = state();
checkState(
Expand Down

0 comments on commit f7f36eb

Please sign in to comment.