You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2020/01/15 07:15:02 UTC
[incubator-doris] branch master updated: Remove and comment some FE
code (#2766)
This is an automated email from the ASF dual-hosted git repository.
zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 54952a2 Remove and comment some FE code (#2766)
54952a2 is described below
commit 54952a24adf9143c9aedde5cfcacf14b0acaebb5
Author: kangkaisen <ka...@apache.org>
AuthorDate: Wed Jan 15 15:14:52 2020 +0800
Remove and comment some FE code (#2766)
---
fe/src/main/java/org/apache/doris/catalog/Replica.java | 1 +
.../java/org/apache/doris/catalog/TabletInvertedIndex.java | 1 -
.../java/org/apache/doris/clone/BackendLoadStatistic.java | 2 +-
fe/src/main/java/org/apache/doris/clone/LoadBalancer.java | 7 ++-----
fe/src/main/java/org/apache/doris/clone/TabletChecker.java | 2 +-
.../main/java/org/apache/doris/clone/TabletScheduler.java | 13 ++++---------
fe/src/main/java/org/apache/doris/system/Backend.java | 13 +++----------
.../apache/doris/transaction/TransactionIdGenerator.java | 3 +--
.../java/org/apache/doris/transaction/TransactionState.java | 7 ++-----
9 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/fe/src/main/java/org/apache/doris/catalog/Replica.java b/fe/src/main/java/org/apache/doris/catalog/Replica.java
index d088c54..4588d5d 100644
--- a/fe/src/main/java/org/apache/doris/catalog/Replica.java
+++ b/fe/src/main/java/org/apache/doris/catalog/Replica.java
@@ -85,6 +85,7 @@ public class Replica implements Writable {
private long pathHash = -1;
+ // bad means this Replica is unrecoverable and we will delete it
private boolean bad = false;
/*
diff --git a/fe/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java b/fe/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
index b2d00cf..dcb873d 100644
--- a/fe/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
+++ b/fe/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java
@@ -502,7 +502,6 @@ public class TabletInvertedIndex {
writeLock();
try {
Preconditions.checkState(tabletMetaMap.containsKey(tabletId));
- TabletMeta tabletMeta = tabletMetaMap.get(tabletId);
if (replicaMetaTable.containsRow(tabletId)) {
Replica replica = replicaMetaTable.remove(tabletId, backendId);
replicaToTabletMap.remove(replica.getId());
diff --git a/fe/src/main/java/org/apache/doris/clone/BackendLoadStatistic.java b/fe/src/main/java/org/apache/doris/clone/BackendLoadStatistic.java
index acd61a4..5479a16 100644
--- a/fe/src/main/java/org/apache/doris/clone/BackendLoadStatistic.java
+++ b/fe/src/main/java/org/apache/doris/clone/BackendLoadStatistic.java
@@ -203,7 +203,7 @@ public class BackendLoadStatistic {
totalReplicaNumMap = invertedIndex.getReplicaNumByBeIdAndStorageMedium(beId);
// This is very tricky. because the number of replica on specified medium we get
- // from getReplicaNumByBeIdAndStorageMedium() is counted based on meta data.
+ // from getReplicaNumByBeIdAndStorageMedium() is defined by table properties,
// but in fact there may not has SSD disk on this backend. So if we found that no SSD disk on this
// backend, set the replica number to 0, otherwise, the average replica number on specified medium
// will be incorrect.
diff --git a/fe/src/main/java/org/apache/doris/clone/LoadBalancer.java b/fe/src/main/java/org/apache/doris/clone/LoadBalancer.java
index 12426a5..f764f56 100644
--- a/fe/src/main/java/org/apache/doris/clone/LoadBalancer.java
+++ b/fe/src/main/java/org/apache/doris/clone/LoadBalancer.java
@@ -229,7 +229,7 @@ public class LoadBalancer {
}
// if all low backends is not available, return
- if (lowBe.stream().allMatch(b -> !b.isAvailable())) {
+ if (lowBe.stream().noneMatch(BackendLoadStatistic::isAvailable)) {
throw new SchedException(Status.UNRECOVERABLE, "all low load backends is unavailable");
}
@@ -261,9 +261,7 @@ public class LoadBalancer {
continue;
}
long pathHash = slot.takeBalanceSlot(replica.getPathHash());
- if (pathHash == -1) {
- continue;
- } else {
+ if (pathHash != -1) {
tabletCtx.setSrc(replica);
setSource = true;
break;
@@ -318,7 +316,6 @@ public class LoadBalancer {
long pathHash = slot.takeAnAvailBalanceSlotFrom(pathLow);
if (pathHash == -1) {
LOG.debug("paths has no available balance slot: {}", pathLow);
- continue;
} else {
tabletCtx.setDest(beStat.getBeId(), pathHash);
setDest = true;
diff --git a/fe/src/main/java/org/apache/doris/clone/TabletChecker.java b/fe/src/main/java/org/apache/doris/clone/TabletChecker.java
index 1d9ac6d..bae2438 100644
--- a/fe/src/main/java/org/apache/doris/clone/TabletChecker.java
+++ b/fe/src/main/java/org/apache/doris/clone/TabletChecker.java
@@ -126,7 +126,7 @@ public class TabletChecker extends MasterDaemon {
}
// we also need to change the priority of tablets which are already in
- tabletScheduler.changePriorityOfTablets(dbId, tblId, partitionIds);
+ tabletScheduler.changeTabletsPriorityToVeryHigh(dbId, tblId, partitionIds);
}
private void removePrios(long dbId, long tblId, List<Long> partitionIds) {
diff --git a/fe/src/main/java/org/apache/doris/clone/TabletScheduler.java b/fe/src/main/java/org/apache/doris/clone/TabletScheduler.java
index e8dbee3..a7d1b23 100644
--- a/fe/src/main/java/org/apache/doris/clone/TabletScheduler.java
+++ b/fe/src/main/java/org/apache/doris/clone/TabletScheduler.java
@@ -228,9 +228,9 @@ public class TabletScheduler extends MasterDaemon {
}
/*
- * Iterate current tablets, change their priority if necessary.
+ * Iterate current tablets, change their priority to VERY_HIGH if necessary.
*/
- public synchronized void changePriorityOfTablets(long dbId, long tblId, List<Long> partitionIds) {
+ public synchronized void changeTabletsPriorityToVeryHigh(long dbId, long tblId, List<Long> partitionIds) {
PriorityQueue<TabletSchedCtx> newPendingTablets = new PriorityQueue<>();
for (TabletSchedCtx tabletCtx : pendingTablets) {
if (tabletCtx.getDbId() == dbId && tabletCtx.getTblId() == tblId
@@ -552,6 +552,7 @@ public class TabletScheduler extends MasterDaemon {
handleReplicaMissing(tabletCtx, batchTask);
break;
case VERSION_INCOMPLETE:
+ case NEED_FURTHER_REPAIR: // same as version incomplete, it prefer to the dest replica which need further repair
handleReplicaVersionIncomplete(tabletCtx, batchTask);
break;
case REPLICA_RELOCATING:
@@ -572,10 +573,6 @@ public class TabletScheduler extends MasterDaemon {
case COLOCATE_REDUNDANT:
handleColocateRedundant(tabletCtx);
break;
- case NEED_FURTHER_REPAIR:
- // same as version incomplete, it prefer to the dest replica which need further repair
- handleReplicaVersionIncomplete(tabletCtx, batchTask);
- break;
default:
break;
}
@@ -1224,9 +1221,7 @@ public class TabletScheduler extends MasterDaemon {
// 1. remove the tablet ctx if timeout
List<TabletSchedCtx> timeoutTablets = Lists.newArrayList();
synchronized (this) {
- runningTablets.values().stream().filter(t -> t.isTimeout()).forEach(t -> {
- timeoutTablets.add(t);
- });
+ runningTablets.values().stream().filter(TabletSchedCtx::isTimeout).forEach(timeoutTablets::add);
for (TabletSchedCtx tabletSchedCtx : timeoutTablets) {
removeTabletCtx(tabletSchedCtx, "timeout");
diff --git a/fe/src/main/java/org/apache/doris/system/Backend.java b/fe/src/main/java/org/apache/doris/system/Backend.java
index 79e81c0..4bce2a9 100644
--- a/fe/src/main/java/org/apache/doris/system/Backend.java
+++ b/fe/src/main/java/org/apache/doris/system/Backend.java
@@ -37,13 +37,13 @@ import org.apache.logging.log4j.Logger;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
/**
* This class extends the primary identifier of a Backend with ephemeral state,
@@ -164,26 +164,21 @@ public class Backend implements Writable {
// for test only
public void updateOnce(int bePort, int httpPort, int beRpcPort) {
- boolean isChanged = false;
if (this.bePort.get() != bePort) {
- isChanged = true;
this.bePort.set(bePort);
}
if (this.httpPort.get() != httpPort) {
- isChanged = true;
this.httpPort.set(httpPort);
}
if (this.beRpcPort.get() != beRpcPort) {
- isChanged = true;
this.beRpcPort.set(beRpcPort);
}
long currentTime = System.currentTimeMillis();
this.lastUpdateMs.set(currentTime);
if (!isAlive.get()) {
- isChanged = true;
this.lastStartTime.set(currentTime);
LOG.info("{} is alive,", this.toString());
this.isAlive.set(true);
@@ -354,7 +349,6 @@ public class Backend implements Writable {
}
public void updateDisks(Map<String, TDisk> backendDisks) {
-
ImmutableMap<String, DiskInfo> disks = disksRef.get();
// The very first time to init the path info
if (!initPathInfo) {
@@ -362,11 +356,12 @@ public class Backend implements Writable {
for (DiskInfo diskInfo : disks.values()) {
if (diskInfo.getPathHash() == 0) {
allPathHashUpdated = false;
+ break;
}
}
if (allPathHashUpdated) {
initPathInfo = true;
- Catalog.getCurrentSystemInfo().updatePathInfo(disks.values().stream().collect(Collectors.toList()), Lists.newArrayList());
+ Catalog.getCurrentSystemInfo().updatePathInfo(new ArrayList<>(disks.values()), Lists.newArrayList());
}
}
@@ -555,8 +550,6 @@ public class Backend implements Writable {
return BackendState.using;
case 1:
return BackendState.offline;
- case 2:
- return BackendState.free;
default:
return BackendState.free;
}
diff --git a/fe/src/main/java/org/apache/doris/transaction/TransactionIdGenerator.java b/fe/src/main/java/org/apache/doris/transaction/TransactionIdGenerator.java
index 77e6d88..6f741ce 100644
--- a/fe/src/main/java/org/apache/doris/transaction/TransactionIdGenerator.java
+++ b/fe/src/main/java/org/apache/doris/transaction/TransactionIdGenerator.java
@@ -66,8 +66,7 @@ public class TransactionIdGenerator {
out.writeLong(batchEndId);
}
public void readFields(DataInput in) throws IOException {
- long endId = in.readLong();
- batchEndId = endId;
+ batchEndId = in.readLong();
// maybe a little rough
nextId = batchEndId;
}
diff --git a/fe/src/main/java/org/apache/doris/transaction/TransactionState.java b/fe/src/main/java/org/apache/doris/transaction/TransactionState.java
index 4b2c5e8..03bcf70 100644
--- a/fe/src/main/java/org/apache/doris/transaction/TransactionState.java
+++ b/fe/src/main/java/org/apache/doris/transaction/TransactionState.java
@@ -211,11 +211,8 @@ public class TransactionState implements Writable {
}
public boolean isRunning() {
- if (transactionStatus == TransactionStatus.PREPARE
- || transactionStatus == TransactionStatus.COMMITTED) {
- return true;
- }
- return false;
+ return transactionStatus == TransactionStatus.PREPARE
+ || transactionStatus == TransactionStatus.COMMITTED;
}
public void addPublishVersionTask(Long backendId, PublishVersionTask task) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org