{"record":{"id":"701135003e52b382","repo":"pinpoint-apm/pinpoint","slug":"unexpected-schema-change-log-execution-order-for","errorCode":null,"errorMessage":"Unexpected schema change log execution order for ","messagePattern":"Unexpected schema change log execution order for ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hbase/hbase-schema/src/main/java/com/navercorp/pinpoint/hbase/schema/core/ChangeSetManager.java","lineNumber":111,"sourceCode":"        sortedSchemaChangeLogs.sort(Comparator.comparingInt(SchemaChangeLog::getExecOrder));\n        return sortedSchemaChangeLogs;\n    }\n\n    private void verifyChangeLog(SchemaChangeLog schemaChangeLog, ChangeSet changeSet, int expectedOrder) {\n        String changeSetId = changeSet.getId();\n        String schemaChangeLogId = schemaChangeLog.getId();\n        if (!changeSetId.equals(schemaChangeLogId)) {\n            throw new IllegalArgumentException(\"Unexpected schema change log id, expected : \" + changeSetId + \" , was : \" + schemaChangeLogId);\n        }\n\n        CheckSum actualCheckSum = schemaChangeLog.getCheckSum();\n        CheckSum expectedCheckSum = CheckSum.compute(actualCheckSum.getVersion(), changeSet.getValue());\n        if (!expectedCheckSum.equals(actualCheckSum)) {\n            throw new IllegalArgumentException(\"Unexpected schema change log check sum for : \" + schemaChangeLogId);\n        }\n        int actualOrder = schemaChangeLog.getExecOrder();\n        if (expectedOrder != actualOrder) {\n            throw new IllegalArgumentException(\"Unexpected schema change log execution order for \" + schemaChangeLogId + \", expected : \" + expectedOrder + \", was : \" + actualOrder);\n        }\n    }\n}\n","sourceCodeStart":93,"sourceCodeEnd":115,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/hbase/hbase-schema/src/main/java/com/navercorp/pinpoint/hbase/schema/core/ChangeSetManager.java#L93-L115","documentation":"ChangeSetManager.verifyChangeLog compares the change log's recorded execution order with the expected order of the ChangeSet in the current list. A mismatch throws IllegalArgumentException, meaning the ordering of change sets in code no longer matches the order in which they were applied to HBase.","triggerScenarios":"Calling getExecutedChangeSets or filterExecutedChangeSets when the position of a ChangeSet in the change set list changed (inserted, removed, reordered) relative to the execOrder stored in the change log table.","commonSituations":"Inserting a new change set in the middle of the list instead of appending at the end; deleting an old change set class so subsequent change sets shift position.","solutions":["Reorder the change set list so each ChangeSet keeps the execOrder recorded in the change log table.","Append new change sets at the end of the list; never insert or remove earlier ones.","If removal is required, update the stored change log execution orders to match the new sequence."],"exampleFix":"// before\nchangeSets.add(0, newChangeSet); // inserted in the middle\n// after\nchangeSets.add(newChangeSet); // appended after existing change sets","handlingStrategy":"validation","validationCode":"// Assert list order matches stored exec orders before applying\nfor (int i = 0; i < changeSets.size(); i++) {\n    SchemaChangeLog log = logsById.get(changeSets.get(i).getId());\n    if (log != null && log.getExecOrder() != i) {\n        throw new IllegalStateException(changeSets.get(i).getId() + \" order drifted: expected \" + i + \" was \" + log.getExecOrder());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.getExecutedChangeSets(changeSets);\n} catch (IllegalArgumentException e) {\n    logger.error(\"Execution order verification failed: {}\", e.getMessage());\n}","preventionTips":["Append new change sets only at the end of the list.","Never delete or reorder previously applied change sets.","Review merge conflicts in change set lists for accidental reordering."],"tags":["hbase","schema-migration","ordering"],"backgroundTag":"schema-validation-failed","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}