qzsee opened a new pull request, #27741:
URL: https://github.com/apache/doris/pull/27741

   ```java
   for (Partition partition : olapTable.getPartitions()) {
       short replicationNum = replicaAlloc.getTotalReplicaNum();
       long visibleVersion = partition.getVisibleVersion();
       // Here we only get VISIBLE indexes. All other indexes are not queryable.
       // So it does not matter if tablets of other indexes are not matched.
       for (MaterializedIndex index : 
partition.getMaterializedIndices(IndexExtState.VISIBLE)) {
           Preconditions.checkState(backendBucketsSeq.size() == 
index.getTablets().size(),
                   backendBucketsSeq.size() + " vs. " + 
index.getTablets().size());
           int idx = 0;
           for (Long tabletId : index.getTabletIdsInOrder()) {
               counter.totalTabletNum++;
               Set<Long> bucketsSeq = backendBucketsSeq.get(idx);
               Preconditions.checkState(bucketsSeq.size() == replicationNum,
                       bucketsSeq.size() + " vs. " + replicationNum);
               Tablet tablet = index.getTablet(tabletId);
               TabletStatus st = tablet.getColocateHealthStatus(
                       visibleVersion, replicaAlloc, bucketsSeq);
               if (st != TabletStatus.HEALTHY) {
                   counter.unhealthyTabletNum++;
                   unstableReason = String.format("get unhealthy tablet %d in 
colocate table."
                           + " status: %s", tablet.getId(), st);
                   LOG.debug(unstableReason);
   
                   if (!tablet.readyToBeRepaired(infoService, Priority.NORMAL)) 
{
                       counter.tabletNotReady++;
                       // 这里需要将  idx++ ,否则 bucketsSeq和 tablet replicas backends 
对应不上
                       idx++;
                       continue;
                   }
   
                   TabletSchedCtx tabletCtx = new TabletSchedCtx(
                           TabletSchedCtx.Type.REPAIR,
                           db.getId(), tableId, partition.getId(), 
index.getId(), tablet.getId(),
                           replicaAlloc, System.currentTimeMillis());
                   // the tablet status will be set again when being scheduled
                   tabletCtx.setTabletStatus(st);
                   tabletCtx.setPriority(Priority.NORMAL);
                   tabletCtx.setTabletOrderIdx(idx);
   
                   AddResult res = tabletScheduler.addTablet(tabletCtx, false 
/* not force */);
                   if (res == AddResult.LIMIT_EXCEED || res == 
AddResult.DISABLED) {
                       // tablet in scheduler exceed limit, or scheduler is 
disabled,
                       // skip this group and check next one.
                       LOG.info("tablet scheduler return: {}. stop colocate 
table check", res.name());
                       break OUT;
                   } else if (res == AddResult.ADDED) {
                       counter.addToSchedulerTabletNum++;
                   }  else {
                       counter.tabletInScheduler++;
                   }
               }
               idx++;
           }
       }
   }
   ```
   ## Proposed changes
   
   Issue Number: close #xxx
   
   <!--Describe your changes.-->
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to