public void replayDropBackend(Backend backend) {
        LOG.debug("replayDropBackend: {}", backend);
        // update idToBackend
        idToBackendRef.remove(backend.getId());

        // update idToReportVersion
        Map<Long, AtomicLong> copiedReportVersions = Maps.newHashMap(idToReportVersionRef);
        copiedReportVersions.remove(backend.getId());
        idToReportVersionRef = ImmutableMap.copyOf(copiedReportVersions);

        // BackendCoreStat is a global state, checkpoint should not modify it.
        if (!GlobalStateMgr.isCheckpointThread()) {
            // remove from BackendCoreStat
            BackendResourceStat.getInstance().removeBe(backend.getId());
        }

        // clear map in starosAgent
        if (RunMode.isSharedDataMode()) {
            int starletPort = backend.getStarletPort();
            if (starletPort == 0) {
                return;
            }
            String workerAddr = NetUtils.getHostPortInAccessibleFormat(backend.getHost(), starletPort);
            GlobalStateMgr.getCurrentState().getStarOSAgent().removeWorkerFromMap(workerAddr);
        }
    }
@Test
    public void testReplayDropBackend() throws Exception {
        new MockUp<RunMode>() {
            @Mock
            public RunMode getCurrentRunMode() {
                return RunMode.SHARED_DATA;
            }
        };

        Backend be = new Backend(10001, "newHost", 1000);
        be.setStarletPort(1001);

        LocalMetastore localMetastore = new LocalMetastore(globalStateMgr, null, null);
        new Expectations() {
            {
                service.getBackendWithHeartbeatPort("newHost", 1000);
                minTimes = 0;
                result = be;

                globalStateMgr.getLocalMetastore();
                minTimes = 0;
                result = localMetastore;
            }
        };

        service.addBackend(be);
        service.replayDropBackend(be);
        Backend beIP = service.getBackendWithHeartbeatPort("newHost", 1000);
        Assert.assertTrue(beIP == null);
    }