From 15d5c63ecc65439ff08baf8776c1376471740fb7 Mon Sep 17 00:00:00 2001 From: Alexandr Gorshenin Date: Mon, 12 Aug 2024 17:05:58 +0100 Subject: [PATCH] Add option to enable detector of full scans --- .../java/tech/ydb/jdbc/settings/YdbClientProperties.java | 1 - jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbClientProperties.java b/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbClientProperties.java index 1f81024..8095192 100644 --- a/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbClientProperties.java +++ b/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbClientProperties.java @@ -81,5 +81,4 @@ public boolean applyToTableClient(TableClient.Builder table, QueryClient.Builder query.sessionPoolMaxSize(maxSize).sessionPoolMinSize(minSize); return false; } - } diff --git a/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java b/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java index c045d04..c2a9223 100644 --- a/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java +++ b/jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java @@ -40,6 +40,9 @@ public class YdbConfig { static final YdbProperty USE_QUERY_SERVICE = YdbProperty.bool("useQueryService", "Use QueryService intead of TableService", false ); + static final YdbProperty FULLSCAN_DETECTOR_ENABLED = YdbProperty.bool( + "jdbc.ydb.fullscan_analyze", "Enable analizator for collecting query stats", false + ); private final String url; @@ -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 @@ -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() { @@ -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); }