Solution

Solution for the use case.

Recovery Steps

You can read the file that is written after the upgrade.

If the file is not closed and the client dies during the upgrade. The file’s complete metadata is persisted when the lease expires for the file.

You can manually recover the lease. However, you need to handle the CORRUPT files using Step 1. After handling the recovery steps, you can continue with manual lease recovery.

  1. Identify the files open to write ## hdfs fsck / -openforwrite /dummy/appendfile: CORRUPT blockpool BP-1519352817-172.27.13.76-1692314082449 block blk_1073747034 /dummy/appendfile: CORRUPT 1 blocks of total size 3302 B./dummy/text1 490 bytes, replicated: replication=2, 1 block(s), OPENFORWRITE: /dummy/text2 0 bytes, replicated: replication=2, 1 block(s), OPENFORWRITE:.
  2. At this point, NameNode is in safemode. After handling the CORRUPT files using Step 1, you can force exit out of safe mode hdfs dfsadmin -safemode forceExit.
  3. Now, the NameNode is out of safemode. You can start recovering lease for the open files hdfs debug recoverLease -path <open_file_path>.