Skip to content

Commit 2f250d9

Browse files
committed
fix after merge and correct some test cases
1 parent cbaa84a commit 2f250d9

File tree

6 files changed

+45
-35
lines changed

6 files changed

+45
-35
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ private Partition getSinglePartitionInternal(String tableName, Row rowKey, boole
31513151
}
31523152
}
31533153
ObTableParam tableParam = obPair.getRight();
3154-
return new Partition(tableParam.getPartitionId(), obPair.getLeft(),
3154+
return new Partition(tableParam.getPartitionId(), tableParam.getPartId(),
31553155
tableParam.getTableId(), tableParam.getObTable().getIp(), tableParam.getObTable()
31563156
.getPort(), tableParam.getLsId());
31573157
}
@@ -3196,7 +3196,7 @@ private List<Partition> getAllPartitionInternal(String tableName, boolean refres
31963196
}
31973197
for (ObPair<Long, ObTableParam> table : allTables) {
31983198
ObTableParam tableParam = table.getRight();
3199-
Partition partition = new Partition(tableParam.getPartitionId(), table.getLeft(), tableParam.getTableId(),
3199+
Partition partition = new Partition(tableParam.getPartitionId(), tableParam.getPartId(), tableParam.getTableId(),
32003200
tableParam.getObTable().getIp(), tableParam.getObTable().getPort(), tableParam.getLsId());
32013201
partitions.add(partition);
32023202
}

src/test/java/com/alipay/oceanbase/rpc/ODPGetPartitionMetaTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public void testConcurrentGetPartition() throws Exception {
518518
.addMutateRow(row(colVal("V", "V_val1"))).execute();
519519
Assert.assertEquals(1, resultSet.getAffectedRows());
520520
List<Partition> partitions = client.getPartition(table_name, false);
521-
Assert.assertEquals(15, partitions.size());
521+
Assert.assertEquals(16, partitions.size());
522522
for (Partition partition : partitions) {
523523
System.out.println("testHash: " + partition.toString());
524524
}

src/test/java/com/alipay/oceanbase/rpc/ObTableClientPartitionHashTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void close() throws Exception {
6565
if (null != this.obTableClient) {
6666
((ObTableClient) this.obTableClient).close();
6767
}
68+
ObTableClientTestUtil.cleanTable("testHash");
6869
}
6970

7071
@Test

src/test/java/com/alipay/oceanbase/rpc/ObTableClientPartitionKeyTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ public class ObTableClientPartitionKeyTest {
5858
public void setUp() throws Exception {
5959
/*
6060
*
61-
* create table testPartition (
62-
K varbinary(1024),
63-
Q varbinary(256),
64-
T bigint,
65-
V varbinary(1024),
66-
K_PREFIX varbinary(1024) generated always as (substring(K, 1, 4)),
67-
primary key(K, Q, T)
68-
) partition by key(K_PREFIX) partitions 15;
61+
* CREATE TABLE IF NOT EXISTS `testKey` (
62+
`K` varbinary(1024),
63+
`Q` varbinary(256),
64+
`T` bigint,
65+
`V` varbinary(1024),
66+
INDEX i1(`K`, `V`) local,
67+
PRIMARY KEY(`K`, `Q`, `T`)
68+
) partition by key(K) partitions 15;
6969
*
7070
* */
7171
System.setProperty("ob_table_min_rslist_refresh_interval_millis", "1");

src/test/java/com/alipay/oceanbase/rpc/ObTableClientPartitionRangeTest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,18 @@ public class ObTableClientPartitionRangeTest {
4444
@Before
4545
public void setUp() throws Exception {
4646
/*
47-
*
48-
* create table testRange (K varbinary(1024), Q varbinary(256), T bigint, V varbinary(102400), primary key(K, Q, T)) partition by range columns (K) (PARTITION p0 VALUES LESS THAN ('a'), PARTITION p1 VALUES LESS THAN ('w'), PARTITION p2 VALUES LESS THAN MAXVALUE);
49-
*
47+
* CREATE TABLE IF NOT EXISTS `testRange` (
48+
`K` varbinary(1024),
49+
`Q` varbinary(256),
50+
`T` bigint,
51+
`V` varbinary(10240),
52+
INDEX i1(`K`, `V`) local,
53+
PRIMARY KEY(`K`, `Q`, `T`)
54+
) partition by range columns (`K`) (
55+
PARTITION p0 VALUES LESS THAN ('a'),
56+
PARTITION p1 VALUES LESS THAN ('w'),
57+
PARTITION p2 VALUES LESS THAN MAXVALUE
58+
);
5059
* */
5160
System.setProperty("ob_table_min_rslist_refresh_interval_millis", "1");
5261

src/test/resources/ci.sql

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ CREATE TABLE IF NOT EXISTS `test_hbase$fn` (
211211
PRIMARY KEY (`K`, `Q`, `T`)
212212
);
213213

214-
CREATE TABLE `test_batch_query` (
214+
CREATE TABLE IF NOT EXISTS `test_batch_query` (
215215
`c1` bigint NOT NULL,
216216
`c2` varchar(20) DEFAULT NULL,
217217
PRIMARY KEY (`c1`))partition by range(`c1`)(partition p0 values less than(200), partition p1 values less than(500), partition p2 values less than(900));
218218

219-
CREATE TABLE `test_query_filter_mutate` (
219+
CREATE TABLE IF NOT EXISTS `test_query_filter_mutate` (
220220
`c1` bigint NOT NULL,
221221
`c2` varbinary(1024) DEFAULT NULL,
222222
`c3` varchar(20) DEFAULT NULL,
@@ -226,7 +226,7 @@ CREATE TABLE `test_query_filter_mutate` (
226226
PARTITION p1 VALUES LESS THAN (1000),
227227
PARTITION p2 VALUES LESS THAN MAXVALUE);
228228

229-
CREATE TABLE `test_mutation_with_range` (
229+
CREATE TABLE IF NOT EXISTS `test_mutation_with_range` (
230230
`c1` bigint NOT NULL,
231231
`c1sk` varchar(20) NOT NULL,
232232
`c2` varbinary(1024) DEFAULT NULL,
@@ -237,7 +237,7 @@ CREATE TABLE `test_mutation_with_range` (
237237
PARTITION p1 VALUES LESS THAN (1000),
238238
PARTITION p2 VALUES LESS THAN MAXVALUE);
239239

240-
CREATE TABLE `test_mutation` (
240+
CREATE TABLE IF NOT EXISTS `test_mutation` (
241241
`c1` bigint NOT NULL,
242242
`c2` varchar(20) NOT NULL,
243243
`c3` varbinary(1024) DEFAULT NULL,
@@ -247,7 +247,7 @@ CREATE TABLE `test_mutation` (
247247
PARTITION p1 VALUES LESS THAN (1000),
248248
PARTITION p2 VALUES LESS THAN MAXVALUE);
249249

250-
CREATE TABLE `test_mutation_column_reverse` (
250+
CREATE TABLE IF NOT EXISTS `test_mutation_column_reverse` (
251251
`c2` bigint NOT NULL,
252252
`c1` varchar(20) NOT NULL,
253253
`c3` varbinary(1024) DEFAULT NULL,
@@ -257,7 +257,7 @@ PARTITION p0 VALUES LESS THAN (300),
257257
PARTITION p1 VALUES LESS THAN (1000),
258258
PARTITION p2 VALUES LESS THAN MAXVALUE);
259259

260-
CREATE TABLE `test_throttle` (
260+
CREATE TABLE IF NOT EXISTS `test_throttle` (
261261
`c1` bigint NOT NULL,
262262
`c2` varchar(20) NOT NULL,
263263
`c3` varbinary(1024) DEFAULT NULL,
@@ -267,7 +267,7 @@ CREATE TABLE `test_throttle` (
267267
PARTITION p1 VALUES LESS THAN (1000000),
268268
PARTITION p2 VALUES LESS THAN MAXVALUE);
269269

270-
CREATE TABLE test_aggregation (
270+
CREATE TABLE IF NOT EXISTS test_aggregation (
271271
`c1` varchar(255),
272272
`c2` int NOT NULL,
273273
`c3` bigint NOT NULL,
@@ -278,22 +278,22 @@ CREATE TABLE test_aggregation (
278278
PRIMARY KEY(`c1`)
279279
);
280280

281-
CREATE TABLE `test_partition_aggregation` (
281+
CREATE TABLE IF NOT EXISTS `test_partition_aggregation` (
282282
`c1` bigint NOT NULL,
283283
`c2` bigint DEFAULT NULL,
284284
PRIMARY KEY (`c1`))partition by range(`c1`) (
285285
PARTITION p0 VALUES LESS THAN (200),
286286
PARTITION p1 VALUES LESS THAN (500),
287287
PARTITION p2 VALUES LESS THAN (900));
288288

289-
CREATE TABLE `test_ttl_timestamp` (
289+
CREATE TABLE IF NOT EXISTS `test_ttl_timestamp` (
290290
`c1` bigint NOT NULL,
291291
`c2` varchar(20) DEFAULT NULL,
292292
`c3` bigint DEFAULT NULL,
293293
`expired_ts` timestamp(6),
294294
PRIMARY KEY (`c1`)) TTL(expired_ts + INTERVAL 0 SECOND);
295295

296-
CREATE TABLE `test_ttl_timestamp_5s` (
296+
CREATE TABLE IF NOT EXISTS `test_ttl_timestamp_5s` (
297297
`c1` bigint NOT NULL,
298298
`c2` varchar(20) DEFAULT NULL,
299299
`c3` bigint DEFAULT NULL,
@@ -423,7 +423,7 @@ CREATE TABLE IF NOT EXISTS `sync_item` (
423423
DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci
424424
PARTITION BY KEY(`uid`) PARTITIONS 32;
425425

426-
CREATE TABLE `hash_key_sub_part` (
426+
CREATE TABLE IF NOT EXISTS `hash_key_sub_part` (
427427
`id` bigint(11) NOT NULL,
428428
`uid` varchar(20) NOT NULL,
429429
`object_id` varchar(32) NOT NULL,
@@ -456,7 +456,7 @@ CREATE TABLE IF NOT EXISTS `test_table_object` (
456456
`c19` longblob DEFAULT NULL
457457
);
458458

459-
CREATE TABLE `test_query_scan_order` (
459+
CREATE TABLE IF NOT EXISTS `test_query_scan_order` (
460460
`c1` int(12) NOT NULL,
461461
`c2` int(11) NOT NULL,
462462
`c3` int(11) NOT NULL,
@@ -491,7 +491,7 @@ CREATE TABLE IF NOT EXISTS `test_put_with_global_index` (
491491
PRIMARY KEY(`id`)) TTL(expired_ts + INTERVAL 1 SECOND) PARTITION BY KEY(`id`) PARTITIONS 32;
492492

493493
CREATE TABLEGROUP test SHARDING = 'ADAPTIVE';
494-
CREATE TABLE `test$family_group` (
494+
CREATE TABLE IF NOT EXISTS `test$family_group` (
495495
`K` varbinary(1024) NOT NULL,
496496
`Q` varbinary(256) NOT NULL,
497497
`T` bigint(20) NOT NULL,
@@ -500,7 +500,7 @@ CREATE TABLE `test$family_group` (
500500
) TABLEGROUP = test;
501501

502502
CREATE TABLEGROUP test2 SHARDING = 'ADAPTIVE';
503-
CREATE TABLE `test2$family1` (
503+
CREATE TABLE IF NOT EXISTS `test2$family1` (
504504
`K` varbinary(1024) NOT NULL,
505505
`Q` varbinary(256) NOT NULL,
506506
`T` bigint(20) NOT NULL,
@@ -509,7 +509,7 @@ CREATE TABLE `test2$family1` (
509509
) TABLEGROUP = test2;
510510

511511
CREATE TABLEGROUP test_start_end_keys_key SHARDING = 'ADAPTIVE';
512-
CREATE TABLE `test_start_end_keys$family_key` (
512+
CREATE TABLE IF NOT EXISTS `test_start_end_keys$family_key` (
513513
`K` varbinary(1024) NOT NULL,
514514
`Q` varbinary(256) NOT NULL,
515515
`T` bigint(20) NOT NULL,
@@ -519,7 +519,7 @@ CREATE TABLE `test_start_end_keys$family_key` (
519519
partition by key(K) partitions 17;
520520

521521
CREATE TABLEGROUP test_start_end_keys_range SHARDING = 'ADAPTIVE';
522-
CREATE TABLE `test_start_end_keys_range$family_range` (
522+
CREATE TABLE IF NOT EXISTS `test_start_end_keys_range$family_range` (
523523
`K` varbinary(1024) NOT NULL,
524524
`Q` varbinary(256) NOT NULL,
525525
`T` bigint(20) NOT NULL,
@@ -532,15 +532,15 @@ partition by range columns (`K`) (
532532
PARTITION p2 VALUES LESS THAN MAXVALUE
533533
);
534534

535-
CREATE TABLE `test_batch_get` (
535+
CREATE TABLE IF NOT EXISTS `test_batch_get` (
536536
`c1` int(11) NOT NULL,
537537
`c2` int(11) NOT NULL,
538538
`c3` int(11) DEFAULT NULL,
539539
`c4` int(11) DEFAULT NULL,
540540
PRIMARY KEY (`c1`, `c2`)
541541
) partition by key(`c2`) partitions 3;
542542

543-
CREATE TABLE `test_local_index_with_vgen_col` (
543+
CREATE TABLE IF NOT EXISTS `test_local_index_with_vgen_col` (
544544
`name` varchar(512) NOT NULL DEFAULT '',
545545
`pk` varchar(512) NOT NULL,
546546
`adiu` varchar(512) NOT NULL DEFAULT '',
@@ -551,7 +551,7 @@ CREATE TABLE `test_local_index_with_vgen_col` (
551551
KEY `idx_adiu_v_name` (`adiu`, `name_v`) BLOCK_SIZE 16384 LOCAL
552552
) TTL (gmt_create + INTERVAL 300 SECOND) partition by key(adiu) partitions 8;
553553

554-
CREATE TABLE `test_global_index_with_vgen_col` (
554+
CREATE TABLE IF NOT EXISTS `test_global_index_with_vgen_col` (
555555
`name` varchar(512) NOT NULL DEFAULT '',
556556
`pk` varchar(512) NOT NULL,
557557
`adiu` varchar(512) NOT NULL DEFAULT '',
@@ -562,15 +562,15 @@ CREATE TABLE `test_global_index_with_vgen_col` (
562562
KEY `idx_adiu_v_name` (`adiu`) global
563563
) TTL (gmt_create + INTERVAL 300 SECOND) partition by key(adiu) partitions 8;
564564

565-
CREATE TABLE `test_current_timestamp` (
565+
CREATE TABLE IF NOT EXISTS `test_current_timestamp` (
566566
`c1` int not null,
567567
`c2` varchar(255),
568568
`c3` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
569569
PRIMARY KEY (`c1`),
570570
KEY `idx_adiu_v_name` (`c2`, `c3`) global partition by key(`c2`) partitions 5
571571
) partition by key(`c1`) partitions 8;
572572

573-
CREATE TABLE `table_ttl_00` (
573+
CREATE TABLE IF NOT EXISTS `table_ttl_00` (
574574
`name` varchar(512) NOT NULL,
575575
`pk` varchar(512) NOT NULL,
576576
`adiu` varchar(512) NOT NULL DEFAULT '',

0 commit comments

Comments
 (0)