001package org.apache.hadoop.hdfs.server.namenode; 002 003import javax.servlet.*; 004import javax.servlet.http.*; 005import javax.servlet.jsp.*; 006import org.apache.hadoop.util.ServletUtil; 007import org.apache.hadoop.fs.FileStatus; 008import org.apache.hadoop.fs.FileUtil; 009import org.apache.hadoop.fs.Path; 010import java.util.Collection; 011import java.util.Arrays; 012 013public final class corrupt_005ffiles_jsp extends org.apache.jasper.runtime.HttpJspBase 014 implements org.apache.jasper.runtime.JspSourceDependent { 015 016//for java.io.Serializable 017 private static final long serialVersionUID = 1L; 018 private static java.util.List _jspx_dependants; 019 020 public Object getDependants() { 021 return _jspx_dependants; 022 } 023 024 public void _jspService(HttpServletRequest request, HttpServletResponse response) 025 throws java.io.IOException, ServletException { 026 027 JspFactory _jspxFactory = null; 028 PageContext pageContext = null; 029 HttpSession session = null; 030 ServletContext application = null; 031 ServletConfig config = null; 032 JspWriter out = null; 033 Object page = this; 034 JspWriter _jspx_out = null; 035 PageContext _jspx_page_context = null; 036 037 038 try { 039 _jspxFactory = JspFactory.getDefaultFactory(); 040 response.setContentType("text/html; charset=UTF-8"); 041 pageContext = _jspxFactory.getPageContext(this, request, response, 042 null, true, 8192, true); 043 _jspx_page_context = pageContext; 044 application = pageContext.getServletContext(); 045 config = pageContext.getServletConfig(); 046 session = pageContext.getSession(); 047 out = pageContext.getOut(); 048 _jspx_out = out; 049 050 051 /* 052 * Licensed to the Apache Software Foundation (ASF) under one 053 * or more contributor license agreements. See the NOTICE file 054 * distributed with this work for additional information 055 * regarding copyright ownership. The ASF licenses this file 056 * to you under the Apache License, Version 2.0 (the 057 * "License"); you may not use this file except in compliance 058 * with the License. You may obtain a copy of the License at 059 * 060 * http://www.apache.org/licenses/LICENSE-2.0 061 * 062 * Unless required by applicable law or agreed to in writing, software 063 * distributed under the License is distributed on an "AS IS" BASIS, 064 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 065 * See the License for the specific language governing permissions and 066 * limitations under the License. 067 */ 068 069 070 NameNode nn = NameNodeHttpServer.getNameNodeFromContext(application); 071 FSNamesystem fsn = nn.getNamesystem(); 072 String namenodeRole = nn.getRole().toString(); 073 String namenodeLabel = nn.getNameNodeAddress().getHostName() + ":" 074 + nn.getNameNodeAddress().getPort(); 075 Collection<FSNamesystem.CorruptFileBlockInfo> corruptFileBlocks = 076 fsn.listCorruptFileBlocks("/", null); 077 int corruptFileCount = corruptFileBlocks.size(); 078 079 out.write("<!DOCTYPE html>\n<html>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/hadoop.css\">\n<title>Hadoop "); 080 out.print(namenodeRole); 081 out.write(" "); 082 out.print(namenodeLabel); 083 out.write("</title>\n<body>\n<h1>"); 084 out.print(namenodeRole); 085 out.write(' '); 086 out.write('\''); 087 out.print(namenodeLabel); 088 out.write("'</h1>\n"); 089 out.print(NamenodeJspHelper.getVersionTable(fsn)); 090 out.write("<br>\n<b><a href=\"/nn_browsedfscontent.jsp\">Browse the filesystem</a></b>\n<br>\n<b><a href=\"/logs/\">"); 091 out.print(namenodeRole); 092 out.write(" Logs</a></b>\n<br>\n<b><a href=/dfshealth.jsp> Go back to DFS home</a></b>\n<hr>\n<h3>Reported Corrupt Files</h3>\n"); 093 094 if (corruptFileCount == 0) { 095 096 out.write("<i>No missing blocks found at the moment.</i> <br>\n Please run fsck for a thorough health analysis.\n"); 097 098 } else { 099 for (FSNamesystem.CorruptFileBlockInfo c : corruptFileBlocks) { 100 String currentFileBlock = c.toString(); 101 102 out.print(currentFileBlock); 103 out.write("<br>\n"); 104 105 } 106 107 out.write("<p>\n <b>Total:</b> At least "); 108 out.print(corruptFileCount); 109 out.write(" corrupt file(s)\n </p>\n"); 110 111 } 112 113 114 out.println(ServletUtil.htmlFooter()); 115 116 } catch (Throwable t) { 117 if (!(t instanceof SkipPageException)){ 118 out = _jspx_out; 119 if (out != null && out.getBufferSize() != 0) 120 out.clearBuffer(); 121 if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); 122 } 123 } finally { 124 if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); 125 } 126 } 127}