Package org.apache.hadoop.hdfs.server.namenode

Examples of org.apache.hadoop.hdfs.server.namenode.FSEditLogOp$MkdirOp


      int startTxid, int endTxid) throws IOException, KeeperException,
      InterruptedException {
    EditLogOutputStream out = bkjm.startLogSegment(startTxid,
        NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION);
    for (long i = startTxid; i <= endTxid; i++) {
      FSEditLogOp op = FSEditLogTestUtil.getNoOpInstance();
      op.setTransactionId(i);
      out.write(op);
    }
    out.close();
    // finalize the inprogress_1 log segment.
    bkjm.finalizeLogSegment(startTxid, endTxid);
View Full Code Here


      if (stanzaStack.empty()) {
        if (!name.equals("DATA")) {
          throw new InvalidXmlException("expected </DATA>");
        }
        state = ParseState.EXPECT_RECORD;
        FSEditLogOp op = opCache.get(opCode);
        opCode = null;
        try {
          op.decodeXml(stanza);
          stanza = null;
        } finally {
          if (stanza != null) {
            System.err.println("fromXml error decoding opcode " + opCode +
                "\n" + stanza.toString());
            stanza = null;
          }
        }
        if (fixTxIds) {
          if (nextTxId <= 0) {
            nextTxId = op.getTransactionId();
            if (nextTxId <= 0) {
              nextTxId = 1;
            }
          }
          op.setTransactionId(nextTxId);
          nextTxId++;
        }
        try {
          visitor.visitOp(op);
        } catch (IOException e) {
View Full Code Here

  public static byte[] createTxnData(int startTxn, int numTxns) throws Exception {
    DataOutputBuffer buf = new DataOutputBuffer();
    FSEditLogOp.Writer writer = new FSEditLogOp.Writer(buf);
   
    for (long txid = startTxn; txid < startTxn + numTxns; txid++) {
      FSEditLogOp op = NameNodeAdapter.createMkdirOp("tx " + txid);
      op.setTransactionId(txid);
      writer.writeOp(op);
    }
   
    return Arrays.copyOf(buf.getData(), buf.getLength());
  }
View Full Code Here

      throws IOException {
    DataOutputBuffer buf = new DataOutputBuffer();
    FSEditLogOp.Writer writer = new FSEditLogOp.Writer(buf);

    for (long txid = startTxId; txid < startTxId + numTxns; txid++) {
      FSEditLogOp op = new TestEditLog.GarbageMkdirOp();
      op.setTransactionId(txid);
      writer.writeOp(op);
    }
    return Arrays.copyOf(buf.getData(), buf.getLength());
  }
View Full Code Here

      return stm;
    }
  }

  public static void writeOp(EditLogOutputStream stm, long txid) throws IOException {
    FSEditLogOp op = NameNodeAdapter.createMkdirOp("tx " + txid);
    op.setTransactionId(txid);
    stm.write(op);
  }
View Full Code Here

   
    for (int expected = firstTxnId;
        expected <= lastTxnId;
        expected++) {
     
      FSEditLogOp op = stream.readOp();
      while (op == null) {
        assertTrue("Expected to find txid " + expected + ", " +
            "but no more streams available to read from",
            iter.hasNext());
        stream = iter.next();
        op = stream.readOp();
      }
     
      assertEquals(FSEditLogOpCodes.OP_MKDIR, op.opCode);
      assertEquals(expected, op.getTransactionId());
    }
   
    assertNull(stream.readOp());
    assertFalse("Expected no more txns after " + lastTxnId +
        " but more streams are available", iter.hasNext());
View Full Code Here

  public void loadEdits() throws IOException {
    try {
      visitor.start(inputStream.getVersion(true));
      while (true) {
        try {
          FSEditLogOp op = inputStream.readOp();
          if (op == null)
            break;
          if (fixTxIds) {
            if (nextTxId <= 0) {
              nextTxId = op.getTransactionId();
              if (nextTxId <= 0) {
                nextTxId = 1;
              }
            }
            op.setTransactionId(nextTxId);
            nextTxId++;
          }
          visitor.visitOp(op);
        } catch (IOException e) {
          if (!recoveryMode) {
View Full Code Here

      if (stanzaStack.empty()) {
        if (!name.equals("DATA")) {
          throw new InvalidXmlException("expected </DATA>");
        }
        state = ParseState.EXPECT_RECORD;
        FSEditLogOp op = opCache.get(opCode);
        opCode = null;
        try {
          op.decodeXml(stanza);
          stanza = null;
        } finally {
          if (stanza != null) {
            System.err.println("fromXml error decoding opcode " + opCode +
                "\n" + stanza.toString());
            stanza = null;
          }
        }
        if (fixTxIds) {
          if (nextTxId <= 0) {
            nextTxId = op.getTransactionId();
            if (nextTxId <= 0) {
              nextTxId = 1;
            }
          }
          op.setTransactionId(nextTxId);
          nextTxId++;
        }
        try {
          visitor.visitOp(op);
        } catch (IOException e) {
View Full Code Here

  public static byte[] createTxnData(int startTxn, int numTxns) throws Exception {
    DataOutputBuffer buf = new DataOutputBuffer();
    FSEditLogOp.Writer writer = new FSEditLogOp.Writer(buf);
   
    for (long txid = startTxn; txid < startTxn + numTxns; txid++) {
      FSEditLogOp op = NameNodeAdapter.createMkdirOp("tx " + txid);
      op.setTransactionId(txid);
      writer.writeOp(op);
    }
   
    return Arrays.copyOf(buf.getData(), buf.getLength());
  }
View Full Code Here

      return stm;
    }
  }

  public static void writeOp(EditLogOutputStream stm, long txid) throws IOException {
    FSEditLogOp op = NameNodeAdapter.createMkdirOp("tx " + txid);
    op.setTransactionId(txid);
    stm.write(op);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.FSEditLogOp$MkdirOp

Copyright © 2018 www.massapicom. 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.