liaoxin01 commented on code in PR #65049:
URL: https://github.com/apache/doris/pull/65049#discussion_r3499734747


##########
fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java:
##########
@@ -42,6 +42,7 @@ public class BeSelectionPolicy {
     public boolean needScheduleAvailable = false;
     public boolean needQueryAvailable = false;
     public boolean needLoadAvailable = false;
+    public boolean needNonDecommissioned = false;
     // Resource tag. Empty means no need to consider resource tag.

Review Comment:
   Fixed in 64a88325e36: `BeSelectionPolicy.toString()` now includes 
`nonDecommissioned`, and the policy test asserts it.



##########
fe/fe-core/src/main/java/org/apache/doris/system/BeSelectionPolicy.java:
##########
@@ -156,6 +162,7 @@ private boolean isMatch(Backend backend) {
         if (needScheduleAvailable && !backend.isScheduleAvailable()
                 || needQueryAvailable && !backend.isQueryAvailable()
                 || needLoadAvailable && !backend.isLoadAvailable()
+                || needNonDecommissioned && (backend.isDecommissioned() || 
backend.isDecommissioning())
                 || (!resourceTags.isEmpty() && 
!resourceTags.contains(backend.getLocationTag()))

Review Comment:
   Fixed in 64a88325e36: applied `needNonDecommissioned()` to 
`LoadSubmitter.selectOneBackend()` and local-mode 
`MysqlLoadManager.selectBackendForMySqlLoad()`, with new unit tests for both 
paths.



##########
fe/fe-core/src/test/java/org/apache/doris/qe/InsertStreamTxnExecutorTest.java:
##########
@@ -18,33 +18,36 @@
 package org.apache.doris.qe;
 
 import org.apache.doris.catalog.Env;
+import org.apache.doris.common.jmockit.Deencapsulation;
 import org.apache.doris.system.Backend;
 import org.apache.doris.system.SystemInfoService;
 
-import com.google.common.collect.ImmutableMap;
 import org.junit.Assert;
 import org.junit.Test;
-import org.mockito.MockedStatic;
-import org.mockito.Mockito;
 
 public class InsertStreamTxnExecutorTest {
 
     @Test
     public void testSelectBackendForTxnLoadUsesCurrentClusterBackends() throws 
Exception {
-        SystemInfoService systemInfoService = Mockito.spy(new 
SystemInfoService());
+        SystemInfoService originalSystemInfoService = 
Env.getCurrentSystemInfo();
+        SystemInfoService systemInfoService = new SystemInfoService();
         Backend otherClusterBackend = createBackend(10001L, "127.0.0.1", 9060);
-        Backend currentClusterBackend = createBackend(10002L, "127.0.0.2", 
9061);
+        otherClusterBackend.setAlive(false);
+        Backend decommissioningBackend = createBackend(10002L, "127.0.0.2", 
9061);
+        decommissioningBackend.setDecommissioning(true);
+        Backend currentClusterBackend = createBackend(10003L, "127.0.0.3", 
9062);

Review Comment:
   Fixed in 64a88325e36: renamed the test backend variable to `deadBackend` so 
the test intent matches the setup.



-- 
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]

Reply via email to