Skip to content

Commit

Permalink
feat: add configuration in json steam writer to configure the timeout…
Browse files Browse the repository at this point in the history
… in request waiting queue (#2362)

* make the request timeout configurable in connection worker

* feat: add api to set the maximum wait queue wait time
  • Loading branch information
GaoleMeng committed Jan 10, 2024
1 parent 1893b3f commit db527be
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -23,6 +23,7 @@
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.protobuf.Descriptors;
import java.io.IOException;
import java.time.Duration;
import java.util.Map;
import org.json.JSONArray;

Expand Down Expand Up @@ -193,6 +194,16 @@ public static Builder newBuilder(String streamOrTableName, BigQueryWriteClient c
SchemaAwareStreamWriter.newBuilder(streamOrTableName, client, JsonToProtoMessage.INSTANCE));
}

/**
* Sets the maximum time a request is allowed to be waiting in request waiting queue. Under very
* low chance, it's possible for append request to be waiting indefintely for request callback
* when Google networking SDK does not detect the networking breakage. The default timeout is 15
* minutes. We are investigating the root cause for callback not triggered by networking SDK.
*/
public static void setMaxRequestCallbackWaitTime(Duration waitTime) {
ConnectionWorker.MAXIMUM_REQUEST_CALLBACK_WAIT_TIME = waitTime;
}

@Override
public void close() {
this.schemaAwareStreamWriter.close();
Expand Down

0 comments on commit db527be

Please sign in to comment.