Skip to content

Commit a55bae2

Browse files
committed
fix throw table_not_exist exception
1 parent ee03b52 commit a55bae2

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientLSBatchOpsImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,10 @@ public Map<Long, Map<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableSing
408408
tableObPair = obTableClient.getTable(real_tableName, rowKey,
409409
false, false, obTableClient.getRoute(false));
410410
lsId = tableObPair.getRight().getLsId();
411+
} else {
412+
throw e;
411413
}
412414
}
413-
if (tableObPair == null) {
414-
throw new ObTableUnexpectedException("tableObPair is null, tableName: " + tableName);
415-
}
416415

417416
Map<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableSingleOp>>>> tabletOperations
418417
= lsOperationsMap.computeIfAbsent(lsId, k -> new HashMap<>());

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientQueryImpl.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ public void checkArgumentBeforeExec() throws Exception {
135135
throw new IllegalArgumentException("table name is null");
136136
} else if (tableQuery.isFTSQuery()) {
137137
if (!ObGlobal.isFtsQuerySupport()) {
138-
throw new FeatureNotSupportedException("full text query is not supported in "+ObGlobal.obVsnString());
138+
throw new FeatureNotSupportedException("full text query is not supported in "
139+
+ ObGlobal.obVsnString());
139140
}
140141
if (tableQuery.getIndexName() == null || tableQuery.getIndexName().isEmpty()
141-
|| tableQuery.getIndexName().equalsIgnoreCase("primary")) {
142+
|| tableQuery.getIndexName().equalsIgnoreCase("primary")) {
142143
throw new IllegalArgumentException(
143-
"use fulltext search but specified index name is not fulltext index");
144+
"use fulltext search but specified index name is not fulltext index");
144145
}
145146
}
146147
}
@@ -178,15 +179,16 @@ private AbstractQueryStreamResult commonExecute(InitQueryResultCallback<Abstract
178179
if (obTableClient.isOdpMode()) {
179180
if (tableQuery.getScanRangeColumns().isEmpty()) {
180181
if (tableQuery.getIndexName() != null
181-
&& !tableQuery.getIndexName().equalsIgnoreCase("primary") && !tableQuery.isFTSQuery()) {
182+
&& !tableQuery.getIndexName().equalsIgnoreCase("primary")
183+
&& !tableQuery.isFTSQuery()) {
182184
throw new ObTableException("key range columns must be specified when use index");
183185
}
184186
}
185-
if (entityType != ObTableEntityType.HKV &&
186-
getPartId() != null && tableQuery.getIndexName() == null) {
187+
if (entityType != ObTableEntityType.HKV && getPartId() != null
188+
&& tableQuery.getIndexName() == null) {
187189
try {
188190
ObPair<Long, ObTableParam> odpTable = obTableClient.getODPTableWithPartId(
189-
tableName, getPartId(), false);
191+
tableName, getPartId(), false);
190192
partitionObTables.put(odpTable.getLeft(), odpTable);
191193
} catch (Exception e) {
192194
if (e instanceof ObTableException) {
@@ -208,7 +210,7 @@ private AbstractQueryStreamResult commonExecute(InitQueryResultCallback<Abstract
208210
}
209211
} else {
210212
partitionObTables.put(0L, new ObPair<Long, ObTableParam>(0L, new ObTableParam(
211-
obTableClient.getOdpTable())));
213+
obTableClient.getOdpTable())));
212214
}
213215
} else {
214216
if (getPartId() == null) {
@@ -222,12 +224,15 @@ private AbstractQueryStreamResult commonExecute(InitQueryResultCallback<Abstract
222224
false);
223225
}
224226
try {
225-
ObPair<Long, ObTableParam> table = obTableClient.getTableWithPartId(indexTableName, getPartId(),
226-
false, false, false, obTableClient.getRoute(false));
227+
ObPair<Long, ObTableParam> table = obTableClient.getTableWithPartId(
228+
indexTableName, getPartId(), false, false, false,
229+
obTableClient.getRoute(false));
227230
partitionObTables.put(table.getLeft(), table);
228231
} catch (ObTableNotExistException e) {
229-
if (this.entityType == ObTableEntityType.HKV && obTableClient.isTableGroupName(tableName)) {
230-
indexTableName = obTableClient.tryGetTableNameFromTableGroupCache(tableName, true);
232+
if (this.entityType == ObTableEntityType.HKV
233+
&& obTableClient.isTableGroupName(tableName)) {
234+
indexTableName = obTableClient.tryGetTableNameFromTableGroupCache(
235+
tableName, true);
231236
ObPair<Long, ObTableParam> table = obTableClient.getTableWithPartId(
232237
indexTableName, getPartId(), false, false, false,
233238
obTableClient.getRoute(false));
@@ -337,11 +342,10 @@ public Map<Long, ObPair<Long, ObTableParam>> initPartitions(ObTableQuery tableQu
337342
indexTableName = obTableClient.tryGetTableNameFromTableGroupCache(tableName, true);
338343
pairs = this.obTableClient.getTables(indexTableName, tableQuery, start,
339344
borderFlag.isInclusiveStart(), end, borderFlag.isInclusiveEnd(), false, false);
345+
} else {
346+
throw e;
340347
}
341348
}
342-
if (pairs == null) {
343-
throw new ObTableUnexpectedException("Query meets exception, pairs is null, tableName: " + tableName);
344-
}
345349
if (tableQuery.getScanOrder() == ObScanOrder.Reverse) {
346350
for (int i = pairs.size() - 1; i >= 0; i--) {
347351
partitionObTables.put(pairs.get(i).getLeft(), pairs.get(i));

0 commit comments

Comments
 (0)