{"record":{"id":"7566f5d133fd8056","repo":"apache/hadoop","slug":"specified-block-size-is-less-than-the-cell-si","errorCode":null,"errorMessage":"Specified block size ({}) is less than the cell size ({}) of the erasure coding policy ({}).","messagePattern":"Specified block size \\((.+?)\\) is less than the cell size \\((.+?)\\) of the erasure coding policy \\((.+?)\\)\\.","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java","lineNumber":2846,"sourceCode":"\n      iip = FSDirWriteFileOp.resolvePathForStartFile(\n          dir, pc, src, flag, createParent);\n\n      if (blockSize < minBlockSize) {\n        throw new IOException(\"Specified block size \" + blockSize +\n            \" is less than configured minimum value \" +\n            DFSConfigKeys.DFS_NAMENODE_MIN_BLOCK_SIZE_KEY + \"=\" + minBlockSize);\n      }\n\n      if (shouldReplicate) {\n        blockManager.verifyReplication(src, replication, clientMachine);\n      } else {\n        final ErasureCodingPolicy ecPolicy = FSDirErasureCodingOp\n            .getErasureCodingPolicy(this, ecPolicyName, iip);\n        if (ecPolicy != null && (!ecPolicy.isReplicationPolicy())) {\n          checkErasureCodingSupported(\"createWithEC\");\n          if (blockSize < ecPolicy.getCellSize()) {\n            throw new IOException(\"Specified block size (\" + blockSize\n                + \") is less than the cell size (\" + ecPolicy.getCellSize()\n                +\") of the erasure coding policy (\" + ecPolicy + \").\");\n          }\n        } else {\n          blockManager.verifyReplication(src, replication, clientMachine);\n        }\n      }\n\n      FileEncryptionInfo feInfo = null;\n      if (!iip.isRaw() && provider != null) {\n        EncryptionKeyInfo ezInfo = FSDirEncryptionZoneOp.getEncryptionKeyInfo(\n            this, iip, supportedVersions);\n        // if the path has an encryption zone, the lock was released while\n        // generating the EDEK.  re-resolve the path to ensure the namesystem\n        // and/or EZ has not mutated\n        if (ezInfo != null) {\n          checkOperation(OperationCategory.WRITE);\n          iip = FSDirWriteFileOp.resolvePathForStartFile(","sourceCodeStart":2828,"sourceCodeEnd":2864,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2828-L2864","documentation":"For erasure-coded files each write unit must cover at least one full cell so all data and parity shards receive payload. When the effective EC policy is not a replication policy, startFile rejects blockSize < ecPolicy.getCellSize() with IOException naming the block size, the cell size, and the policy (e.g., 1MB cells for RS-6-3-1024k).","triggerScenarios":"Creating a file that resolves to an EC policy (via ecPolicyName or the parent directory's policy) while passing a blockSize smaller than that policy's cell size — e.g., 512KB blocks under the default RS-6-3-1024k policy.","commonSituations":"Apps tuned for replicated HDFS (small blocks for small files) start writing into EC-enabled directories after tiering changes; the cluster's default EC policy was switched to a larger cell (e.g., 4MB); migration code carries over legacy block sizes.","solutions":["Use blockSize >= cell size of the effective EC policy (1MB for RS-6-3-1024k; legal cells 64KB-4MB)","If small blocks are a hard requirement, write the file replicated instead: non-EC directory or CreateFlag.SHOULD_REPLICATE"],"exampleFix":"// before: EC directory + small blocks\nfs.create(new Path(\"/ec/out\"), true, 4096, (short) 3, 512L * 1024);\n// after\nDistributedFileSystem dfs = (DistributedFileSystem) fs;\nErasureCodingPolicy ec = dfs.getErasureCodingPolicy(new Path(\"/ec\"));\nlong cell = (ec != null && !ec.isReplicationPolicy()) ? ec.getCellSize() : 0L;\nfs.create(new Path(\"/ec/out\"), true, 4096, (short) 3, Math.max(512L * 1024, cell));","handlingStrategy":"validation","validationCode":"DistributedFileSystem dfs = (DistributedFileSystem) fs;\nErasureCodingPolicy p = dfs.getErasureCodingPolicy(path.getParent());\nif (p != null && !p.isReplicationPolicy()) {\n  long cell = p.getCellSize();\n  if (blockSize < cell) blockSize = cell;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the target directory's EC policy before choosing blockSize","Standardize on >= 1MB blocks for any path that may live under erasure coding"],"tags":["hdfs","erasure-coding","cell-size","block-size","file-create"],"backgroundTag":"block-size-below-minimum","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}