Skip to content

Commit 4e6e2cb

Browse files
authored
[Enhancement] Remove TabletinvertedIndex lock to improve metadata performance (StarRocks#66288)
1 parent c68e652 commit 4e6e2cb

File tree

13 files changed

+820
-509
lines changed

13 files changed

+820
-509
lines changed

fe/fe-core/src/main/java/com/starrocks/alter/SystemHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080

8181
import java.util.Collection;
8282
import java.util.List;
83-
import java.util.Map;
8483
import java.util.Set;
8584
import java.util.stream.Collectors;
8685

@@ -331,8 +330,8 @@ protected boolean canDropBackend(List<Long> backendTabletIds) {
331330
return false;
332331
}
333332

334-
Map<Long, Replica> replicas = invertedIndex.getReplicas(tabletId);
335-
if (replicas == null) {
333+
List<Replica> replicas = invertedIndex.getReplicasByTabletId(tabletId);
334+
if (replicas.isEmpty()) {
336335
continue;
337336
}
338337
// It means the replica can be migrated to retained backends.
@@ -342,7 +341,7 @@ protected boolean canDropBackend(List<Long> backendTabletIds) {
342341

343342
// Make sure there is at least one normal replica on retained backends.
344343
boolean hasNormalReplica = false;
345-
for (Replica replica : replicas.values()) {
344+
for (Replica replica : replicas) {
346345
if (replica.getState() == ReplicaState.NORMAL && retainedBackendIds.contains(replica.getBackendId())) {
347346
hasNormalReplica = true;
348347
break;

0 commit comments

Comments
 (0)