Search in sources :

Example 1 with AMRMTokenSecretManagerStatePBImpl

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl in project hadoop by apache.

the class FileSystemRMStateStore method loadAMRMTokenSecretManagerState.

private void loadAMRMTokenSecretManagerState(RMState rmState) throws Exception {
    checkAndResumeUpdateOperation(amrmTokenSecretManagerRoot);
    Path amrmTokenSecretManagerStateDataDir = new Path(amrmTokenSecretManagerRoot, AMRMTOKEN_SECRET_MANAGER_NODE);
    FileStatus status = getFileStatusWithRetries(amrmTokenSecretManagerStateDataDir);
    if (status == null) {
        return;
    }
    assert status.isFile();
    byte[] data = readFileWithRetries(amrmTokenSecretManagerStateDataDir, status.getLen());
    AMRMTokenSecretManagerStatePBImpl stateData = new AMRMTokenSecretManagerStatePBImpl(AMRMTokenSecretManagerStateProto.parseFrom(data));
    rmState.amrmTokenSecretManagerState = AMRMTokenSecretManagerState.newInstance(stateData.getCurrentMasterKey(), stateData.getNextMasterKey());
}
Also used : Path(org.apache.hadoop.fs.Path) FileStatus(org.apache.hadoop.fs.FileStatus) AMRMTokenSecretManagerStatePBImpl(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl)

Example 2 with AMRMTokenSecretManagerStatePBImpl

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl in project hadoop by apache.

the class LeveldbRMStateStore method loadAMRMTokenSecretManagerState.

private void loadAMRMTokenSecretManagerState(RMState rmState) throws IOException {
    try {
        byte[] data = db.get(bytes(AMRMTOKEN_SECRET_MANAGER_ROOT));
        if (data != null) {
            AMRMTokenSecretManagerStatePBImpl stateData = new AMRMTokenSecretManagerStatePBImpl(AMRMTokenSecretManagerStateProto.parseFrom(data));
            rmState.amrmTokenSecretManagerState = AMRMTokenSecretManagerState.newInstance(stateData.getCurrentMasterKey(), stateData.getNextMasterKey());
        }
    } catch (DBException e) {
        throw new IOException(e);
    }
}
Also used : DBException(org.iq80.leveldb.DBException) AMRMTokenSecretManagerStatePBImpl(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl) IOException(java.io.IOException)

Example 3 with AMRMTokenSecretManagerStatePBImpl

use of org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl in project hadoop by apache.

the class ZKRMStateStore method loadAMRMTokenSecretManagerState.

private void loadAMRMTokenSecretManagerState(RMState rmState) throws Exception {
    byte[] data = getData(amrmTokenSecretManagerRoot);
    if (data == null) {
        LOG.warn("There is no data saved");
    } else {
        AMRMTokenSecretManagerStatePBImpl stateData = new AMRMTokenSecretManagerStatePBImpl(AMRMTokenSecretManagerStateProto.parseFrom(data));
        rmState.amrmTokenSecretManagerState = AMRMTokenSecretManagerState.newInstance(stateData.getCurrentMasterKey(), stateData.getNextMasterKey());
    }
}
Also used : AMRMTokenSecretManagerStatePBImpl(org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl)

Aggregations

AMRMTokenSecretManagerStatePBImpl (org.apache.hadoop.yarn.server.resourcemanager.recovery.records.impl.pb.AMRMTokenSecretManagerStatePBImpl)3 IOException (java.io.IOException)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 Path (org.apache.hadoop.fs.Path)1 DBException (org.iq80.leveldb.DBException)1