diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java index 7c66484ca3..95d10872ec 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java @@ -15,8 +15,6 @@ */ package com.google.cloud.bigtable.data.v2.models; -import static com.google.cloud.bigtable.data.v2.models.RowMutationEntry.MAX_MUTATION; - import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.bigtable.v2.MutateRowsRequest; @@ -37,14 +35,11 @@ *

This class is meant for manual batching. */ public final class BulkMutation implements Serializable, Cloneable { - private static final long serialVersionUID = 3522061250439399088L; private final String tableId; private transient MutateRowsRequest.Builder builder; - private long mutationCountSum = 0; - public static BulkMutation create(String tableId) { return new BulkMutation(tableId); } @@ -86,12 +81,6 @@ public BulkMutation add(@Nonnull ByteString rowKey, @Nonnull Mutation mutation) Preconditions.checkNotNull(rowKey); Preconditions.checkNotNull(mutation); - long mutationCount = mutation.getMutations().size(); - Preconditions.checkArgument( - mutationCountSum + mutationCount <= MAX_MUTATION, - String.format("Too many mutations, got %s, limit is %s", mutationCountSum, MAX_MUTATION)); - this.mutationCountSum += mutationCount; - builder.addEntries( MutateRowsRequest.Entry.newBuilder() .setRowKey(rowKey) @@ -106,7 +95,6 @@ public BulkMutation add(@Nonnull ByteString rowKey, @Nonnull Mutation mutation) */ public BulkMutation add(@Nonnull RowMutationEntry entry) { Preconditions.checkNotNull(entry, "Row mutation entry can't be null"); - builder.addEntries(entry.toProto()); return this; } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java index 5e40bd999c..63ffe708a5 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/RowMutationEntry.java @@ -33,8 +33,6 @@ public class RowMutationEntry implements MutationApi, Serializable { private static final long serialVersionUID = 1974738836742298192L; - static final int MAX_MUTATION = 100000; - private final ByteString key; private final Mutation mutation; @@ -182,11 +180,6 @@ public RowMutationEntry deleteRow() { @InternalApi public MutateRowsRequest.Entry toProto() { - Preconditions.checkArgument( - mutation.getMutations().size() <= MAX_MUTATION, - String.format( - "Too many mutations, got %s, limit is %s", - mutation.getMutations().size(), MAX_MUTATION)); return MutateRowsRequest.Entry.newBuilder() .setRowKey(key) .addAllMutations(mutation.getMutations()) diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java index 0e4c992648..dc06a58f5c 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/models/BulkMutationTest.java @@ -28,7 +28,6 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -173,31 +172,4 @@ public void fromProtoTest() { .matches(NameUtil.formatTableName(projectId, instanceId, TABLE_ID)); assertThat(overriddenRequest.getAppProfileId()).matches(appProfile); } - - @Test - public void testManyMutations() { - BulkMutation bulkMutation = BulkMutation.create(TABLE_ID); - - try { - for (int i = 0; i < 3; i++) { - String key = "key" + i; - Mutation mutation = Mutation.create(); - for (int j = 0; j < 50000; j++) { - mutation.setCell("f", "q" + j, "value"); - } - bulkMutation.add(key, mutation); - } - Assert.fail("Test should fail with IllegalArgumentException"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).contains("Too many mutations"); - } - - // we should be able to add 10000 mutations - bulkMutation = BulkMutation.create(TABLE_ID); - Mutation mutation = Mutation.create(); - for (int i = 0; i < 100000; i++) { - mutation.setCell("f", "q" + i, "value"); - } - bulkMutation.add("key", mutation); - } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java index d644291f95..bb5e89aab4 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/metrics/MetricsTracerTest.java @@ -439,7 +439,6 @@ public Object answer(InvocationOnMock invocation) throws Throwable { .reserve(any(Long.class), any(Long.class)); when(flowController.getMaxElementCountLimit()).thenReturn(null); when(flowController.getMaxRequestBytesLimit()).thenReturn(null); - when(batchingDescriptor.countBytes(any())).thenReturn(1l); when(batchingDescriptor.newRequestBuilder(any())).thenCallRealMethod(); doAnswer(