MyCATApache/Mycat-Server · error · RuntimeException

load crc32slot datafile error:dn=value=

Error message

load crc32slot datafile error:dn=value=${range}

What it means

convertRangeStringToList parses a dn=value range string from the crc32slot rule file. A value must be either 'start-end' or a single integer; any other token count is unsupported, so it throws this error including the offending range string. It protects the slot map from corrupt or hand-edited entries.

Solutions

  1. Open the crc32slot file and fix the offending dn value to a single integer or 'start-end' format.
  2. Regenerate the rule file rather than hand-editing, using MyCAT's rule-file tooling.
  3. Check for hidden characters/encoding corruption and rewrite the file in plain ASCII.
  4. Back up the file before edits and diff against a known-good copy from a matching environment.

Example fix

// before
dn1=0,10-20
// after
dn1=0-9
dn2=10-20
Defensive patterns

Strategy: validation

Validate before calling

// validate rule file entries before loading
for (String line : Files.readAllLines(ruleFile)) {
    if (!line.matches("dn\\d+=(\\d+|\\d+-\\d+)")) throw new IllegalStateException("bad range entry: " + line);
}

Prevention

When it happens

Trigger: Rule file entry contains a malformed dn value like '0,5-10', extra tokens, empty values, or non-numeric text that fails Integer.parseInt earlier and falls through with unexpected size.

Common situations: Manual editing of crc32slot files; corrupted file from a failed write or encoding issue; entries generated by an incompatible MyCAT version.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/27126177e96c88db. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/migrate/MigrateUtils.java:186

        }
        return Joiner.on(',').join(rangeStringList);
    }

    public static List<Range> convertRangeStringToList(String rangeStr) {
        List<String> ranges = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(rangeStr);
        List<Range> rangeList = new ArrayList<>();
        for (String range : ranges) {
            List<String> vv = Splitter.on("-").omitEmptyStrings().trimResults().splitToList(range);
            if (vv.size() == 2) {
                Range ran = new Range(Integer.parseInt(vv.get(0)), Integer.parseInt(vv.get(1)));
                rangeList.add(ran);

            } else if (vv.size() == 1) {
                Range ran = new Range(Integer.parseInt(vv.get(0)), Integer.parseInt(vv.get(0)));
                rangeList.add(ran);

            } else {
                throw new RuntimeException("load crc32slot datafile error:dn=value=" + range);
            }
        }
        return rangeList;
    }

    public static int getCurTotalSize(List<Range> rangeList) {
        int size = 0;
        for (Range range : rangeList) {
            size = size + range.size;
        }
        return size;
    }

    public static String getDatabaseFromDataNode(String dn) {
        return MycatServer.getInstance().getConfig().getDataNodes().get(dn).getDatabase();
    }

    public static String getDataHostFromDataNode(String dn) {

View on GitHub (pinned to 65f8d8beb7)