forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: Yang, Tong <yangtong2@huawei.com> Co-committed-by: Yang, Tong <yangtong2@huawei.com>
31 lines
5.2 KiB
HTML
31 lines
5.2 KiB
HTML
<a name="mrs_01_1704"></a><a name="mrs_01_1704"></a>
|
|
|
|
<h1 class="topictitle1">Blocks Miss on the NameNode UI After the Successful Rollback</h1>
|
|
<div id="body1597735020147"><div class="section" id="mrs_01_1704__sa624e66f73de474f869226dbae19378f"><h4 class="sectiontitle">Question</h4><p id="mrs_01_1704__a9956a209f73044eaa9487f9ffd1dc0c7">Why are some blocks missing on the NameNode UI after the rollback is successful?</p>
|
|
</div>
|
|
<div class="section" id="mrs_01_1704__s8976d4be6ba945de8d6d74716f010a66"><h4 class="sectiontitle">Answer</h4><p id="mrs_01_1704__a2d14dfcbce3140e48b5d83e048b3c6c6">This problem occurs because blocks with new IDs or genstamps may exist on the DataNode. The block files in the DataNode may have different generation flags and lengths from those in the rollback images of the NameNode. Therefore, the NameNode rejects these blocks in the DataNode and marks the files as damaged.</p>
|
|
<p id="mrs_01_1704__afdc8b29bd84b4dc6ae1daea95496477f"><strong id="mrs_01_1704__b562319015316">Scenarios:</strong></p>
|
|
<ol id="mrs_01_1704__o4392d4429b874535bf623f51a51b0911"><li id="mrs_01_1704__l2deaf26633c9415883811c46b72d7792">Before an upgrade:<p id="mrs_01_1704__a9a6d5e2590a146b58d3c41110a39390c"><a name="mrs_01_1704__l2deaf26633c9415883811c46b72d7792"></a><a name="l2deaf26633c9415883811c46b72d7792"></a>Client A writes some data to file X. (Assume A bytes are written.)</p>
|
|
</li></ol><ol start="2" id="mrs_01_1704__oc079ae8bbdde4adca0312011cba828b7"><li id="mrs_01_1704__lc9f7a83f598747dca2456d054a7f68b5">During an upgrade:<p id="mrs_01_1704__aff719d138deb433fa4a995376302ca6a"><a name="mrs_01_1704__lc9f7a83f598747dca2456d054a7f68b5"></a><a name="lc9f7a83f598747dca2456d054a7f68b5"></a>Client A still writes data to file X. (The data in the file is A + B bytes.)</p>
|
|
</li></ol><ol start="3" id="mrs_01_1704__o7d5cd5776fcf4f4a92f794ef674c1029"><li id="mrs_01_1704__lff834b100a98408bad23142949f992ff">After an upgrade:<p id="mrs_01_1704__a1987ec7ce8d149e49c4147c3d04c9f7e"><a name="mrs_01_1704__lff834b100a98408bad23142949f992ff"></a><a name="lff834b100a98408bad23142949f992ff"></a>Client A completes the file writing. The final data is A + B bytes.</p>
|
|
</li></ol><ol start="4" id="mrs_01_1704__of4add85937e74115a46aac2849883140"><li id="mrs_01_1704__l4ce5b56baaf64fe3b6f485ed1cf14e72">Rollback started:<p id="mrs_01_1704__a5ea3dd034dd842e59aa4c0cc0f11421c"><a name="mrs_01_1704__l4ce5b56baaf64fe3b6f485ed1cf14e72"></a><a name="l4ce5b56baaf64fe3b6f485ed1cf14e72"></a>The status will be rolled back to the status before the upgrade. That is, file X in NameNode will have A bytes, but block files in DataNode will have A + B bytes.</p>
|
|
</li></ol>
|
|
<p id="mrs_01_1704__aa9c8f7e180ab421180624a665c55e141"><strong id="mrs_01_1704__aee0844791a934a74b75b6506971890a6">Recovery procedure:</strong></p>
|
|
<ol id="mrs_01_1704__o718ba4c5f8184090a47a6aab8c24682b"><li id="mrs_01_1704__l8ee786da2dd345d1bd602529217f40f1">Obtain the list of damaged files from NameNode web UI or run the following command to obtain:<p id="mrs_01_1704__p0255175415518"><a name="mrs_01_1704__l8ee786da2dd345d1bd602529217f40f1"></a><a name="l8ee786da2dd345d1bd602529217f40f1"></a><strong id="mrs_01_1704__b735115575520">hdfs fsck <filepath> -list-corruptfileblocks</strong></p>
|
|
</li><li id="mrs_01_1704__l3adfa646298f4131ad6b251b42798546">Run the following command to delete unnecessary files:<p id="mrs_01_1704__p1850153766"><a name="mrs_01_1704__l3adfa646298f4131ad6b251b42798546"></a><a name="l3adfa646298f4131ad6b251b42798546"></a><strong id="mrs_01_1704__b1733112614611">hdfs fsck <corrupt file path> - delete</strong></p>
|
|
<div class="note" id="mrs_01_1704__note1891712119618"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="mrs_01_1704__p1538042863618">Deleting a file is a high-risk operation. Ensure that the files are no longer needed before performing this operation.</p>
|
|
</div></div>
|
|
</li><li id="mrs_01_1704__l488bee33a18b4ab19f8c82717da88edb">For the required files, run the <strong id="mrs_01_1704__b8528062828811">fsck</strong> command to obtain the block list and block sequence.<ul id="mrs_01_1704__u37d15e6b4281455da873345b24a95f1f"><li id="mrs_01_1704__l5d9fd8a7b53d4c168858d4702a6cb34b">In the block sequence table provided, use the block ID to search for the data directory in the DataNode and download the corresponding block from the DataNode.</li><li id="mrs_01_1704__l15fb7765a4bc410d8db1ce1167db6b92">Write all such block files in appending mode based on the sequence to construct the original file.<p id="mrs_01_1704__a0753fc852ea948a6a6057a4bfe6cb681"><a name="mrs_01_1704__l15fb7765a4bc410d8db1ce1167db6b92"></a><a name="l15fb7765a4bc410d8db1ce1167db6b92"></a>Example:</p>
|
|
<p id="mrs_01_1704__a7db8708add084ff89333c53bf391272b">File 1--> blk_1, blk_2, blk_3</p>
|
|
<p id="mrs_01_1704__ad8ecbeaa679e417ab4dc8942adb39aa6">Create a file by combining the contents of all three block files from the same sequence.</p>
|
|
</li><li id="mrs_01_1704__ldf2cf603a313432c8330e4406f9ce1fb">Delete the old file from HDFS and rewrite the new file.</li></ul>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_01_1690.html">FAQ</a></div>
|
|
</div>
|
|
</div>
|
|
|