Skip to content

Commit b3a73e0

Browse files
committed
Added property to force scans and bulks
1 parent 72aee49 commit b3a73e0

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

jdbc/src/main/java/tech/ydb/jdbc/settings/YdbConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ public DriverPropertyInfo[] toPropertyInfo() throws SQLException {
177177
YdbOperationProperties.TRANSACTION_LEVEL.toInfo(properties),
178178
YdbOperationProperties.SCHEME_QUERY_TX_MODE.toInfo(properties),
179179
YdbOperationProperties.SCAN_QUERY_TX_MODE.toInfo(properties),
180+
YdbOperationProperties.BULK_QUERY_TX_MODE.toInfo(properties),
181+
YdbOperationProperties.FORCE_SCAN_BULKS.toInfo(properties),
180182

181183
YdbQueryProperties.DISABLE_PREPARE_DATAQUERY.toInfo(properties),
182184
YdbQueryProperties.DISABLE_AUTO_PREPARED_BATCHES.toInfo(properties),

jdbc/src/main/java/tech/ydb/jdbc/settings/YdbOperationProperties.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public class YdbOperationProperties {
5353
FakeTxMode.ERROR
5454
);
5555

56+
static final YdbProperty<Boolean> FORCE_SCAN_BULKS = YdbProperty.bool("forceScanAndBulk",
57+
"Force usage of bulk upserts instead of upserts/inserts and scan query for selects",
58+
false
59+
);
60+
5661
private static final int MAX_ROWS = 1000; // TODO: how to figure out the max rows of current connection?
5762

5863
private final YdbValue<Duration> joinDuration;
@@ -68,6 +73,8 @@ public class YdbOperationProperties {
6873
private final YdbValue<FakeTxMode> schemeQueryTxMode;
6974
private final YdbValue<FakeTxMode> bulkQueryTxMode;
7075

76+
private final YdbValue<Boolean> forceScanBulks;
77+
7178
public YdbOperationProperties(YdbConfig config) throws SQLException {
7279
Properties props = config.getProperties();
7380

@@ -83,6 +90,8 @@ public YdbOperationProperties(YdbConfig config) throws SQLException {
8390
this.scanQueryTxMode = SCAN_QUERY_TX_MODE.readValue(props);
8491
this.schemeQueryTxMode = SCHEME_QUERY_TX_MODE.readValue(props);
8592
this.bulkQueryTxMode = BULK_QUERY_TX_MODE.readValue(props);
93+
94+
this.forceScanBulks = FORCE_SCAN_BULKS.readValue(props);
8695
}
8796

8897
public Duration getJoinDuration() {
@@ -113,6 +122,10 @@ public FakeTxMode getBulkQueryTxMode() {
113122
return bulkQueryTxMode.getValue();
114123
}
115124

125+
public boolean getForceScanBulks() {
126+
return forceScanBulks.getValue();
127+
}
128+
116129
public Duration getSessionTimeout() {
117130
return sessionTimeout.getValue();
118131
}

jdbc/src/test/java/tech/ydb/jdbc/settings/YdbDriverProperitesTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ static DriverPropertyInfo[] defaultPropertyInfo(@Nullable String localDatacenter
328328
new DriverPropertyInfo("transactionLevel", "8"),
329329
new DriverPropertyInfo("schemeQueryTxMode", "ERROR"),
330330
new DriverPropertyInfo("scanQueryTxMode", "ERROR"),
331+
new DriverPropertyInfo("bulkUpsertQueryTxMode", "ERROR"),
332+
new DriverPropertyInfo("forceScanAndBulk", "false"),
331333
new DriverPropertyInfo("disablePrepareDataQuery", "false"),
332334
new DriverPropertyInfo("disableAutoPreparedBatches", "false"),
333335
new DriverPropertyInfo("disableDetectSqlOperations", "false"),
@@ -365,6 +367,8 @@ static DriverPropertyInfo[] customizedPropertyInfo() {
365367
new DriverPropertyInfo("transactionLevel", "16"),
366368
new DriverPropertyInfo("schemeQueryTxMode", "SHADOW_COMMIT"),
367369
new DriverPropertyInfo("scanQueryTxMode", "FAKE_TX"),
370+
new DriverPropertyInfo("bulkUpsertQueryTxMode", "SHADOW_COMMIT"),
371+
new DriverPropertyInfo("forceScanAndBulk", "true"),
368372
new DriverPropertyInfo("disablePrepareDataQuery", "true"),
369373
new DriverPropertyInfo("disableAutoPreparedBatches", "true"),
370374
new DriverPropertyInfo("disableDetectSqlOperations", "true"),

0 commit comments

Comments
 (0)