|
54 | 54 | import org.apache.doris.clone.TabletChecker; |
55 | 55 | import org.apache.doris.clone.TabletScheduler; |
56 | 56 | import org.apache.doris.clone.TabletSchedulerStat; |
| 57 | +import org.apache.doris.cloud.system.CloudSystemInfoService; |
57 | 58 | import org.apache.doris.common.AnalysisException; |
58 | 59 | import org.apache.doris.common.Config; |
59 | 60 | import org.apache.doris.common.ConfigBase; |
|
260 | 261 | import org.apache.doris.statistics.StatisticsJobAppender; |
261 | 262 | import org.apache.doris.statistics.StatisticsMetricCollector; |
262 | 263 | import org.apache.doris.statistics.query.QueryStats; |
| 264 | +import org.apache.doris.system.Backend; |
263 | 265 | import org.apache.doris.system.Frontend; |
264 | 266 | import org.apache.doris.system.HeartbeatMgr; |
265 | 267 | import org.apache.doris.system.SystemInfoService; |
|
315 | 317 | import java.util.ArrayList; |
316 | 318 | import java.util.Arrays; |
317 | 319 | import java.util.Collection; |
| 320 | +import java.util.Collections; |
318 | 321 | import java.util.Comparator; |
319 | 322 | import java.util.HashMap; |
320 | 323 | import java.util.HashSet; |
@@ -1766,6 +1769,26 @@ private void transferToMaster() { |
1766 | 1769 | editLog.logMasterInfo(masterInfo); |
1767 | 1770 | LOG.info("logMasterInfo:{}", masterInfo); |
1768 | 1771 |
|
| 1772 | + if (Boolean.getBoolean(FeConstants.DROP_BACKENDS_KEY)) { |
| 1773 | + LOG.info("drop_backends is set, dropping all backends..."); |
| 1774 | + try { |
| 1775 | + SystemInfoService systemInfoService = Env.getCurrentSystemInfo(); |
| 1776 | + List<Backend> bes = systemInfoService.getAllClusterBackendsNoException().values() |
| 1777 | + .stream().collect(Collectors.toList()); |
| 1778 | + if (Config.isNotCloudMode()) { |
| 1779 | + for (Backend be : bes) { |
| 1780 | + systemInfoService.dropBackend(be.getHost(), be.getHeartbeatPort()); |
| 1781 | + } |
| 1782 | + } else { |
| 1783 | + ((CloudSystemInfoService) systemInfoService).updateCloudBackends(Collections.emptyList(), bes); |
| 1784 | + } |
| 1785 | + } catch (Exception e) { |
| 1786 | + LOG.warn("failed to drop backends", e); |
| 1787 | + } |
| 1788 | + System.clearProperty(FeConstants.DROP_BACKENDS_KEY); |
| 1789 | + LOG.info("finished dropping all backends"); |
| 1790 | + } |
| 1791 | + |
1769 | 1792 | // for master, the 'isReady' is set behind. |
1770 | 1793 | // but we are sure that all metadata is replayed if we get here. |
1771 | 1794 | // so no need to check 'isReady' flag in this method |
|
0 commit comments