protected boolean canSkipBadReplayedJournal(Throwable t) {
        if (Config.metadata_enable_recovery_mode) {
            LOG.warn("skip journal load failure because cluster is in recovery mode");
            return true;
        }

        try {
            for (String idStr : Config.metadata_journal_skip_bad_journal_ids.split(",")) {
                if (!StringUtils.isEmpty(idStr) && Long.parseLong(idStr) == replayedJournalId.get() + 1) {
                    LOG.warn("skip bad replayed journal id {} because configured {}",
                                idStr, Config.metadata_journal_skip_bad_journal_ids);
                    return true;
                }
            }
        } catch (Exception e) {
            LOG.warn("failed to parse metadata_journal_skip_bad_journal_ids: {}",
                        Config.metadata_journal_skip_bad_journal_ids, e);
        }

        short opCode = OperationType.OP_INVALID;
        if (t instanceof JournalException) {
            opCode = ((JournalException) t).getOpCode();
        }
        if (t instanceof JournalInconsistentException) {
            opCode = ((JournalInconsistentException) t).getOpCode();
        }

        if (opCode != OperationType.OP_INVALID
                    && OperationType.IGNORABLE_OPERATIONS.contains(opCode)) {
            if (Config.metadata_journal_ignore_replay_failure) {
                LOG.warn("skip ignorable journal load failure, opCode: {}", opCode);
                return true;
            } else {
                LOG.warn("the failure of opCode: {} is ignorable, " +
                            "you can set metadata_journal_ignore_replay_failure to true to ignore this failure", opCode);
                return false;
            }
        }
        return false;
    }
@Test
    public void testCanSkipBadReplayedJournal() {
        boolean originVal = Config.metadata_journal_ignore_replay_failure;
        Config.metadata_journal_ignore_replay_failure = false;

        // when recover_on_load_journal_failed is false, the failure of every operation type can not be skipped.
        Assert.assertFalse(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalException(OperationType.OP_ADD_ANALYZE_STATUS, "failed")));
        Assert.assertFalse(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalException(OperationType.OP_CREATE_DB_V2, "failed")));
        Assert.assertFalse(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalInconsistentException(OperationType.OP_ADD_ANALYZE_STATUS, "failed")));
        Assert.assertFalse(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalInconsistentException(OperationType.OP_CREATE_DB_V2, "failed")));

        Config.metadata_journal_ignore_replay_failure = true;
        // when recover_on_load_journal_failed is false, the failure of recoverable operation type can be skipped.
        Assert.assertTrue(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalException(OperationType.OP_ADD_ANALYZE_STATUS, "failed")));
        Assert.assertFalse(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalException(OperationType.OP_CREATE_DB_V2, "failed")));
        Assert.assertTrue(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalInconsistentException(OperationType.OP_ADD_ANALYZE_STATUS, "failed")));
        Assert.assertFalse(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalInconsistentException(OperationType.OP_CREATE_DB_V2, "failed")));

        Config.metadata_journal_ignore_replay_failure = originVal;

        // when metadata_enable_recovery_mode is true, all types of failure can be skipped.
        originVal = Config.metadata_enable_recovery_mode;
        Config.metadata_enable_recovery_mode = true;
        Assert.assertTrue(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalException(OperationType.OP_ADD_ANALYZE_STATUS, "failed")));
        Assert.assertTrue(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalException(OperationType.OP_CREATE_DB_V2, "failed")));
        Assert.assertTrue(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalInconsistentException(OperationType.OP_ADD_ANALYZE_STATUS, "failed")));
        Assert.assertTrue(GlobalStateMgr.getServingState().canSkipBadReplayedJournal(
                new JournalInconsistentException(OperationType.OP_CREATE_DB_V2, "failed")));
        Config.metadata_enable_recovery_mode = originVal;
    }