Tabnine Logo
FSEditLogLoader$EditLogValidation.hasCorruptHeader
Code IndexAdd Tabnine to your IDE (free)

How to use
hasCorruptHeader
method
in
org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader$EditLogValidation

Best Java code snippets using org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader$EditLogValidation.hasCorruptHeader (Showing top 8 results out of 315)

origin: ch.cern.hadoop/hadoop-hdfs

@Test
public void testValidateEditLogWithCorruptHeader() throws IOException {
 File testDir = new File(TEST_DIR, "testValidateEditLogWithCorruptHeader");
 SortedMap<Long, Long> offsetToTxId = Maps.newTreeMap();
 File logFile = prepareUnfinalizedTestEditLog(testDir, 2, offsetToTxId);
 RandomAccessFile rwf = new RandomAccessFile(logFile, "rw");
 try {
  rwf.seek(0);
  rwf.writeLong(42); // corrupt header
 } finally {
  rwf.close();
 }
 EditLogValidation validation = EditLogFileInputStream.validateEditLog(logFile);
 assertTrue(validation.hasCorruptHeader());
}
origin: ch.cern.hadoop/hadoop-hdfs

EditLogValidation validation =
  EditLogFileInputStream.validateEditLog(logFile);
assertTrue(!validation.hasCorruptHeader());
 assertEquals("Failed when corrupting txn opcode at " + txOffset,
   expectedEndTxId, validation.getEndTxId());
 assertTrue(!validation.hasCorruptHeader());
 assertEquals("Failed when corrupting txid " + txId + " txn opcode " +
  "at " + txOffset, expectedEndTxId, validation.getEndTxId());
 assertTrue(!validation.hasCorruptHeader());
origin: ch.cern.hadoop/hadoop-hdfs

@Test
public void testValidateEmptyEditLog() throws IOException {
 File testDir = new File(TEST_DIR, "testValidateEmptyEditLog");
 SortedMap<Long, Long> offsetToTxId = Maps.newTreeMap();
 File logFile = prepareUnfinalizedTestEditLog(testDir, 0, offsetToTxId);
 // Truncate the file so that there is nothing except the header and
 // layout flags section.
 truncateFile(logFile, 8);
 EditLogValidation validation =
   EditLogFileInputStream.validateEditLog(logFile);
 assertTrue(!validation.hasCorruptHeader());
 assertEquals(HdfsConstants.INVALID_TXID, validation.getEndTxId());
}
origin: io.prestosql.hadoop/hadoop-apache

public void scanLog() throws IOException {
 EditLogValidation val = EditLogFileInputStream.scanEditLog(file);
 this.lastTxId = val.getEndTxId();
 this.hasCorruptHeader = val.hasCorruptHeader();
}
origin: io.prestosql.hadoop/hadoop-apache

/** 
 * Find out where the edit log ends.
 * This will update the lastTxId of the EditLogFile or
 * mark it as corrupt if it is.
 */
public void validateLog() throws IOException {
 EditLogValidation val = EditLogFileInputStream.validateEditLog(file);
 this.lastTxId = val.getEndTxId();
 this.hasCorruptHeader = val.hasCorruptHeader();
}
origin: ch.cern.hadoop/hadoop-hdfs

public void scanLog() throws IOException {
 EditLogValidation val = EditLogFileInputStream.scanEditLog(file);
 this.lastTxId = val.getEndTxId();
 this.hasCorruptHeader = val.hasCorruptHeader();
}
origin: ch.cern.hadoop/hadoop-hdfs

/** 
 * Find out where the edit log ends.
 * This will update the lastTxId of the EditLogFile or
 * mark it as corrupt if it is.
 */
public void validateLog() throws IOException {
 EditLogValidation val = EditLogFileInputStream.validateEditLog(file);
 this.lastTxId = val.getEndTxId();
 this.hasCorruptHeader = val.hasCorruptHeader();
}
origin: org.apache.hadoop/hadoop-hdfs

/** 
 * Find out where the edit log ends.
 * This will update the lastTxId of the EditLogFile or
 * mark it as corrupt if it is.
 * @param maxTxIdToScan Maximum Tx ID to try to scan.
 *                      The scan returns after reading this or a higher ID.
 *                      The file portion beyond this ID is potentially being
 *                      updated.
 * @param verifyVersion Whether the scan should verify the layout version
 */
public void scanLog(long maxTxIdToScan, boolean verifyVersion)
  throws IOException {
 EditLogValidation val = EditLogFileInputStream.scanEditLog(file,
   maxTxIdToScan, verifyVersion);
 this.lastTxId = val.getEndTxId();
 this.hasCorruptHeader = val.hasCorruptHeader();
}
org.apache.hadoop.hdfs.server.namenodeFSEditLogLoader$EditLogValidationhasCorruptHeader

Popular methods of FSEditLogLoader$EditLogValidation

  • <init>
  • getEndTxId

Popular in Java

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Kernel (java.awt.image)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • ImageIO (javax.imageio)
  • JComboBox (javax.swing)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now