Skip to content

Commit

Permalink
fix: remove the client lib header setting since after router migratio…
Browse files Browse the repository at this point in the history
…n, it is no longer needed (#1842)

* .

* .
  • Loading branch information
yirutang committed Oct 24, 2022
1 parent b569116 commit 5f3b821
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Expand Up @@ -77,7 +77,11 @@ private JsonStreamWriter(Builder builder)
this.descriptor =
BQTableSchemaToProtoDescriptor.convertBQTableSchemaToProtoDescriptor(builder.tableSchema);

streamWriterBuilder = StreamWriter.newBuilder(builder.streamName);
if (builder.client == null) {
streamWriterBuilder = StreamWriter.newBuilder(builder.streamName);
} else {
streamWriterBuilder = StreamWriter.newBuilder(builder.streamName, builder.client);
}
this.protoSchema = ProtoSchemaConverter.convert(this.descriptor);
this.totalMessageSize = protoSchema.getSerializedSize();
this.client = builder.client;
Expand Down
Expand Up @@ -19,7 +19,6 @@
import com.google.api.gax.batching.FlowController;
import com.google.api.gax.core.CredentialsProvider;
import com.google.api.gax.core.ExecutorProvider;
import com.google.api.gax.rpc.FixedHeaderProvider;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.auto.value.AutoOneOf;
import com.google.auto.value.AutoValue;
Expand Down Expand Up @@ -276,10 +275,6 @@ private BigQueryWriteClient getBigQueryWriteClient(Builder builder) throws IOExc
.setCredentialsProvider(builder.credentialsProvider)
.setTransportChannelProvider(builder.channelProvider)
.setEndpoint(builder.endpoint)
// (b/185842996): Temporily fix this by explicitly providing the header.
.setHeaderProvider(
FixedHeaderProvider.create(
"x-goog-request-params", "write_stream=" + this.streamName))
.build();
testOnlyClientCreatedTimes++;
return BigQueryWriteClient.create(stubSettings);
Expand Down Expand Up @@ -391,11 +386,7 @@ public void close() {
singleConnectionOrConnectionPool.close(this);
}

/**
* Constructs a new {@link StreamWriterV2.Builder} using the given stream and client. AppendRows
* needs special headers to be added to client, so a passed in client will not work. This should
* be used by test only.
*/
/** Constructs a new {@link StreamWriterV2.Builder} using the given stream and client. */
public static StreamWriter.Builder newBuilder(String streamName, BigQueryWriteClient client) {
return new StreamWriter.Builder(streamName, client);
}
Expand Down

0 comments on commit 5f3b821

Please sign in to comment.