-
Notifications
You must be signed in to change notification settings - Fork 132
feat: Leader Aware Routing #2214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2cd2fbd
b57466a
32da417
cde93a3
606bbda
0156457
1bbd24d
f9152cd
90d455c
b1d44ce
c5d34ab
9c212af
426265d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,7 +275,7 @@ public AsyncTransactionManagerImpl transactionManagerAsync(TransactionOption... | |
@Override | ||
public void prepareReadWriteTransaction() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not relevant for this PR, but note to self/other readers: This seems like a method that can be cleaned up. I don't think it is in use anymore. @rajatbhatta Would you mind taking a look at that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'll take a look. @yifanzyifanz: Please keep this comment unresolved for the time being. |
||
setActive(null); | ||
readyTransactionId = beginTransaction(); | ||
readyTransactionId = beginTransaction(true); | ||
} | ||
|
||
@Override | ||
|
@@ -296,21 +296,21 @@ public void close() { | |
} | ||
} | ||
|
||
ByteString beginTransaction() { | ||
ByteString beginTransaction(boolean routeToLeader) { | ||
try { | ||
return beginTransactionAsync().get(); | ||
return beginTransactionAsync(routeToLeader).get(); | ||
} catch (ExecutionException e) { | ||
throw SpannerExceptionFactory.newSpannerException(e.getCause() == null ? e : e.getCause()); | ||
} catch (InterruptedException e) { | ||
throw SpannerExceptionFactory.propagateInterrupt(e); | ||
} | ||
} | ||
|
||
ApiFuture<ByteString> beginTransactionAsync() { | ||
return beginTransactionAsync(Options.fromTransactionOptions()); | ||
ApiFuture<ByteString> beginTransactionAsync(boolean routeToLeader) { | ||
return beginTransactionAsync(Options.fromTransactionOptions(), routeToLeader); | ||
} | ||
|
||
ApiFuture<ByteString> beginTransactionAsync(Options transactionOptions) { | ||
ApiFuture<ByteString> beginTransactionAsync(Options transactionOptions, boolean routeToLeader) { | ||
final SettableApiFuture<ByteString> res = SettableApiFuture.create(); | ||
final Span span = tracer.spanBuilder(SpannerImpl.BEGIN_TRANSACTION).startSpan(); | ||
final BeginTransactionRequest request = | ||
|
@@ -319,7 +319,7 @@ ApiFuture<ByteString> beginTransactionAsync(Options transactionOptions) { | |
.setOptions(createReadWriteTransactionOptions(transactionOptions)) | ||
.build(); | ||
final ApiFuture<Transaction> requestFuture = | ||
spanner.getRpc().beginTransactionAsync(request, options); | ||
spanner.getRpc().beginTransactionAsync(request, options, routeToLeader); | ||
requestFuture.addListener( | ||
tracer.withSpan( | ||
span, | ||
|
Uh oh!
There was an error while loading. Please reload this page.