Thanks Andrew for reviewing! Patch 3 to address most comments, with some debate/explanation:
It's also debatable whether these should be flags at all, since UNIX normally uses positional args if they're required.
Good point. I'm keeping it for consistency with other debug commands: -meta for verifyMeta and -path for recoverLease are flagged. Please let me know if you feel strongly.
I'm guessing this is meant for use in emergency situations where the block only has corrupt replicas? I'm also wondering about the danger of divergent state on different DNs, since I don't think HDFS-level mechanisms like the BlockScanner or FBRs will catch this.
Exactly. So if there's no good replicas, but the HDFS file is critical, and the blockfile is not deleted on disk, there's a chance to restore the .meta file. One still need to search in the logs carefully to find genStamp, but it's theoretically doable.
I don't think BlockScanner would catch this and work, but I tried restarting DN locally (in a single DN env), and after FBR the block is readable again. It's not a 'divergent state' in this case, just DNs with corrupt replicas and good replicas, right?