Skip to content

Commit 188f751

Browse files
authored
Merge pull request #225 from stuBirdFly/master
Fix the issue where the tablet_id is incorrect when the partition tab…
2 parents 6afeb69 + cddceea commit 188f751

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,7 @@ private ObPair<Long, ObTableParam> getTable(String tableName, Object[] rowKey,
16401640
TableEntry tableEntry = getOrRefreshTableEntry(tableName, refresh, waitForRefresh,
16411641
needFetchAll);
16421642
Row row = new Row();
1643-
if (tableEntry.isPartitionTable()
1644-
&& tableEntry.getPartitionInfo().getLevel() != ObPartitionLevel.LEVEL_ZERO) {
1643+
if (tableEntry.isPartitionTable()) {
16451644
List<String> curTableRowKeyNames = new ArrayList<String>();
16461645
Map<String, Integer> tableRowKeyEle = getRowKeyElement(tableName);
16471646
if (tableRowKeyEle != null) {
@@ -2052,8 +2051,7 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20522051
Row startRow = new Row();
20532052
Row endRow = new Row();
20542053
// ensure the format of column names and values if the current table is a table with partition
2055-
if (tableEntry.isPartitionTable()
2056-
&& tableEntry.getPartitionInfo().getLevel() != ObPartitionLevel.LEVEL_ZERO) {
2054+
if (tableEntry.isPartitionTable()) {
20572055
// scanRangeColumn may be longer than start/end in prefix scanning situation
20582056
if (scanRangeColumns == null || scanRangeColumns.size() < start.length) {
20592057
throw new IllegalArgumentException(

src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,10 @@ private static TableEntry getTableEntryFromRemote(Connection connection, TableEn
725725
if (null != tableEntry) {
726726
tableEntry.setTableEntryKey(key);
727727
// TODO: check capacity flag later
728+
// fetch partition info
729+
fetchPartitionInfo(connection, tableEntry);
728730
// fetch tablet ids when table is partition table
729731
if (tableEntry.isPartitionTable()) {
730-
// fetch partition info
731-
fetchPartitionInfo(connection, tableEntry);
732732
if (null != tableEntry.getPartitionInfo()) {
733733
// fetch first range part
734734
if (null != tableEntry.getPartitionInfo().getFirstPartDesc()) {

src/main/java/com/alipay/oceanbase/rpc/location/model/TableEntry.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ public Long getReplicaNum() {
105105
* Is partition table.
106106
*/
107107
public boolean isPartitionTable() {
108-
return this.partitionNum > 1;
108+
return partitionNum > 1 || (partitionInfo != null && partitionInfo.getLevel()
109+
.getIndex() > ObPartitionLevel.LEVEL_ZERO.getIndex() && partitionInfo.getLevel()
110+
.getIndex() < ObPartitionLevel.UNKNOWN.getIndex());
109111
}
110112

111113
/*

0 commit comments

Comments
 (0)