{"record":{"id":"ba4d01aa14f8a6e0","repo":"MyCATApache/Mycat-Server","slug":"grouppartionsize-must-0-but-cur-is-intgroupparti","errorCode":null,"errorMessage":"groupPartionSize must >0,but cur is {intGroupPartionSize}","messagePattern":"groupPartionSize must >0,but cur is (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/main/java/io/mycat/route/function/PartitionByRangeDateHash.java","lineNumber":60,"sourceCode":"    public void init()\n    {\n        try\n        {\n            SimpleDateFormat sdfInit = new SimpleDateFormat(dateFormat);\n            sdfInit.setTimeZone(UTC);\n            beginDate = sdfInit.parse(sBeginDate).getTime();\n            intGroupPartionSize = Integer.parseInt(groupPartionSize);\n            formatter = new ThreadLocal<SimpleDateFormat>() {\n                @Override\n                protected SimpleDateFormat initialValue() {\n                    SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);\n                    sdf.setTimeZone(UTC); \n                    return sdf;\n                }\n            };\n            if (intGroupPartionSize <= 0)\n            {\n                throw new RuntimeException(\"groupPartionSize must >0,but cur is \" + intGroupPartionSize);\n            }\n        } catch (ParseException e)\n        {\n            throw new IllegalArgumentException(e);\n        }\n        partionTime = Integer.parseInt(sPartionDay) * oneDay;\n    }\n\n    @Override\n    public Integer calculate(String columnValue)  {\n        try\n        {\n            long targetTime = formatter.get().parse(\n                    columnValue).getTime();\n            int targetPartition = (int) ((targetTime - beginDate) / partionTime);\n            int innerIndex =  Hashing.consistentHash(targetTime,intGroupPartionSize);\n            return targetPartition * intGroupPartionSize + innerIndex;\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/function/PartitionByRangeDateHash.java#L42-L78","documentation":"PartitionByRangeDateHash.init() validates that the groupPartionSize configuration property is a positive integer, since each time partition holds this many hash slots. If intGroupPartionSize <= 0 it throws this RuntimeException during rule initialization. A non-positive size would cause division/hash-slot math to break at routing time.","triggerScenarios":"Calling init() with <property name=\"groupPartionSize\">0</property>, a negative value, or a value that fails to parse meaningfully, when setting up the rule in schema.xml.","commonSituations":"Copy-paste of a rule template leaving groupPartionSize at 0; computing the value from another config field that evaluated to 0; misunderstanding the property as a day count and setting it to 0 intending 'no sub-partitions'.","solutions":["Set groupPartionSize to a positive integer in the rule configuration (e.g. 4 or 8) matching your datanode layout.","Ensure the total partition count (dateRangeSize * groupPartionSize) matches the number of configured datanodes/functional nodes.","Review how the property is injected if it is generated dynamically, and clamp/validate it before calling init().","Restart Mycat after correcting schema.xml so the rule re-initializes."],"exampleFix":"// before\n<property name=\"groupPartionSize\">0</property>\n// after\n<property name=\"groupPartionSize\">4</property>","handlingStrategy":"validation","validationCode":"int size = Integer.parseInt(props.getProperty(\"groupPartionSize\"));\nif (size <= 0) throw new IllegalArgumentException(\"groupPartionSize must be > 0\");","typeGuard":null,"tryCatchPattern":"try { rule.init(); } catch (RuntimeException e) { if (e.getMessage().contains(\"groupPartionSize must >0\")) { /* fix the property value */ } throw e; }","preventionTips":["Set groupPartionSize > 0 and ensure dateRangeSize * groupPartionSize equals the configured node count.","Validate all rule properties in a startup/config-lint step before Mycat boots.","Document required properties for PartitionByRangeHash in your config templates."],"tags":["sharding-config","validation","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}