Skip to content

Commit

Permalink
fix: temporally disable refreshAppend (#853)
Browse files Browse the repository at this point in the history
* fix:temporily disable refreshAppend

* .

* .

* .

* Revert "."

This reverts commit 9a29abe.
  • Loading branch information
yirutang committed Feb 19, 2021
1 parent fc2d137 commit baf973d
Show file tree
Hide file tree
Showing 3 changed files with 608 additions and 618 deletions.
Expand Up @@ -35,6 +35,7 @@
import com.google.api.gax.rpc.ResponseObserver;
import com.google.api.gax.rpc.StreamController;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnimplementedException;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.common.base.Preconditions;
import com.google.protobuf.Int64Value;
Expand Down Expand Up @@ -281,27 +282,7 @@ public ApiFuture<AppendRowsResponse> append(AppendRowsRequest message) {
* @throws InterruptedException
*/
public void refreshAppend() throws InterruptedException {
appendAndRefreshAppendLock.lock();
if (shutdown.get()) {
LOG.warning("Cannot refresh on a already shutdown writer.");
appendAndRefreshAppendLock.unlock();
return;
}
// There could be a moment, stub is not yet initialized.
if (clientStream != null) {
LOG.info("Closing the stream " + streamName);
clientStream.closeSend();
}
messagesBatch.resetAttachSchema();
bidiStreamingCallable = stub.appendRowsCallable();
clientStream = bidiStreamingCallable.splitCall(responseObserver);
while (!clientStream.isSendReady()) {
Thread.sleep(10);
}
Thread.sleep(this.retrySettings.getInitialRetryDelay().toMillis());
// Can only unlock here since need to sleep the full 7 seconds before stream can allow appends.
appendAndRefreshAppendLock.unlock();
LOG.info("Write Stream " + streamName + " connection established");
throw new UnimplementedException(null, GrpcStatusCode.of(Status.Code.UNIMPLEMENTED), false);
}

private void setupAlarm() {
Expand Down

0 comments on commit baf973d

Please sign in to comment.