Hi Andrew Wang] I did some investigation. It seems EC policy ID is not widely used. For examples,
1. For directory, EC policy is saved as XAttr using policy name(policy name doesn't include policy ID). When directory is saved to FsImage, all its XAttrs are saved including EC policy name.
2. For file, EC policy ID is saved in head. When file is saved to FsImage, EC policy ID is saved in replication field.
3. The setErasureCodingPolicy API, user will provide a ErasureCodingPolicy parameter, currently only the schema and cell size is used to check if it's a legitimate EC policy, policy ID is not involved in parameter checking. Because currently setErasureCodingPolicy can only applies to directory. And only policy name is saved on directory. I will enforce the policy ID check in
HDFS-10996 implementation which specify per-file policy when create file.
4. File read/write. Double checked DFSStripedInputStream and DFSStripedOutputStream, policy ID is not used at all. The schema and cellsize are used.
So, later I plan to upload a new patch, adding Precondition checks on FsImage file loading only. Because other spaces use policy name, schema and cell size.