Repository navigation
fix(bigtable): handle empty SessionPoolConfiguration in SessionPoolImpl and PoolSizer #14912
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -286,6 +286,28 @@ public SessionPoolImpl( | |
| budget.updateConfig(newConfig); | ||
| poolSizer.updateConfig(newConfig); | ||
| picker.updateConfig(newConfig); | ||
| if (newConfig.equals( | ||
| SessionClientConfiguration.SessionPoolConfiguration.getDefaultInstance())) { | ||
|
Contributor
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. should we also cancel all pending vRPCs when config becomes empty? Otherwise they will be hanging out there until their deadlines. |
||
| if (retryCreateSessionFuture != null) { | ||
| retryCreateSessionFuture.cancel(); | ||
|
nimf marked this conversation as resolved.
Resolved
|
||
| retryCreateSessionFuture = null; | ||
| } | ||
| CloseSessionRequest closeReq = | ||
| CloseSessionRequest.newBuilder() | ||
| .setReason(CloseSessionReason.CLOSE_SESSION_REASON_DOWNSIZE) | ||
| .setDescription("SessionPool configuration disabled") | ||
| .build(); | ||
| for (SessionHandle handle : new ArrayList<>(sessions.getAllSessions())) { | ||
| handle.onSessionClosing(); | ||
|
Contributor
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. this is subject to two races
in both cases it will keep AFE in We can protect from this by guarding against // In SessionHandle.onSessionStarted():
poolStats.startingCount--;
if (inExpectedCount) {
afeHandle.sessions.add(this);
if (afeHandle.sessions.size() == 1) {
afesWithReadySessions.add(afeHandle);
}
poolStats.readyCount++;
}
// In SessionHandle.releaseToPool():
if (inExpectedCount && session.getState() == SessionState.READY) { |
||
| handle.getSession().close(closeReq); | ||
| } | ||
| } else if (poolState == PoolState.STARTED) { | ||
| while (poolSizer.getScaleDelta() > 0) { | ||
| if (!createSession(openParams)) { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| } finally { | ||
| poolLock.unlock(); | ||
| } | ||
|
|
@@ -537,7 +559,7 @@ public void onClose(SessionState prevState, Status status, Metadata trailers) { | |
|
|
||
| @GuardedBy("poolLock") | ||
| private void maybeScheduleCreateSessionRetry() { | ||
| if (retryCreateSessionFuture != null) { | ||
| if (retryCreateSessionFuture != null || budget.getMaxConcurrentRequest() <= 0) { | ||
| return; | ||
| } | ||
| // This interval could be 0 or negative if nextAvailableBudget is now. In which case | ||
|
|
||
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.
should it be
: pendingRpcs.getSize();instead? I.e., whenpendingVRpcsPerSessionis not defined we assume it's 1:1. I know it is not applicable for when config is empty / sessions are disabled, but we are not specifically checking it here.