@@ -1258,8 +1258,17 @@ private static ObPartitionEntry getPartitionLocationFromResultSetByTablet(TableE
12581258 }
12591259 location .addReplicaLocation (replica );
12601260
1261- if (partitionLocationInfo .initialized .compareAndSet (false , true )) {
1261+ if (location . getLeader () != null && partitionLocationInfo .initialized .compareAndSet (false , true )) {
12621262 partitionLocationInfo .initializationLatch .countDown ();
1263+ } else if (rs .isLast () && location .getLeader () == null ) {
1264+ partitionLocationInfo .initializationLatch .countDown ();
1265+ RUNTIME .error (LCD .convert ("01-00028" ), partitionId , partitionEntry , tableEntry );
1266+ RUNTIME .error (format (
1267+ "partition=%d has no leader partitionEntry=%s original tableEntry=%s" ,
1268+ partitionId , partitionEntry , tableEntry ));
1269+ throw new ObTablePartitionNoMasterException (format (
1270+ "partition=%d has no leader partitionEntry=%s original tableEntry=%s" ,
1271+ partitionId , partitionEntry , tableEntry ));
12631272 }
12641273 }
12651274
@@ -1312,8 +1321,17 @@ private static ObPartitionEntry getPartitionLocationFromResultSet(TableEntry tab
13121321 }
13131322 location .addReplicaLocation (replica );
13141323
1315- if (partitionLocationInfo .initialized .compareAndSet (false , true )) {
1324+ if (location .getLeader () != null && partitionLocationInfo .initialized .compareAndSet (false , true )) {
1325+ partitionLocationInfo .initializationLatch .countDown ();
1326+ } else if (rs .isLast () && location .getLeader () == null ) {
13161327 partitionLocationInfo .initializationLatch .countDown ();
1328+ RUNTIME .error (LCD .convert ("01-00028" ), partitionId , partitionEntry , tableEntry );
1329+ RUNTIME .error (format (
1330+ "partition=%d has no leader partitionEntry=%s original tableEntry=%s" ,
1331+ partitionId , partitionEntry , tableEntry ));
1332+ throw new ObTablePartitionNoMasterException (format (
1333+ "partition=%d has no leader partitionEntry=%s original tableEntry=%s" ,
1334+ partitionId , partitionEntry , tableEntry ));
13171335 }
13181336 } else {
13191337 partitionId = rs .getLong ("partition_id" );
0 commit comments