Skip to content

Commit

Permalink
set auto_start_stop control policy to ignore connection validation
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansergeevitch committed Jul 30, 2024
1 parent e967a62 commit 5b74b5b
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,21 @@ public boolean isValid(int timeout) throws SQLException {
}
try {
if (!loginProperties.isSystemEngine()) {
validateConnection(getSessionProperties(), true);
validateConnection(getSessionProperties(), true, true);
}
return true;
} catch (Exception e) {
return false;
}
}

private void validateConnection(FireboltProperties fireboltProperties, boolean ignoreToManyRequestsError)
private void validateConnection(FireboltProperties fireboltProperties, boolean ignoreToManyRequestsError, boolean isInternalRequest)
throws SQLException {
try (Statement s = createStatement(fireboltProperties)) {
FireboltProperties propertiesCopy = FireboltProperties.copy(fireboltProperties);
if (isInternalRequest) {
propertiesCopy.addProperty("auto_start_stop_control", "ignore");
}
try (Statement s = createStatement(propertiesCopy)) {
s.execute("SELECT 1");
} catch (Exception e) {
// A connection is not invalid when too many requests are being sent.
Expand Down Expand Up @@ -470,7 +474,7 @@ private synchronized void changeProperty(Consumer<FireboltProperties> properties
try {
FireboltProperties tmpProperties = FireboltProperties.copy(sessionProperties);
propertiesEditor.accept(tmpProperties);
validateConnection(tmpProperties, false);
validateConnection(tmpProperties, false, false);
propertiesEditor.accept(sessionProperties);
} catch (FireboltException e) {
throw e;
Expand Down

0 comments on commit 5b74b5b

Please sign in to comment.