private boolean recoveryTopicCtrlConfig(StringBuilder strBuff,
            ProcessResult result) {
        logger.info("[Recovery Topic Ctrl] begin ");
        Map<String, TopicCtrlEntity> storedTopicCtrlMap =
                (Map<String, TopicCtrlEntity>) readObjectFromFile(
                        backupAndRecoveryPath, storeFileNameTopicCtrl);
        if (storedTopicCtrlMap == null) {
            logger.error(strBuff.append("  read configure file ")
                    .append(backupAndRecoveryPath).append("/")
                    .append(storeFileNameTopicCtrl).append(" failure!").toString());
            strBuff.delete(0, strBuff.length());
            return false;
        }
        logger.info("[Recovery Topic Ctrl] upload topic-control configurations to master");
        if (!writeTopicCtrlInfo(storedTopicCtrlMap, strBuff, result)) {
            logger.error(strBuff.append("  write topic-control configurations failure!")
                    .append(result.getErrMsg()).toString());
            strBuff.delete(0, strBuff.length());
            return false;
        }
        logger.info("[Recovery Topic Ctrl] read restored topic-control configurations from master");
        Map<String, TopicCtrlEntity> topicCtrlMap = getTopicControlInfos(strBuff);
        if (topicCtrlMap == null) {
            logger.error("  download topic-control configurations are null!");
            return false;
        }
        logger.info("[Recovery Topic Ctrl] verify configurations");
        Set<String> srcTopicSet = new HashSet<>(storedTopicCtrlMap.keySet());
        Set<String> tgtTopicSet = new HashSet<>(topicCtrlMap.keySet());
        srcTopicSet.remove(TServerConstants.OFFSET_HISTORY_NAME);
        tgtTopicSet.remove(TServerConstants.OFFSET_HISTORY_NAME);
        if (srcTopicSet.size() != tgtTopicSet.size()) {
            logger.error("  verify failure, restored topic-control configurations size not equal!");
            return false;
        }
        for (Map.Entry<String, TopicCtrlEntity> qryEntry : storedTopicCtrlMap.entrySet()) {
            TopicCtrlEntity targetEntity = topicCtrlMap.get(qryEntry.getKey());
            if (targetEntity == null) {
                logger.error(strBuff
                        .append("  verify failure, stored topic-control value not equal!")
                        .append(" data in server is ").append(qryEntry.getValue().toString())
                        .append(", data stored is null").toString());
                strBuff.delete(0, strBuff.length());
                return false;
            }
            if ((targetEntity.getTopicName().equals(TServerConstants.OFFSET_HISTORY_NAME)
                    && (!targetEntity.isMatched(qryEntry.getValue(), false)))
                    || (!targetEntity.getTopicName().equals(TServerConstants.OFFSET_HISTORY_NAME)
                            && !targetEntity.isDataEquals(qryEntry.getValue()))) {
                logger.error(strBuff
                        .append("  verify failure, stored topic-control value not equal!")
                        .append(" data in server is ").append(qryEntry.getValue().toString())
                        .append(", data stored is ").append(targetEntity).toString());
                strBuff.delete(0, strBuff.length());
                return false;
            }
        }
        logger.info("[Recovery Topic Ctrl] end, success!");
        return true;
    }
Recovery topic control configurations

@param strBuff  the string buffer
@param result   the process result
@return         true for success, false for failure
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/tools/cli/CliMetaDataBRU.java