{"record":{"id":"2e35ab60931cdaa5","repo":"apache/hadoop","slug":"database-error-during-recovery","errorCode":null,"errorMessage":"Database error during recovery","messagePattern":"Database error during recovery","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java","lineNumber":496,"sourceCode":"  private void recoverState(Configuration conf) throws IOException {\n    Path recoveryRoot = getRecoveryPath();\n    if (recoveryRoot != null) {\n      startStore(recoveryRoot);\n      Pattern jobPattern = Pattern.compile(JobID.JOBID_REGEX);\n      LeveldbIterator iter = null;\n      try {\n        iter = new LeveldbIterator(stateDb);\n        iter.seek(bytes(JobID.JOB));\n        while (iter.hasNext()) {\n          Map.Entry<byte[],byte[]> entry = iter.next();\n          String key = asString(entry.getKey());\n          if (!jobPattern.matcher(key).matches()) {\n            break;\n          }\n          recoverJobShuffleInfo(key, entry.getValue());\n        }\n      } catch (DBException e) {\n        throw new IOException(\"Database error during recovery\", e);\n      } finally {\n        if (iter != null) {\n          iter.close();\n        }\n      }\n    }\n  }\n\n  private void startStore(Path recoveryRoot) throws IOException {\n    Options options = new Options();\n    options.createIfMissing(false);\n    Path dbPath = new Path(recoveryRoot, STATE_DB_NAME);\n    LOG.info(\"Using state database at \" + dbPath + \" for recovery\");\n    File dbfile = new File(dbPath.toString());\n    try {\n      stateDb = JniDBFactory.factory.open(dbfile, options);\n    } catch (NativeDB.DBException e) {\n      if (e.isNotFound() || e.getMessage().contains(\" does not exist \")) {","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-shuffle/src/main/java/org/apache/hadoop/mapred/ShuffleHandler.java#L478-L514","documentation":"Error \"Database error during recovery\" thrown in apache/hadoop.","triggerScenarios":"Thrown by ShuffleHandler during recovery when the LevelDB state store cannot be read. The leveldb recovery store is corrupt or inaccessible; clear nmRecoveryDir or fix permissions and restart the NodeManager/auxiliary shuffle service.","commonSituations":"See trigger scenarios.","solutions":["Check the shuffle state-store LevelDB directory for corruption; remove the corrupted DB and let recovery rebuild it, or restore from a healthy NodeManager.","Verify disk health and permissions on yarn.nodemanager.recovery.dir."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}