Skip to content

Commit d062b20

Browse files
authored
Merge branch 'master' into get_partition_meta
2 parents 5a3bbe0 + b3f35e5 commit d062b20

File tree

10 files changed

+184
-200
lines changed

10 files changed

+184
-200
lines changed

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.oceanbase</groupId>
66
<artifactId>obkv-table-client</artifactId>
7-
<version>1.2.14-SNAPSHOT</version>
7+
<version>1.3.1-SNAPSHOT</version>
88

99
<name>${project.groupId}:${project.artifactId}</name>
1010
<description>OceanBase JavaClient for TableApi</description>
@@ -157,12 +157,12 @@
157157
<dependency>
158158
<groupId>org.testcontainers</groupId>
159159
<artifactId>jdbc</artifactId>
160-
<scope>test</scope>
161160
<version>1.15.3</version>
161+
<scope>test</scope>
162162
<exclusions>
163163
<exclusion>
164-
<groupId>org.rnorth.visible-assertions</groupId>
165164
<artifactId>visible-assertions</artifactId>
165+
<groupId>org.rnorth.visible-assertions</groupId>
166166
</exclusion>
167167
</exclusions>
168168
</dependency>
@@ -380,7 +380,7 @@
380380
</goals>
381381
<configuration>
382382
<rules>
383-
<DependencyConvergence/>
383+
<DependencyConvergence />
384384
</rules>
385385
</configuration>
386386
</execution>
@@ -390,4 +390,4 @@
390390
</build>
391391
</profile>
392392
</profiles>
393-
</project>
393+
</project>

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

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,11 +1757,21 @@ public ObPair<Long, ObTableParam> getTable(String tableName, ObTableQuery query,
17571757
Object[] start = new Object[startKeySize];
17581758
Object[] end = new Object[endKeySize];
17591759
for (int i = 0; i < startKeySize; i++) {
1760-
start[i] = startKey.getObj(i).getValue();
1760+
ObObj curStart = startKey.getObj(i);
1761+
if (curStart.isMinObj()) {
1762+
start[i] = curStart;
1763+
} else {
1764+
start[i] = curStart.getValue();
1765+
}
17611766
}
17621767

17631768
for (int i = 0; i < endKeySize; i++) {
1764-
end[i] = endKey.getObj(i).getValue();
1769+
ObObj curEnd = endKey.getObj(i);
1770+
if (curEnd.isMaxObj()) {
1771+
end[i] = curEnd;
1772+
} else {
1773+
end[i] = curEnd.getValue();
1774+
}
17651775
}
17661776
ObBorderFlag borderFlag = rang.getBorderFlag();
17671777
List<ObPair<Long, ObTableParam>> pairList = getTables(tableName, query, start,
@@ -3573,36 +3583,36 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E
35733583
if (request instanceof ObTableOperationRequest) {
35743584
ObTableBatchOperation batchOperation = new ObTableBatchOperation();
35753585
batchOperation.addTableOperation(((ObTableOperationRequest) request)
3576-
.getTableOperation());
3586+
.getTableOperation());
35773587
ObTableClientBatchOpsImpl batchOps = new ObTableClientBatchOpsImpl(
3578-
request.getTableName(), batchOperation, this);
3588+
request.getTableName(), batchOperation, this);
35793589
batchOps.setEntityType(request.getEntityType());
35803590
ObTableBatchOperationResult batchOpsResult = new ObClusterTableBatchOps(batchOps)
3581-
.executeInternal();
3591+
.executeInternal();
35823592
return batchOpsResult.getResults().get(0);
35833593
} else if (request instanceof ObTableQueryRequest) {
35843594
// TableGroup -> TableName
35853595
String tableName = request.getTableName();
35863596
ObTableClientQueryImpl tableQuery = new ObTableClientQueryImpl(tableName,
3587-
((ObTableQueryRequest) request).getTableQuery(), this);
3597+
((ObTableQueryRequest) request).getTableQuery(), this);
35883598
tableQuery.setEntityType(request.getEntityType());
35893599
return new ObClusterTableQuery(tableQuery).executeInternal();
35903600
} else if (request instanceof ObTableQueryAsyncRequest) {
35913601
// TableGroup -> TableName
35923602
String tableName = request.getTableName();
35933603
ObTableClientQueryImpl tableQuery = new ObTableClientQueryImpl(tableName,
3594-
((ObTableQueryAsyncRequest) request).getObTableQueryRequest().getTableQuery(), this);
3604+
((ObTableQueryAsyncRequest) request).getObTableQueryRequest().getTableQuery(), this);
35953605
tableQuery.setEntityType(request.getEntityType());
35963606
return new ObClusterTableQuery(tableQuery).asyncExecuteInternal();
35973607
} else if (request instanceof ObTableBatchOperationRequest) {
35983608
ObTableClientBatchOpsImpl batchOps = new ObTableClientBatchOpsImpl(
3599-
request.getTableName(),
3600-
((ObTableBatchOperationRequest) request).getBatchOperation(), this);
3609+
request.getTableName(),
3610+
((ObTableBatchOperationRequest) request).getBatchOperation(), this);
36013611
batchOps.setEntityType(request.getEntityType());
36023612
return new ObClusterTableBatchOps(runtimeBatchExecutor, batchOps).executeInternal();
36033613
} else if (request instanceof ObTableQueryAndMutateRequest) {
36043614
ObTableQueryAndMutate tableQueryAndMutate = ((ObTableQueryAndMutateRequest) request)
3605-
.getTableQueryAndMutate();
3615+
.getTableQueryAndMutate();
36063616
ObTableQuery tableQuery = tableQueryAndMutate.getTableQuery();
36073617
// fill a whole range if no range is added explicitly.
36083618
if (tableQuery.getKeyRanges().isEmpty()) {
@@ -3716,7 +3726,7 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E
37163726
}
37173727

37183728
throw new FeatureNotSupportedException("request type " + request.getClass().getSimpleName()
3719-
+ "is not supported. make sure the correct version");
3729+
+ "is not supported. make sure the correct version");
37203730
}
37213731

37223732
private ObTableQueryAndMutate buildObTableQueryAndMutate(ObTableQuery obTableQuery,
@@ -4216,7 +4226,7 @@ public String getPhyTableNameFromTableGroup(ObTableEntityType type, String table
42164226
}
42174227
return tableName;
42184228
}
4219-
4229+
42204230
/*
42214231
* Get the start keys of different tablets, byte[0] = [] = EMPTY_START_ROW = EMPTY_END_ROW
42224232
* Example:

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObConnectionFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
import com.alipay.remoting.codec.Codec;
2323
import com.alipay.remoting.config.ConfigManager;
2424
import com.alipay.remoting.config.ConfigurableInstance;
25-
import com.alipay.remoting.connection.AbstractConnectionFactory;
2625
import com.alipay.remoting.connection.ConnectionFactory;
27-
import com.alipay.remoting.log.BoltLoggerFactory;
2826
import com.alipay.remoting.rpc.RpcHandler;
2927
import com.alipay.remoting.rpc.protocol.UserProcessor;
3028
import com.alipay.remoting.util.NettyEventLoopUtil;
@@ -35,14 +33,14 @@
3533
import io.netty.channel.*;
3634
import io.netty.channel.socket.SocketChannel;
3735
import org.slf4j.Logger;
36+
import org.slf4j.LoggerFactory;
3837

3938
import java.net.InetSocketAddress;
4039
import java.util.concurrent.ConcurrentHashMap;
4140

4241
public class ObConnectionFactory implements ConnectionFactory {
4342

44-
private static final Logger logger = BoltLoggerFactory
45-
.getLogger(AbstractConnectionFactory.class);
43+
private static final Logger logger = LoggerFactory.getLogger(ObConnectionFactory.class);
4644

4745
private static final EventLoopGroup workerGroup = NettyEventLoopUtil.newEventLoopGroup(Runtime
4846
.getRuntime().availableProcessors() + 1,

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableConnection.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ private void login() throws Exception {
173173
credential = result.getCredential();
174174
tenantId = result.getTenantId();
175175
// Set version if missing
176-
if (ObGlobal.obVsnMajor() == 0 && !result.getServerVersion().isEmpty()) {
176+
if (ObGlobal.obVsnMajor() == 0) {
177177
// version should be set before login when direct mode
178+
if (result.getServerVersion().isEmpty()) {
179+
throw new RuntimeException(
180+
"Failed to get server version from login result");
181+
}
178182
LocationUtil.parseObVerionFromLogin(result.getServerVersion());
179183
LOGGER.info("The OB_VERSION parsed from login result is: {}",
180184
ObGlobal.OB_VERSION);

0 commit comments

Comments
 (0)