Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties

# Build output captured to a file
*.log


#--- IntelliJ ignores ---
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,13 @@ private static boolean isBound(String value) {
* read bound that could not be lifted serves the borrower waiting for it and is closed
* afterwards: left in the pool it would fail every statement slower than that bound - an
* import batch among them - for every borrow the pool hands it to.
* <p>
* Turned off during a borrow as well as at establish time ({@link #keepOutOfThePool}): a session
* setting a borrower could not take off again is the same kind of thing, and the pool cannot
* notice one by itself - {@link #isUsable} validates with {@code isValid()}, a liveness check a
* connection carrying a stale setting passes.
*/
private final boolean poolable;
private volatile boolean poolable;

/**
* When this connection last answered the database, as a {@link System#nanoTime()} reading:
Expand Down Expand Up @@ -1223,6 +1228,17 @@ public CachedConnection(String connectionString, Connection parent) {
this.lastKnownAliveNanos = System.nanoTime();
}

/**
* Keeps this connection out of the pool: it serves the borrower holding it and is closed rather
* than pooled when that borrow ends. For a borrower that left something of its own on the session
* and could not take it off again - {@code JDBCStorage.restoreDdlLockBound()} is the one that
* does (#885) - where the blast radius is then this one connection instead of every borrow it
* would have served after this one.
*/
void keepOutOfThePool() {
poolable = false;
}

/** Gives back the right to hold this connection, once and only if it was taken. */
void releasePermit() {
if (metered && permitReleased.compareAndSet(false, true)) {
Expand Down
Loading
Loading