Examples of EditLogValidation


Examples of com.alimama.mdrill.editlog.read.FSEditLogValidate.EditLogValidation

    boolean containsTxId(long txId) {
      return firstTxId <= txId && txId <= lastTxId;
    }

    public void validateLog() throws IOException {
      EditLogValidation val = EditLogFileInputStream.validateEditLog(fs,file);
      this.lastTxId = val.getEndTxId();
      this.hasCorruptHeader = val.hasCorruptHeader();
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

        if (lastTxId == HdfsConstants.INVALID_TXID || txid > lastTxId) {
          lastTxId = txid;
        }
        numValid++;
      }
      return new EditLogValidation(lastPos, lastTxId, false);
    } finally {
      IOUtils.closeStream(in);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

     * Find out where the edit log ends.
     * This will update the lastTxId of the EditLogFile or
     * mark it as corrupt if it is.
     */
    void validateLog() throws IOException {
      EditLogValidation val = EditLogFileInputStream.validateEditLog(file);
      this.lastTxId = val.getEndTxId();
      this.hasCorruptHeader = val.hasCorruptHeader();
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

     * 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();
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

      this.lastTxId = val.getEndTxId();
      this.hasCorruptHeader = val.hasCorruptHeader();
    }

    public void scanLog() throws IOException {
      EditLogValidation val = EditLogFileInputStream.scanEditLog(file);
      this.lastTxId = val.getEndTxId();
      this.hasCorruptHeader = val.hasCorruptHeader();
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

    final long START_TXID = 1;
    StorageDirectory sd = cluster.getNameNode().getFSImage()
      .getStorage().getStorageDir(0);
    File editLog = NNStorage.getInProgressEditsFile(sd, START_TXID);

    EditLogValidation validation = EditLogFileInputStream.validateEditLog(editLog);
    assertEquals("Edit log should contain a header as valid length",
        HEADER_LEN, validation.getValidLength());
    assertEquals(validation.getEndTxId(), START_TXID);
    assertEquals("Edit log should have 1MB pre-allocated, plus 4 bytes " +
        "for the version number",
        EditLogFileOutputStream.PREALLOCATION_LENGTH + 4, editLog.length());
   

    cluster.getFileSystem().mkdirs(new Path("/tmp"),
        new FsPermission((short)777));

    long oldLength = validation.getValidLength();
    validation = EditLogFileInputStream.validateEditLog(editLog);
    assertTrue("Edit log should have more valid data after writing a txn " +
        "(was: " + oldLength + " now: " + validation.getValidLength() + ")",
        validation.getValidLength() > oldLength);
    assertEquals(1, validation.getEndTxId() - START_TXID);

    assertEquals("Edit log should be 1MB long, plus 4 bytes for the version number",
        EditLogFileOutputStream.PREALLOCATION_LENGTH + 4, editLog.length());
    // 256 blocks for the 1MB of preallocation space
    assertTrue("Edit log disk space used should be at least 257 blocks",
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

      rwf.seek(0);
      rwf.writeLong(42); // corrupt header
    } finally {
      rwf.close();
    }
    EditLogValidation validation = EditLogFileInputStream.validateEditLog(logFile);
    assertTrue(validation.hasCorruptHeader());
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

    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
    truncateFile(logFile, 4);
    EditLogValidation validation =
        EditLogFileInputStream.validateEditLog(logFile);
    assertTrue(!validation.hasCorruptHeader());
    assertEquals(HdfsConstants.INVALID_TXID, validation.getEndTxId());
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

     * 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();
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader.EditLogValidation

     * 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();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.