MyCATApache/Mycat-Server · error · RuntimeException
load crc32slot datafile error:dn=
Error message
load crc32slot datafile error:dn={k},value={range} What it means
PartitionByCRC32PreSlot.convertToMap parses the crc32slot data file where each node's 'value' string lists slot ranges. A node entry with more than one element in its parsed range list (vv.size() > 1) is unexpected for this format, so a RuntimeException 'load crc32slot datafile error:dn=...,value=...' is thrown, failing rule init/reinit.
Solutions
- Inspect the data file line for the offending dn and fix it to the expected format: each value either 'start-end' or a single integer.
- Regenerate the slot data file with the mycat migration tooling (re-run the expansion/migration analysis) instead of hand-editing.
- Restore the file from a backup taken before the migration started.
- Ensure the mycat version reading the file matches the version that wrote it; upgrade both consistently and re-init.
Example fix
// before (datafile line) 0=1-100,200-300 // after 0=1-100
Defensive patterns
Strategy: validation
Validate before calling
for (String line : Files.readAllLines(dataFile)) {
String value = line.substring(line.indexOf('=') + 1);
boolean ok = value.matches("\\d+(-\\d+)?");
if (!ok) throw new IllegalStateException("malformed slot line: " + line);
} Try / catch
try {
rule.init(cfg);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("load crc32slot datafile error")) {
LOGGER.error("regenerate or restore crc32slot datafile");
} else { throw e; }
} Prevention
- Never hand-edit crc32slot data files; regenerate with the migration tool
- Back up data files before expansions/migrations
- Keep mycat and migration tooling versions aligned
When it happens
Trigger: init/reInit -> convertToMap reads the slot mapping file (rule data file, e.g. rule.xml partition-by-crc32pre-slot data file) and a dn line contains multiple range tokens instead of a single start-end pair or single value.
Common situations: Data file manually edited or corrupted; file produced by a different mycat/migration tool version with a divergent format; partial write during migration crash leaving malformed lines; mixing formats from reInit with stale content.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- crc32slot_ .properties does not match schema table dataNode.
- load crc32slot datafile error:dn=value=
- ${e}
- ${e}
- ${e}
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/04c723999ff60e21.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/route/function/PartitionByCRC32PreSlot.java:140
private Map<Integer, List<Range>> convertToMap(Properties p) {
Map<Integer, List<Range>> map = new TreeMap<>();
for (Object o : p.keySet()) {
String k = (String) o;
String v = p.getProperty(k);
List<String> ranges = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(v);
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=" + k + ",value=" + range);
}
}
map.put(Integer.parseInt(k), rangeList);
}
return map;
}
@Override
public void init() {
super.init();
if (ruleName != null) {
Properties p = loadProps(ruleName, false);
rangeMap = convertToMap(p);
checkSize();
hack();
}View on GitHub (pinned to 65f8d8beb7)