caiconghui commented on a change in pull request #6200:
URL: https://github.com/apache/incubator-doris/pull/6200#discussion_r670438530
##########
File path: fe/fe-core/src/main/java/org/apache/doris/master/ReportHandler.java
##########
@@ -660,51 +679,64 @@ private static void deleteFromBackend(Map<Long, TTablet>
backendTablets,
int deleteFromBackendCounter = 0;
int addToMetaCounter = 0;
AgentBatchTask batchTask = new AgentBatchTask();
- for (Long tabletId : backendTablets.keySet()) {
- TTablet backendTablet = backendTablets.get(tabletId);
- for (TTabletInfo backendTabletInfo :
backendTablet.getTabletInfos()) {
- boolean needDelete = false;
- if (!foundTabletsWithValidSchema.contains(tabletId)) {
- if (isBackendReplicaHealthy(backendTabletInfo)) {
- // if this tablet is not in meta. try adding it.
- // if add failed. delete this tablet from backend.
- try {
- addReplica(tabletId, backendTabletInfo, backendId);
- // update counter
- needDelete = false;
- ++addToMetaCounter;
- } catch (MetaNotFoundException e) {
- LOG.warn("failed add to meta. tablet[{}],
backend[{}]. {}",
- tabletId, backendId, e.getMessage());
- needDelete = true;
- }
- } else {
- needDelete = true;
- }
- }
-
- if (needDelete) {
- // drop replica
- DropReplicaTask task = new DropReplicaTask(backendId,
tabletId, backendTabletInfo.getSchemaHash());
- batchTask.addTask(task);
- LOG.warn("delete tablet[" + tabletId + " - " +
backendTabletInfo.getSchemaHash()
- + "] from backend[" + backendId + "] because not
found in meta");
- ++deleteFromBackendCounter;
- }
- } // end for tabletInfos
-
- if (foundTabletsWithInvalidSchema.containsKey(tabletId)) {
- // this tablet is found in meta but with invalid schema hash.
- // delete it.
+ if (foundTabletsWithValidSchema.size() +
foundTabletsWithInvalidSchema.size() == backendTablets.size()) {
Review comment:
ok
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]