From ac042836d9135dbcd18b06c6aa7008a632514409 Mon Sep 17 00:00:00 2001 From: GroundWu <1175416256@qq.com> Date: Fri, 5 Jan 2024 18:00:08 +0800 Subject: [PATCH] fix: query with primary index fail when indexname specify to 'primary' --- src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java | 2 +- .../java/com/alipay/oceanbase/rpc/location/LocationUtil.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java b/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java index b5ef1df0..87c37e77 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java +++ b/src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java @@ -913,7 +913,7 @@ public void syncRefreshMetadata() throws Exception { public String getIndexTableName(final String dataTableName, final String indexName, List scanRangeColumns) throws Exception { String indexTableName = dataTableName; - if (indexName != null && !indexName.equals("PRIMARY")) { + if (indexName != null && !indexName.isEmpty() && !indexName.equalsIgnoreCase("PRIMARY")) { String tmpTableName = constructIndexTableName(dataTableName, indexName); if (tmpTableName == null) { throw new ObTableException("index table name is null"); diff --git a/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java b/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java index bb4615b7..2e67be70 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java +++ b/src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java @@ -746,10 +746,10 @@ public static ObIndexInfo getIndexInfoFromRemote(ObServerAddr obServerAddr, ObUs indexInfo.setIndexTableId(rs.getLong("table_id")); indexInfo.setIndexType(ObIndexType.valueOf(rs.getInt("index_type"))); } else { - throw new ObTableEntryRefreshException("fail to get index info from remote"); + throw new ObTableEntryRefreshException("fail to get index info from remote, result set is empty"); } } catch (Exception e) { - throw new ObTableEntryRefreshException("fail to get index info from remote", e); + throw new ObTableEntryRefreshException(format("fail to get index info from remote, indexTableName: %s", indexTableName), e); } finally { try { if (null != rs) {