Example usage for org.apache.hadoop.hdfs.server.namenode NameNodeLayoutVersion CURRENT_LAYOUT_VERSION

List of usage examples for org.apache.hadoop.hdfs.server.namenode NameNodeLayoutVersion CURRENT_LAYOUT_VERSION

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.namenode NameNodeLayoutVersion CURRENT_LAYOUT_VERSION.

Prototype

int CURRENT_LAYOUT_VERSION

To view the source code for org.apache.hadoop.hdfs.server.namenode NameNodeLayoutVersion CURRENT_LAYOUT_VERSION.

Click Source Link

Usage

From source file:com.github.brandtg.switchboard.HdfsLogParser.java

License:Apache License

@Override
protected FSEditLogOp nextOp() throws IOException {
    switch (state) {
    case UNINIT:/*w w w. j a  va2 s  .c  o  m*/
        try {
            tracker = new FSEditLogLoader.PositionTrackingInputStream(inputStream);
            dataInputStream = new DataInputStream(tracker);
            logVersion = dataInputStream.readInt();
            if (NameNodeLayoutVersion.supports(LayoutVersion.Feature.ADD_LAYOUT_FLAGS, logVersion)
                    || logVersion < NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION) {
                LayoutFlags.read(dataInputStream);
            }
            reader = new FSEditLogOp.Reader(dataInputStream, tracker, logVersion);
            reader.setMaxOpSize(maxOpSize);
            state = State.OPEN;
        } finally {
            if (reader == null) {
                dataInputStream.close();
                tracker.close();
                state = State.CLOSED;
            }
        }
        return nextOp();
    case OPEN:
        FSEditLogOp op = reader.readOp(false);
        if (op.opCode == FSEditLogOpCodes.OP_END_LOG_SEGMENT) {
            state = State.UNINIT;
        }
        return op;
    case CLOSED:
    default:
        return null;
    }
}