{"record":{"id":"3da91ac18a29b57c","repo":"apache/shardingsphere","slug":"inventory-dump-failed-on-s","errorCode":null,"errorMessage":"Inventory dump failed on %s","messagePattern":"Inventory dump failed on (.+?)","errorType":"exception","errorClass":"IngestException","httpStatus":null,"severity":"error","filePath":"kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/InventoryDumper.java","lineNumber":114,"sourceCode":"    \n    @Override\n    protected void runBlocking() {\n        IngestPosition position = dumperContext.getCommonContext().getPosition();\n        if (position instanceof IngestFinishedPosition) {\n            log.info(\"Ignored because of already finished.\");\n            return;\n        }\n        try {\n            if (dumperContext.hasUniqueKey()) {\n                dumpByCalculator();\n            } else {\n                dumpWithStreamingQuery();\n            }\n            // CHECKSTYLE:OFF\n        } catch (final SQLException | RuntimeException ex) {\n            // CHECKSTYLE:ON\n            log.error(\"Inventory dump failed on {}\", dumperContext.getActualTableName(), ex);\n            throw new IngestException(\"Inventory dump failed on \" + dumperContext.getActualTableName(), ex);\n        }\n    }\n    \n    private void dumpByCalculator() {\n        String schemaName = dumperContext.getCommonContext().getTableAndSchemaNameMapper().getSchemaName(dumperContext.getLogicTableName());\n        QualifiedTable table = new QualifiedTable(schemaName, dumperContext.getActualTableName());\n        IngestPosition initialPosition = dumperContext.getCommonContext().getPosition();\n        log.info(\"Dump by calculator start, dataSource={}, table={}, initialPosition={}\", dumperContext.getCommonContext().getDataSourceName(), table, initialPosition);\n        List<String> columnNames = dumperContext.getQueryColumnNames();\n        TableInventoryCalculateParameter calculateParam = new TableInventoryCalculateParameter(dataSource, table,\n                columnNames, dumperContext.getUniqueKeyColumns(), QueryType.RANGE_QUERY, null);\n        Range<?> range = Range.closed(((UniqueKeyIngestPosition<?>) initialPosition).getLowerBound(), ((UniqueKeyIngestPosition<?>) initialPosition).getUpperBound());\n        calculateParam.setRange(range);\n        RecordTableInventoryDumpCalculator dumpCalculator = new RecordTableInventoryDumpCalculator(dumperContext.getBatchSize());\n        long rowCount = 0L;\n        try {\n            JobRateLimitAlgorithm rateLimitAlgorithm = dumperContext.getRateLimitAlgorithm();\n            String firstUniqueKey = calculateParam.getFirstUniqueKey().getName();","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/inventory/InventoryDumper.java#L96-L132","documentation":"InventoryDumper.dump wraps any SQLException or RuntimeException from the full-dump phase (calculator-based or streaming) of a pipeline job in IngestException('Inventory dump failed on <table>'). The root cause is always in the attached exception/log — connectivity loss, privilege errors, SQL dialect problems, or invalid unique-key assumptions during the initial table snapshot.","triggerScenarios":"Running the inventory (full) dump stage of a migration job where the SELECT over the actual table (range query by unique key or streaming query) throws: connection reset, lock timeout, column-type mapping failure, missing table, or a unique-key column that cannot be range-queried.","commonSituations":"Source database restarts or network blips mid-snapshot; insufficient SELECT/REPLICATION privileges on the source; very wide chunk queries timing out; table dropped or renamed while the job ran; a unique key on a type the dialect cannot order consistently.","solutions":["Inspect the logged cause (log.error prints the exception) and proxy logs to identify whether it is connectivity, privileges, timeout, or SQL/dialect failure.","Fix the source-side issue: grant privileges, stabilize connectivity, or tune chunk-size / unique-key selection, then restart or resume the pipeline job.","For timeout-class causes, reduce chunk-size and ensure the unique key is indexed.","If the table was modified during the dump, re-run inventory for that table after the schema stabilizes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight before starting a migration job\ntry (Connection c = sourceDataSource.getConnection();\n     Statement s = c.createStatement();\n     ResultSet rs = s.executeQuery(\"SELECT 1 FROM `\" + tableName + \"` LIMIT 1\")) {\n    // table readable -> inventory dump preconditions hold\n}","typeGuard":null,"tryCatchPattern":"try {\n    dumper.dump();\n} catch (final IngestException ex) {\n    Throwable cause = ex.getCause();\n    // classify: SQLException -> connectivity/privilege/timeout; rethrow for job retry\n}","preventionTips":["Verify pipeline-user privileges (SELECT on all source tables) before starting the job.","Pre-check unique-key presence and index coverage for range-chunked dumps.","Tune chunk-size down when source queries time out; monitor proxy logs during snapshot."],"tags":["pipeline","inventory-dump","migration","wrapping-exception"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}