Skip to content

Commit

Permalink
Add option to enable detector of full scans
Browse files Browse the repository at this point in the history
  • Loading branch information
alex268 committed Aug 12, 2024
1 parent e46c943 commit 15d5c63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,4 @@ public boolean applyToTableClient(TableClient.Builder table, QueryClient.Builder
query.sessionPoolMaxSize(maxSize).sessionPoolMinSize(minSize);
return false;
}

}
9 changes: 9 additions & 0 deletions jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class YdbConfig {
static final YdbProperty<Boolean> USE_QUERY_SERVICE = YdbProperty.bool("useQueryService",
"Use QueryService intead of TableService", false
);
static final YdbProperty<Boolean> FULLSCAN_DETECTOR_ENABLED = YdbProperty.bool(
"jdbc.ydb.fullscan_analyze", "Enable analizator for collecting query stats", false
);


private final String url;
Expand All @@ -53,6 +56,7 @@ public class YdbConfig {
private final boolean isCacheConnectionsInDriver;
private final int preparedStatementsCacheSize;
private final boolean useQueryService;
private final boolean fullScanDetectorEnabled;

private YdbConfig(
String url, String safeUrl, String connectionString, String username, String password, Properties props
Expand All @@ -66,6 +70,7 @@ private YdbConfig(
this.isCacheConnectionsInDriver = CACHE_CONNECTIONS_IN_DRIVER.readValue(props).getValue();
this.preparedStatementsCacheSize = Math.max(0, PREPARED_STATEMENT_CACHE_SIZE.readValue(props).getValue());
this.useQueryService = USE_QUERY_SERVICE.readValue(props).getValue();
this.fullScanDetectorEnabled = FULLSCAN_DETECTOR_ENABLED.readValue(props).getValue();
}

public Properties getSafeProps() {
Expand Down Expand Up @@ -96,6 +101,10 @@ public boolean isUseQueryService() {
return this.useQueryService;
}

public boolean isFullScanDetectorEnabled() {
return fullScanDetectorEnabled;
}

static boolean isSensetive(String key) {
return TOKEN_KEY.equalsIgnoreCase(key) || PASSWORD_KEY.equalsIgnoreCase(key);
}
Expand Down

0 comments on commit 15d5c63

Please sign in to comment.