diff --git a/google-cloud-bigquerystorage/clirr-ignored-differences.xml b/google-cloud-bigquerystorage/clirr-ignored-differences.xml index d8507fe060..610dcf5343 100644 --- a/google-cloud-bigquerystorage/clirr-ignored-differences.xml +++ b/google-cloud-bigquerystorage/clirr-ignored-differences.xml @@ -23,4 +23,9 @@ com.google.protobuf.DynamicMessage convertJsonToProtoMessage(com.google.protobuf.Descriptors$Descriptor, org.json.JSONObject, boolean) com.google.protobuf.DynamicMessage convertJsonToProtoMessage(com.google.protobuf.Descriptors$Descriptor, org.json.JSONObject) + + com/google/cloud/bigquery/storage/v1beta2/StreamWriter + 7002 + void flushAll(long) + \ No newline at end of file diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriter.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriter.java index 897d379143..0d760e327c 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriter.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriter.java @@ -272,37 +272,9 @@ public ApiFuture append(AppendRowsRequest message) { messagesBatchLock.unlock(); appendAndRefreshAppendLock.unlock(); } - return outstandingAppend.appendResult; } - /** - * This is the general flush method for asynchronise append operation. When you have outstanding - * append requests, calling flush will make sure all outstanding append requests completed and - * successful. Otherwise there will be an exception thrown. - * - * @throws Exception - */ - public void flushAll(long timeoutMillis) throws Exception { - appendAndRefreshAppendLock.lock(); - try { - writeAllOutstanding(); - synchronized (messagesWaiter) { - messagesWaiter.waitComplete(timeoutMillis); - } - } finally { - appendAndRefreshAppendLock.unlock(); - } - exceptionLock.lock(); - try { - if (streamException != null) { - throw new Exception(streamException); - } - } finally { - exceptionLock.unlock(); - } - } - /** * Re-establishes a stream connection. * diff --git a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java index aeb25a2fcc..664f21c35e 100644 --- a/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java +++ b/google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java @@ -863,44 +863,6 @@ public void testExistingClient() throws Exception { client.awaitTermination(1, TimeUnit.MINUTES); } - @Test - public void testFlushAll() throws Exception { - StreamWriter writer = - getTestStreamWriterBuilder() - .setBatchingSettings( - StreamWriter.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(100000)) - .build()) - .build(); - - testBigQueryWrite.addResponse( - AppendRowsResponse.newBuilder() - .setAppendResult( - AppendRowsResponse.AppendResult.newBuilder().setOffset(Int64Value.of(0)).build()) - .build()); - testBigQueryWrite.addResponse( - AppendRowsResponse.newBuilder() - .setAppendResult( - AppendRowsResponse.AppendResult.newBuilder().setOffset(Int64Value.of(2)).build()) - .build()); - testBigQueryWrite.addResponse( - AppendRowsResponse.newBuilder() - .setAppendResult( - AppendRowsResponse.AppendResult.newBuilder().setOffset(Int64Value.of(3)).build()) - .build()); - - ApiFuture appendFuture1 = sendTestMessage(writer, new String[] {"A"}); - ApiFuture appendFuture2 = sendTestMessage(writer, new String[] {"B"}); - ApiFuture appendFuture3 = sendTestMessage(writer, new String[] {"C"}); - assertFalse(appendFuture3.isDone()); - writer.flushAll(100000); - assertTrue(appendFuture3.isDone()); - - writer.close(); - } - @Test public void testDatasetTraceId() throws Exception { StreamWriter writer =