Skip to content

Commit b977127

Browse files
committed
Replace two options by one
1 parent ce05e07 commit b977127

File tree

4 files changed

+11
-27
lines changed

4 files changed

+11
-27
lines changed

jdbc/src/main/java/tech/ydb/jdbc/context/YdbContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ public String getUsername() {
195195

196196
public YdbExecutor createExecutor() throws SQLException {
197197
if (config.isUseQueryService()) {
198-
if (operationOptions.getProcessUndetermined()) {
199-
String tablePath = joined(prefixPath, operationOptions.getProcessUndeterminedTable());
198+
String txValidationTable = operationOptions.getTxValidationTable();
199+
if (txValidationTable != null && !txValidationTable.isEmpty()) {
200+
String tablePath = joined(prefixPath, txValidationTable);
200201
if (tableDescribeCache.getIfPresent(tablePath) == null) {
201202
tableDescribeCache.put(tablePath, TableTxExecutor.validate(this, tablePath));
202203
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ public DriverPropertyInfo[] toPropertyInfo() throws SQLException {
211211
YdbClientProperties.SESSION_POOL_SIZE_MIN.toInfo(properties),
212212
YdbClientProperties.SESSION_POOL_SIZE_MAX.toInfo(properties),
213213

214-
YdbOperationProperties.PROCESS_UNDETERMINED_TABLE.toInfo(properties),
215-
YdbOperationProperties.PROCESS_UNDETERMINED.toInfo(properties),
216214
YdbOperationProperties.USE_STREAM_RESULT_SETS.toInfo(properties),
217215
YdbOperationProperties.JOIN_DURATION.toInfo(properties),
218216
YdbOperationProperties.QUERY_TIMEOUT.toInfo(properties),

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

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,8 @@ public class YdbOperationProperties {
6161
"Use new data types Date32/Datetime64/Timestamp64 by default", false
6262
);
6363

64-
static final YdbProperty<Boolean> PROCESS_UNDETERMINED = YdbProperty.bool("processUndetermined",
65-
"Enable automatic processing of UNDETERMINED errors", false
66-
);
67-
68-
static final YdbProperty<String> PROCESS_UNDETERMINED_TABLE = YdbProperty.string("processUndeterminedTable",
69-
"Name of working table for automatic processing of UNDETERMINED errors", "ydb_transactions"
70-
);
64+
static final YdbProperty<String> TX_VALIDATION_TABLE = YdbProperty.string("withTxValidationTable",
65+
"Name of working table to store transactions to avoid UNDETERMINED errors");
7166

7267
private static final int MAX_ROWS = 1000; // TODO: how to figure out the max rows of current connection?
7368

@@ -86,8 +81,7 @@ public class YdbOperationProperties {
8681

8782
private final YdbValue<Boolean> useStreamResultSets;
8883
private final YdbValue<Boolean> forceNewDatetypes;
89-
private final YdbValue<Boolean> processUndetermined;
90-
private final YdbValue<String> processUndeterminedTable;
84+
private final YdbValue<String> txValidationTable;
9185

9286
public YdbOperationProperties(YdbConfig config) throws SQLException {
9387
Properties props = config.getProperties();
@@ -107,8 +101,7 @@ public YdbOperationProperties(YdbConfig config) throws SQLException {
107101

108102
this.useStreamResultSets = USE_STREAM_RESULT_SETS.readValue(props);
109103
this.forceNewDatetypes = FORCE_NEW_DATETYPES.readValue(props);
110-
this.processUndetermined = PROCESS_UNDETERMINED.readValue(props);
111-
this.processUndeterminedTable = PROCESS_UNDETERMINED_TABLE.readValue(props);
104+
this.txValidationTable = TX_VALIDATION_TABLE.readValue(props);
112105
}
113106

114107
public Duration getJoinDuration() {
@@ -163,15 +156,11 @@ public boolean getForceNewDatetypes() {
163156
return forceNewDatetypes.getValue();
164157
}
165158

166-
public boolean getProcessUndetermined() {
167-
return processUndetermined.getValue();
168-
}
169-
170-
public String getProcessUndeterminedTable() {
171-
return processUndeterminedTable.getValue();
172-
}
173-
174159
public int getMaxRows() {
175160
return MAX_ROWS;
176161
}
162+
163+
public String getTxValidationTable() {
164+
return txValidationTable.getValue();
165+
}
177166
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ static DriverPropertyInfo[] defaultPropertyInfo(@Nullable String localDatacenter
323323
new DriverPropertyInfo("sessionMaxIdleTime", ""),
324324
new DriverPropertyInfo("sessionPoolSizeMin", ""),
325325
new DriverPropertyInfo("sessionPoolSizeMax", ""),
326-
new DriverPropertyInfo("processUndeterminedTable", "ydb_transactions"),
327-
new DriverPropertyInfo("processUndetermined", "false"),
328326
new DriverPropertyInfo("useStreamResultSets", "false"),
329327
new DriverPropertyInfo("joinDuration", "5m"),
330328
new DriverPropertyInfo("queryTimeout", "0s"),
@@ -373,8 +371,6 @@ static DriverPropertyInfo[] customizedPropertyInfo() {
373371
new DriverPropertyInfo("sessionMaxIdleTime", "5m"),
374372
new DriverPropertyInfo("sessionPoolSizeMin", "3"),
375373
new DriverPropertyInfo("sessionPoolSizeMax", "4"),
376-
new DriverPropertyInfo("processUndeterminedTable", "ydb_transactions"),
377-
new DriverPropertyInfo("processUndetermined", "false"),
378374
new DriverPropertyInfo("useStreamResultSets", "true"),
379375
new DriverPropertyInfo("joinDuration", "6m"),
380376
new DriverPropertyInfo("queryTimeout", "2m"),

0 commit comments

Comments
 (0)