Java Code Examples for org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl

The following examples show how to use org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: LeveldbTimelineStateStore.java    License: Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 2
Source Project: big-c   Source File: LeveldbTimelineStateStore.java    License: Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example 3
Source Project: hadoop   Source File: NMLeveldbStateStoreService.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source Project: hadoop   Source File: NMLeveldbStateStoreService.java    License: Apache License 2.0 5 votes vote down vote up
private void dbStoreVersion(Version state) throws IOException {
  String key = DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 5
Source Project: hadoop   Source File: LeveldbRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
void dbStoreVersion(Version state) throws IOException {
  String key = VERSION_NODE;
  byte[] data = ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 6
Source Project: hadoop   Source File: ZKRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized void storeVersion() throws Exception {
  String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);
  byte[] data =
      ((VersionPBImpl) CURRENT_VERSION_INFO).getProto().toByteArray();
  if (existsWithRetries(versionNodePath, false) != null) {
    setDataWithRetries(versionNodePath, data, -1);
  } else {
    createWithRetries(versionNodePath, data, zkAcl, CreateMode.PERSISTENT);
  }
}
 
Example 7
Source Project: hadoop   Source File: ZKRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized Version loadVersion() throws Exception {
  String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);

  if (existsWithRetries(versionNodePath, false) != null) {
    byte[] data = getDataWithRetries(versionNodePath, false);
    Version version =
        new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
  }
  return null;
}
 
Example 8
Source Project: hadoop   Source File: FileSystemRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 9
Source Project: hadoop   Source File: FileSystemRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized void storeVersion() throws Exception {
  Path versionNodePath = getNodePath(rootDirPath, VERSION_NODE);
  byte[] data =
      ((VersionPBImpl) CURRENT_VERSION_INFO).getProto().toByteArray();
  if (existsWithRetries(versionNodePath)) {
    updateFile(versionNodePath, data, false);
  } else {
    writeFileWithRetries(versionNodePath, data, false);
  }
}
 
Example 10
Source Project: hadoop   Source File: LeveldbTimelineStore.java    License: Apache License 2.0 5 votes vote down vote up
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);    	
  }
}
 
Example 11
Source Project: hadoop   Source File: LeveldbTimelineStore.java    License: Apache License 2.0 5 votes vote down vote up
private void dbStoreVersion(Version state) throws IOException {
  String key = TIMELINE_STORE_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 12
Source Project: hadoop   Source File: LeveldbTimelineStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void storeVersion(Version state) throws IOException {
  byte[] data =
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(TIMELINE_STATE_STORE_VERSION_KEY, data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 13
Source Project: hadoop   Source File: ShuffleHandler.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
Version loadVersion() throws IOException {
  byte[] data = stateDb.get(bytes(STATE_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;
}
 
Example 14
Source Project: hadoop   Source File: ShuffleHandler.java    License: Apache License 2.0 5 votes vote down vote up
private void storeSchemaVersion(Version version) throws IOException {
  String key = STATE_DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) version).getProto().toByteArray();
  try {
    stateDb.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e.getMessage(), e);
  }
}
 
Example 15
Version loadVersion() throws IOException {
  byte[] data = db.get(bytes(DB_SCHEMA_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;
}
 
Example 16
void dbStoreVersion(Version state) throws IOException {
  String key = DB_SCHEMA_VERSION_KEY;
  byte[] data =
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 17
Source Project: big-c   Source File: NMLeveldbStateStoreService.java    License: Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 18
Source Project: big-c   Source File: NMLeveldbStateStoreService.java    License: Apache License 2.0 5 votes vote down vote up
private void dbStoreVersion(Version state) throws IOException {
  String key = DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 19
Source Project: big-c   Source File: LeveldbRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
void dbStoreVersion(Version state) throws IOException {
  String key = VERSION_NODE;
  byte[] data = ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 20
Source Project: big-c   Source File: ZKRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized void storeVersion() throws Exception {
  String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);
  byte[] data =
      ((VersionPBImpl) CURRENT_VERSION_INFO).getProto().toByteArray();
  if (existsWithRetries(versionNodePath, false) != null) {
    setDataWithRetries(versionNodePath, data, -1);
  } else {
    createWithRetries(versionNodePath, data, zkAcl, CreateMode.PERSISTENT);
  }
}
 
Example 21
Source Project: big-c   Source File: ZKRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized Version loadVersion() throws Exception {
  String versionNodePath = getNodePath(zkRootNodePath, VERSION_NODE);

  if (existsWithRetries(versionNodePath, false) != null) {
    byte[] data = getDataWithRetries(versionNodePath, false);
    Version version =
        new VersionPBImpl(VersionProto.parseFrom(data));
    return version;
  }
  return null;
}
 
Example 22
Source Project: big-c   Source File: FileSystemRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 23
Source Project: big-c   Source File: FileSystemRMStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected synchronized void storeVersion() throws Exception {
  Path versionNodePath = getNodePath(rootDirPath, VERSION_NODE);
  byte[] data =
      ((VersionPBImpl) CURRENT_VERSION_INFO).getProto().toByteArray();
  if (existsWithRetries(versionNodePath)) {
    updateFile(versionNodePath, data, false);
  } else {
    writeFileWithRetries(versionNodePath, data, false);
  }
}
 
Example 24
Source Project: big-c   Source File: LeveldbTimelineStore.java    License: Apache License 2.0 5 votes vote down vote up
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);    	
  }
}
 
Example 25
Source Project: big-c   Source File: LeveldbTimelineStore.java    License: Apache License 2.0 5 votes vote down vote up
private void dbStoreVersion(Version state) throws IOException {
  String key = TIMELINE_STORE_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 26
Source Project: big-c   Source File: LeveldbTimelineStateStore.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void storeVersion(Version state) throws IOException {
  byte[] data =
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(TIMELINE_STATE_STORE_VERSION_KEY, data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}
 
Example 27
Source Project: big-c   Source File: ShuffleHandler.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
Version loadVersion() throws IOException {
  byte[] data = stateDb.get(bytes(STATE_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;
}
 
Example 28
Source Project: big-c   Source File: ShuffleHandler.java    License: Apache License 2.0 5 votes vote down vote up
private void storeSchemaVersion(Version version) throws IOException {
  String key = STATE_DB_SCHEMA_VERSION_KEY;
  byte[] data = 
      ((VersionPBImpl) version).getProto().toByteArray();
  try {
    stateDb.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e.getMessage(), e);
  }
}
 
Example 29
Version loadVersion() throws IOException {
  byte[] data = db.get(bytes(DB_SCHEMA_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;
}
 
Example 30
void dbStoreVersion(Version state) throws IOException {
  String key = DB_SCHEMA_VERSION_KEY;
  byte[] data =
      ((VersionPBImpl) state).getProto().toByteArray();
  try {
    db.put(bytes(key), data);
  } catch (DBException e) {
    throw new IOException(e);
  }
}