Search in sources :

Example 1 with VersionPBImpl

use of org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl in project hadoop by apache.

the class FileSystemRMStateStore method loadVersion.

@Override
protected synchronized Version loadVersion() throws Exception {
    Path versionNodePath = getNodePath(rootDirPath, VERSION_NODE);
    FileStatus status = getFileStatusWithRetries(versionNodePath);
    if (status != null) {
        byte[] data = readFileWithRetries(versionNodePath, status.getLen());
        Version version = new VersionPBImpl(VersionProto.parseFrom(data));
        return version;
    }
    return null;
}
Also used : Path(org.apache.hadoop.fs.Path) FileStatus(org.apache.hadoop.fs.FileStatus) VersionPBImpl(org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl) Version(org.apache.hadoop.yarn.server.records.Version)

Example 2 with VersionPBImpl

use of org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl in project hadoop by apache.

the class RollingLevelDBTimelineStore method loadVersion.

Version loadVersion() throws IOException {
    byte[] data = starttimedb.get(bytes(TIMELINE_STORE_VERSION_KEY));
    // if version is not stored previously, treat it as 1.0.
    if (data == null || data.length == 0) {
        return Version.newInstance(1, 0);
    }
    Version version = new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
}
Also used : VersionPBImpl(org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl) Version(org.apache.hadoop.yarn.server.records.Version)

Example 3 with VersionPBImpl

use of org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl in project hadoop by apache.

the class LeveldbTimelineStore method loadVersion.

Version loadVersion() throws IOException {
    try {
        byte[] data = db.get(bytes(TIMELINE_STORE_VERSION_KEY));
        // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
        if (data == null || data.length == 0) {
            return getCurrentVersion();
        }
        Version version = new VersionPBImpl(VersionProto.parseFrom(data));
        return version;
    } catch (DBException e) {
        throw new IOException(e);
    }
}
Also used : VersionPBImpl(org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl) Version(org.apache.hadoop.yarn.server.records.Version) IOException(java.io.IOException)

Example 4 with VersionPBImpl

use of org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl in project hadoop by apache.

the class LeveldbTimelineStateStore method loadVersion.

@VisibleForTesting
Version loadVersion() throws IOException {
    try {
        byte[] data = db.get(TIMELINE_STATE_STORE_VERSION_KEY);
        // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
        if (data == null || data.length == 0) {
            return getCurrentVersion();
        }
        Version version = new VersionPBImpl(YarnServerCommonProtos.VersionProto.parseFrom(data));
        return version;
    } catch (DBException e) {
        throw new IOException(e);
    }
}
Also used : DBException(org.iq80.leveldb.DBException) VersionPBImpl(org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl) Version(org.apache.hadoop.yarn.server.records.Version) IOException(java.io.IOException) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 5 with VersionPBImpl

use of org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl in project hadoop by apache.

the class NMLeveldbStateStoreService method loadVersion.

Version loadVersion() throws IOException {
    byte[] data = db.get(bytes(DB_SCHEMA_VERSION_KEY));
    // if version is not stored previously, treat it as CURRENT_VERSION_INFO.
    if (data == null || data.length == 0) {
        return getCurrentVersion();
    }
    Version version = new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
}
Also used : VersionPBImpl(org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl) Version(org.apache.hadoop.yarn.server.records.Version)

Aggregations

Version (org.apache.hadoop.yarn.server.records.Version)8 VersionPBImpl (org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl)8 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 IOException (java.io.IOException)2 FileStatus (org.apache.hadoop.fs.FileStatus)1 Path (org.apache.hadoop.fs.Path)1 DBException (org.iq80.leveldb.DBException)1