Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fe/src/main/java/org/apache/doris/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -4227,6 +4227,7 @@ private void unprotectUpdateReplica(ReplicaPersistInfo info) {
Replica replica = tablet.getReplicaByBackendId(info.getBackendId());
Preconditions.checkNotNull(replica, info);
replica.updateVersionInfo(info.getVersion(), info.getVersionHash(), info.getDataSize(), info.getRowCount());
replica.setBad(false);
}

public void replayAddReplica(ReplicaPersistInfo info) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,17 @@ private boolean needSync(Replica replicaInFe, TTabletInfo backendTabletInfo) {
}
long versionInFe = replicaInFe.getVersion();
long versionHashInFe = replicaInFe.getVersionHash();

if (backendTabletInfo.getVersion() > versionInFe
|| (versionInFe == backendTabletInfo.getVersion()
&& versionHashInFe != backendTabletInfo.getVersion_hash())) {
|| (versionInFe == backendTabletInfo.getVersion() && versionHashInFe != backendTabletInfo.getVersion_hash())) {
// backend replica's version is larger or newer than replica in FE, sync it.
return true;
} else if (versionInFe == backendTabletInfo.getVersion() && versionHashInFe == backendTabletInfo.getVersion_hash()
&& replicaInFe.isBad()) {
// backend replica's version is equal to replica in FE, but replica in FE is bad, while backend replica is good, sync it
return true;
}

return false;
}

Expand Down
6 changes: 4 additions & 2 deletions fe/src/main/java/org/apache/doris/master/ReportHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,8 @@ private static void sync(Map<Long, TTablet> backendTablets, ListMultimap<Long, L
}

if (metaVersion < backendVersion
|| (metaVersion == backendVersion && metaVersionHash != backendVersionHash)) {
|| (metaVersion == backendVersion && metaVersionHash != backendVersionHash)
|| (metaVersion == backendVersion && metaVersionHash == backendVersionHash && replica.isBad())) {

// This is just a optimization for the old compatibility
// The init version in FE is (1-0), in BE is (2-0)
Expand All @@ -455,7 +456,8 @@ private static void sync(Map<Long, TTablet> backendTablets, ListMultimap<Long, L
// 1. PUSH finished in BE but failed or not yet report to FE
// 2. repair for VERSION_INCOMPLETE finished in BE, but failed or not yet report to FE
replica.updateVersionInfo(backendVersion, backendVersionHash, dataSize, rowCount);

replica.setBad(false);

if (replica.getLastFailedVersion() < 0 && !isInitVersion) {
// last failed version < 0 means this replica becomes health after sync,
// so we write an edit log to sync this operation
Expand Down