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

The following examples show how to use org.apache.hadoop.yarn.server.records.impl.pb.VersionPBImpl. 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 File: LeveldbTimelineStateStore.java    From hadoop with 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 File: LeveldbTimelineStateStore.java    From big-c with 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 File: LeveldbTimelineStore.java    From big-c with 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 #4
Source File: NMLeveldbStateStoreService.java    From hadoop with 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 #5
Source File: LeveldbRMStateStore.java    From big-c with 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 File: ZKRMStateStore.java    From big-c with 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 File: ZKRMStateStore.java    From big-c with 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 File: FileSystemRMStateStore.java    From big-c with 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 File: FileSystemRMStateStore.java    From big-c with 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 File: LeveldbTimelineStore.java    From big-c with 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 File: NMLeveldbStateStoreService.java    From big-c with 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 #12
Source File: LeveldbTimelineStateStore.java    From big-c with 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 File: ShuffleHandler.java    From big-c with 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 File: ShuffleHandler.java    From big-c with 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
Source File: HistoryServerLeveldbStateStoreService.java    From big-c with 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 1.0.
  if (data == null || data.length == 0) {
    return Version.newInstance(1, 0);
  }
  Version version =
      new VersionPBImpl(VersionProto.parseFrom(data));
  return version;
}
 
Example #16
Source File: HistoryServerLeveldbStateStoreService.java    From big-c with Apache License 2.0 5 votes vote down vote up
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 File: ShuffleHandler.java    From tez with 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 #18
Source File: ShuffleHandler.java    From tez with 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 #19
Source File: LeveldbTimelineStore.java    From hadoop with 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 #20
Source File: NMLeveldbStateStoreService.java    From hadoop with 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 #21
Source File: LeveldbRMStateStore.java    From hadoop with 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 #22
Source File: ZKRMStateStore.java    From hadoop with 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 #23
Source File: ZKRMStateStore.java    From hadoop with 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 #24
Source File: FileSystemRMStateStore.java    From hadoop with 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 #25
Source File: FileSystemRMStateStore.java    From hadoop with 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 #26
Source File: NMLeveldbStateStoreService.java    From big-c with 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 #27
Source File: LeveldbTimelineStore.java    From hadoop with 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 #28
Source File: LeveldbTimelineStateStore.java    From hadoop with 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 #29
Source File: ShuffleHandler.java    From hadoop with 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 #30
Source File: ShuffleHandler.java    From hadoop with 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);
  }
}