{"record":{"id":"41d019ba41875250","repo":"apache/hadoop","slug":"invalid-configuration-a-shared-edits-dir-must-not","errorCode":null,"errorMessage":"Invalid configuration: a shared edits dir must not be specified if HA is not enabled.","messagePattern":"Invalid configuration: a shared edits dir must not be specified if HA is not enabled\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java","lineNumber":937,"sourceCode":"\n      LOG.info(\"fsOwner                = \" + fsOwner);\n      LOG.info(\"supergroup             = \" + supergroup);\n      LOG.info(\"isPermissionEnabled    = \" + isPermissionEnabled);\n      LOG.info(\"isStoragePolicyEnabled = \" + isStoragePolicyEnabled);\n\n      // block allocation has to be persisted in HA using a shared edits directory\n      // so that the standby has up-to-date namespace information\n      nameserviceId = DFSUtil.getNamenodeNameServiceId(conf);\n      this.haEnabled = HAUtil.isHAEnabled(conf, nameserviceId);  \n      \n      // Sanity check the HA-related config.\n      if (nameserviceId != null) {\n        LOG.info(\"Determined nameservice ID: \" + nameserviceId);\n      }\n      LOG.info(\"HA Enabled: \" + haEnabled);\n      if (!haEnabled && HAUtil.usesSharedEditsDir(conf)) {\n        LOG.warn(\"Configured NNs:\\n\" + DFSUtil.nnAddressesAsString(conf));\n        throw new IOException(\"Invalid configuration: a shared edits dir \" +\n            \"must not be specified if HA is not enabled.\");\n      }\n\n      // block manager needs the haEnabled initialized\n      this.blockManager = new BlockManager(this, haEnabled, conf);\n      this.datanodeStatistics = blockManager.getDatanodeManager().getDatanodeStatistics();\n\n      // Get the checksum type from config\n      String checksumTypeStr = conf.get(DFS_CHECKSUM_TYPE_KEY,\n          DFS_CHECKSUM_TYPE_DEFAULT);\n      this.isSnapshotTrashRootEnabled = conf.getBoolean(\n          DFS_NAMENODE_SNAPSHOT_TRASHROOT_ENABLED,\n          DFS_NAMENODE_SNAPSHOT_TRASHROOT_ENABLED_DEFAULT);\n      DataChecksum.Type checksumType;\n      try {\n         checksumType = DataChecksum.Type.valueOf(checksumTypeStr);\n      } catch (IllegalArgumentException iae) {\n         throw new IOException(\"Invalid checksum type in \"","sourceCodeStart":919,"sourceCodeEnd":955,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L919-L955","documentation":"FSNamesystem's HA sanity check: a shared edits directory (dfs.namenode.shared.edits.dir, the journal an active NN shares with its standby) only makes sense when HA is enabled for the nameservice. If HA is off and the property is set, configuration is rejected at startup. HA being 'enabled' is derived from dfs.nameservices plus dfs.ha.namenodes.<nameservice> entries; missing those while keeping the shared dir trips this check.","triggerScenarios":"Starting a NameNode with dfs.namenode.shared.edits.dir configured but HAUtil.isHAEnabled(...) false: HA config removed or incomplete (missing dfs.nameservices / dfs.ha.namenodes.<ns>), or an HA nameservice converted back to single-node while the shared dir property survived.","commonSituations":"Leftover shared-edits config after dismantling HA; HA migration done halfway (shared journal set before the HA nameservice config); running bootstrapStandby-style tooling against a non-HA cluster.","solutions":["If staying non-HA: remove/comment dfs.namenode.shared.edits.dir from hdfs-site.xml and restart","If HA is intended: complete the config — dfs.nameservices, dfs.ha.namenodes.<nameservice>, and per-NN rpc addresses","Read the log lines just above the throw ('Determined nameservice ID', 'HA Enabled: false') to see how the NN classified the config","Follow the documented HA migration steps rather than hand-merging configs"],"exampleFix":"<!-- before: shared edits dir set but HA not enabled -->\n<property><name>dfs.namenode.shared.edits.dir</name><value>qjournal://nn1:8485;nn2:8485/ns1</value></property>\n<!-- after (non-HA): drop the property entirely -->\n<!-- after (HA): also add -->\n<property><name>dfs.nameservices</name><value>ns1</value></property>\n<property><name>dfs.ha.namenodes.ns1</name><value>nn1,nn2</value></property>","handlingStrategy":"validation","validationCode":"String nsId = DFSUtil.getNamenodeNameServiceId(conf);\nif (HAUtil.usesSharedEditsDir(conf)\n    && !HAUtil.isHAEnabled(conf, nsId)) {\n  throw new IllegalArgumentException(\n      \"dfs.namenode.shared.edits.dir set but HA is not enabled for \" + nsId);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat shared-edits config and HA nameservice config as one unit — add or remove them together","After any HA change, run 'hdfs getconf -confKey dfs.ha.namenodes.<ns>' as a smoke test","Use config management (templated roles) so a non-HA node cannot inherit HA journals config"],"tags":["hadoop","hdfs","namenode","configuration","high-availability","shared-edits"],"backgroundTag":"config-validation-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}