googleapis / java-spanner Public
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
feat!: remove session pool preparing #515
Conversation
Codecov Report
@@ Coverage Diff @@
## inline-begin-tx #515 +/- ##
=====================================================
- Coverage 82.31% 82.12% -0.19%
- Complexity 2419 2429 +10
=====================================================
Files 138 138
Lines 13518 13480 -38
Branches 1269 1299 +30
=====================================================
- Hits 11127 11071 -56
+ Misses 1885 1881 -4
- Partials 506 528 +22 Continue to review full report at Codecov.
|
PooledSessionFuture session = | ||
mode == SessionMode.READ_WRITE ? getReadWriteSession() : getReadSession(); | ||
private <T> T runWithSessionRetry(Function<Session, T> callable) { | ||
PooledSessionFuture session = getReadSession(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could we rename methods such as getReadSession()
to getSession()
now that we do not have such separation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -36,9 +36,14 @@ | |||
private static final LabelValue UNSET_LABEL = LabelValue.create(null); | |||
|
|||
static final LabelValue NUM_IN_USE_SESSIONS = LabelValue.create("num_in_use_sessions"); | |||
|
|||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could we add javadocs on the deprecation notice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} else { | ||
span.addAnnotation("Acquired read only session"); | ||
span.addAnnotation("Acquired rsession"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo rsession
-> session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -765,7 +762,7 @@ public void setSpan(Span span) { | |||
new Callable<T>() { | |||
@Override | |||
public T call() { | |||
boolean useInlinedBegin = inlineBegin; | |||
boolean useInlinedBegin = true; | |||
if (attempt.get() > 0) { | |||
if (useInlinedBegin) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove the branching here, since useInlinedBegin
is always true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's quite useless. Thanks for noticing.
* feat: inline begin tx with first statement * feat: support inlining BeginTransaction * fix: invalid dml statement can still return tx id * bench: add benchmarks for inline begin * feat: add inline begin for async runner * test: add additional tests and ITs * test: add tests for error during tx * test: use statement with same error code on emulator * test: skip test on emulator * test: constraint error causes transaction to be invalidated * fix: retry transaction if first statements fails and had BeginTransaction option * fix: handle aborted exceptions * test: add additional tests for corner cases * feat: use single-use tx for idem-potent mutations * fix: remove check for idempotent mutations * chore: remove commented code * feat!: remove session pool preparing (#515) * feat: remove session pool preparing * fix: fix integration tests * test: fix malformed retry loop in test case * fix: review comments * chore: run formatter * test: fix integration test that relied on data from other test case
Removes the feature for preparing sessions in the session pool. This is step 2 of inlining
BeginTransaction
with the first statement of a transaction.