@@ -515,72 +515,72 @@ public void testAdminGetRegionMetrics() throws Exception {
515
515
" `T` bigint(20) NOT NULL,\n " +
516
516
" `V` varbinary(1024) DEFAULT NULL,\n " +
517
517
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
518
- ") TABLEGROUP = test_get_region_metrics PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
518
+ ") TABLEGROUP = test_get_region_metrics PARTITION BY KEY(`K`) PARTITIONS 10 ;\n " +
519
519
"\n " +
520
520
"CREATE TABLE IF NOT EXISTS `test_get_region_metrics$cf2` (\n " +
521
521
" `K` varbinary(1024) NOT NULL,\n " +
522
522
" `Q` varbinary(256) NOT NULL,\n " +
523
523
" `T` bigint(20) NOT NULL,\n " +
524
524
" `V` varbinary(1024) DEFAULT NULL,\n " +
525
525
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
526
- ") TABLEGROUP = test_get_region_metrics PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
526
+ ") TABLEGROUP = test_get_region_metrics PARTITION BY KEY(`K`) PARTITIONS 10 ;\n " +
527
527
"\n " +
528
528
"CREATE TABLE IF NOT EXISTS `test_get_region_metrics$cf3` (\n " +
529
529
" `K` varbinary(1024) NOT NULL,\n " +
530
530
" `Q` varbinary(256) NOT NULL,\n " +
531
531
" `T` bigint(20) NOT NULL,\n " +
532
532
" `V` varbinary(1024) DEFAULT NULL,\n " +
533
533
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
534
- ") TABLEGROUP = test_get_region_metrics PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
534
+ ") TABLEGROUP = test_get_region_metrics PARTITION BY KEY(`K`) PARTITIONS 10 ;\n " +
535
535
"\n " +
536
- "CREATE DATABASE IF NOT EXISTS `get_region`;\n " +
537
- "use `get_region`;\n " +
538
- "CREATE TABLEGROUP IF NOT EXISTS `get_region:test_multi_cf` SHARDING = 'ADAPTIVE';\n " +
539
- "CREATE TABLE IF NOT EXISTS `get_region:test_multi_cf$cf1` (\n " +
536
+ "CREATE TABLEGROUP IF NOT EXISTS test_no_part SHARDING = 'ADAPTIVE';\n " +
537
+ "CREATE TABLE IF NOT EXISTS `test_no_part$cf1` (\n " +
540
538
" `K` varbinary(1024) NOT NULL,\n " +
541
539
" `Q` varbinary(256) NOT NULL,\n " +
542
540
" `T` bigint(20) NOT NULL,\n " +
543
541
" `V` varbinary(1024) DEFAULT NULL,\n " +
544
- " PRIMARY KEY (`K`, `Q`, `T`)\n " +
545
- ") TABLEGROUP = `get_region:test_multi_cf` PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
546
- "CREATE TABLE IF NOT EXISTS `get_region:test_multi_cf $cf2` (\n " +
542
+ " PRIMARY KEY (`K`, `Q`, `T`)\n " +
543
+ ") TABLEGROUP = test_no_part ;\n " +
544
+ "CREATE TABLE IF NOT EXISTS `test_no_part $cf2` (\n " +
547
545
" `K` varbinary(1024) NOT NULL,\n " +
548
546
" `Q` varbinary(256) NOT NULL,\n " +
549
547
" `T` bigint(20) NOT NULL,\n " +
550
548
" `V` varbinary(1024) DEFAULT NULL,\n " +
551
549
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
552
- ") TABLEGROUP = `get_region:test_multi_cf` PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
553
- "CREATE TABLE IF NOT EXISTS `get_region:test_multi_cf $cf3` (\n " +
550
+ ") TABLEGROUP = test_no_part ;\n " +
551
+ "CREATE TABLE IF NOT EXISTS `test_no_part $cf3` (\n " +
554
552
" `K` varbinary(1024) NOT NULL,\n " +
555
553
" `Q` varbinary(256) NOT NULL,\n " +
556
554
" `T` bigint(20) NOT NULL,\n " +
557
555
" `V` varbinary(1024) DEFAULT NULL,\n " +
558
556
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
559
- ") TABLEGROUP = `get_region:test_multi_cf` PARTITION BY KEY(`K`) PARTITIONS 3;" +
560
- "USE `test`;" +
561
- "CREATE TABLEGROUP IF NOT EXISTS test_no_part SHARDING = 'ADAPTIVE';" +
562
- "CREATE TABLE IF NOT EXISTS `test_no_part$cf1` (\n " +
557
+ ") TABLEGROUP = test_no_part;\n " +
558
+ "CREATE DATABASE IF NOT EXISTS `get_region`;\n " +
559
+ "use `get_region`;\n " +
560
+ "CREATE TABLEGROUP IF NOT EXISTS `get_region:test_multi_cf` SHARDING = 'ADAPTIVE';\n " +
561
+ "CREATE TABLE IF NOT EXISTS `get_region:test_multi_cf$cf1` (\n " +
563
562
" `K` varbinary(1024) NOT NULL,\n " +
564
563
" `Q` varbinary(256) NOT NULL,\n " +
565
564
" `T` bigint(20) NOT NULL,\n " +
566
565
" `V` varbinary(1024) DEFAULT NULL,\n " +
567
566
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
568
- ") TABLEGROUP = `test_no_part` ;\n " +
569
- "CREATE TABLE IF NOT EXISTS `test_no_part $cf2` (\n " +
567
+ ") TABLEGROUP = `get_region:test_multi_cf` PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
568
+ "CREATE TABLE IF NOT EXISTS `get_region:test_multi_cf $cf2` (\n " +
570
569
" `K` varbinary(1024) NOT NULL,\n " +
571
570
" `Q` varbinary(256) NOT NULL,\n " +
572
571
" `T` bigint(20) NOT NULL,\n " +
573
572
" `V` varbinary(1024) DEFAULT NULL,\n " +
574
573
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
575
- ") TABLEGROUP = `test_no_part` ;\n " +
576
- "CREATE TABLE IF NOT EXISTS `test_no_part $cf3` (\n " +
574
+ ") TABLEGROUP = `get_region:test_multi_cf` PARTITION BY KEY(`K`) PARTITIONS 3 ;\n " +
575
+ "CREATE TABLE IF NOT EXISTS `get_region:test_multi_cf $cf3` (\n " +
577
576
" `K` varbinary(1024) NOT NULL,\n " +
578
577
" `Q` varbinary(256) NOT NULL,\n " +
579
578
" `T` bigint(20) NOT NULL,\n " +
580
579
" `V` varbinary(1024) DEFAULT NULL,\n " +
581
580
" PRIMARY KEY (`K`, `Q`, `T`)\n " +
582
- ") TABLEGROUP = `test_no_part` ;" );
581
+ ") TABLEGROUP = `get_region:test_multi_cf` PARTITION BY KEY(`K`) PARTITIONS 3 ;" );
583
582
st .close ();
583
+ conn .close ();
584
584
String tablegroup1 = "test_get_region_metrics" ;
585
585
String tablegroup2 = "get_region:test_multi_cf" ;
586
586
Configuration conf = ObHTableTestUtil .newConfiguration ();
@@ -594,11 +594,11 @@ public void testAdminGetRegionMetrics() throws Exception {
594
594
Assert .assertTrue (thrown .getCause () instanceof ObTableException );
595
595
Assert .assertEquals (ResultCodes .OB_KV_HBASE_TABLE_NOT_EXISTS .errorCode , ((ObTableException ) thrown .getCause ()).getErrorCode ());
596
596
597
- // test use serverName without tableName to get region metrics
598
- assertThrows (FeatureNotSupportedException .class ,
599
- () -> {
600
- admin .getRegionMetrics (ServerName .valueOf ("localhost,1,1" ));
601
- });
597
+ // test use serverName without tableName to get region metrics
598
+ assertThrows (FeatureNotSupportedException .class ,
599
+ () -> {
600
+ admin .getRegionMetrics (ServerName .valueOf ("localhost,1,1" ));
601
+ });
602
602
603
603
// test single-thread getRegionMetrics after writing
604
604
batchInsert (10000 , tablegroup1 );
@@ -607,7 +607,7 @@ public void testAdminGetRegionMetrics() throws Exception {
607
607
List <RegionMetrics > metrics = admin .getRegionMetrics (ServerName .valueOf ("localhost,1,1" ), TableName .valueOf (tablegroup1 ));
608
608
long cost = System .currentTimeMillis () - start ;
609
609
System .out .println ("get region metrics time usage: " + cost + "ms, tablegroup: " + tablegroup1 );
610
- assertEquals (9 , metrics .size ());
610
+ assertEquals (10 , metrics .size ());
611
611
612
612
// test getRegionMetrics concurrently reading while writing
613
613
ExecutorService executorService = Executors .newFixedThreadPool (10 );
@@ -625,7 +625,7 @@ public void testAdminGetRegionMetrics() throws Exception {
625
625
regionMetrics = admin .getRegionMetrics (null , TableName .valueOf (tablegroup1 ));
626
626
long thrCost = System .currentTimeMillis () - thrStart ;
627
627
System .out .println ("task: " + taskId + ", get region metrics time usage: " + thrCost + "ms, tablegroup: " + tablegroup1 );
628
- if (regionMetrics .size () != 9 ) {
628
+ if (regionMetrics .size () != 10 ) {
629
629
throw new ObTableGetException (
630
630
"the number of region metrics does not match the number of tablets, the number of region metrics: " + regionMetrics .size ());
631
631
}
@@ -634,7 +634,7 @@ public void testAdminGetRegionMetrics() throws Exception {
634
634
regionMetrics = admin .getRegionMetrics (null , TableName .valueOf (tablegroup2 ));
635
635
long thrCost = System .currentTimeMillis () - thrStart ;
636
636
System .out .println ("task: " + taskId + ", get region metrics time usage: " + thrCost + "ms, tablegroup: " + tablegroup2 );
637
- if (regionMetrics .size () != 9 ) {
637
+ if (regionMetrics .size () != 3 ) {
638
638
throw new ObTableGetException (
639
639
"the number of region metrics does not match the number of tablets, the number of region metrics: " + regionMetrics .size ());
640
640
}
@@ -1624,12 +1624,7 @@ public void testHbaseDDLException() throws Exception {
1624
1624
}
1625
1625
1626
1626
// 11. check table exists from an uncreated namespace
1627
- try {
1628
- admin .tableExists (TableName .valueOf ("n101:t1" ));
1629
- fail ();
1630
- } catch (Exception e ) {
1631
- Assert .assertEquals (e .getClass (), NamespaceNotFoundException .class );
1632
- }
1627
+ Assert .assertFalse (admin .tableExists (TableName .valueOf ("n101:t1" )));
1633
1628
1634
1629
}
1635
1630
0 commit comments