Java 类org.apache.hadoop.mapreduce.v2.hs.HistoryServerStateStoreService.HistoryServerState 实例源码

项目:hadoop    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:aliyun-oss-hadoop-fs    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:big-c    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:FlexMap    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:hops    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:hadoop-on-lustre2    文件:JHSDelegationTokenSecretManager.java   
public void recover(HistoryServerState state) throws IOException {
  LOG.info("Recovering " + getClass().getSimpleName());
  for (DelegationKey key : state.tokenMasterKeyState) {
    addKey(key);
  }
  for (Entry<MRDelegationTokenIdentifier, Long> entry :
      state.tokenState.entrySet()) {
    addPersistedDelegationToken(entry.getKey(), entry.getValue());
  }
}
项目:hadoop    文件:TestHistoryServerFileSystemStateStoreService.java   
@Test
public void testUpdatedTokenRecovery() throws IOException {
  IOException intentionalErr = new IOException("intentional error");
  FileSystem fs = FileSystem.getLocal(conf);
  final FileSystem spyfs = spy(fs);
  // make the update token process fail halfway through where we're left
  // with just the temporary update file and no token file
  ArgumentMatcher<Path> updateTmpMatcher = new ArgumentMatcher<Path>() {
    @Override
    public boolean matches(Object argument) {
      if (argument instanceof Path) {
        return ((Path) argument).getName().startsWith("update");
      }
      return false;
    }
  };
  doThrow(intentionalErr)
      .when(spyfs).rename(argThat(updateTmpMatcher), isA(Path.class));

  conf.set(JHAdminConfig.MR_HS_FS_STATE_STORE_URI,
      testDir.getAbsoluteFile().toURI().toString());
  HistoryServerStateStoreService store =
      new HistoryServerFileSystemStateStoreService() {
        @Override
        FileSystem createFileSystem() throws IOException {
          return spyfs;
        }
  };
  store.init(conf);
  store.start();

  final MRDelegationTokenIdentifier token1 =
      new MRDelegationTokenIdentifier(new Text("tokenOwner1"),
          new Text("tokenRenewer1"), new Text("tokenUser1"));
  token1.setSequenceNumber(1);
  final Long tokenDate1 = 1L;
  store.storeToken(token1, tokenDate1);
  final Long newTokenDate1 = 975318642L;
  try {
    store.updateToken(token1, newTokenDate1);
    fail("intentional error not thrown");
  } catch (IOException e) {
    assertEquals(intentionalErr, e);
  }
  store.close();

  // verify the update file is seen and parsed upon recovery when
  // original token file is missing
  store = createAndStartStore();
  HistoryServerState state = store.loadState();
  assertEquals("incorrect loaded token count", 1, state.tokenState.size());
  assertTrue("missing token 1", state.tokenState.containsKey(token1));
  assertEquals("incorrect token 1 date", newTokenDate1,
      state.tokenState.get(token1));
  store.close();
}
项目:aliyun-oss-hadoop-fs    文件:TestHistoryServerFileSystemStateStoreService.java   
@Test
public void testUpdatedTokenRecovery() throws IOException {
  IOException intentionalErr = new IOException("intentional error");
  FileSystem fs = FileSystem.getLocal(conf);
  final FileSystem spyfs = spy(fs);
  // make the update token process fail halfway through where we're left
  // with just the temporary update file and no token file
  ArgumentMatcher<Path> updateTmpMatcher = new ArgumentMatcher<Path>() {
    @Override
    public boolean matches(Object argument) {
      if (argument instanceof Path) {
        return ((Path) argument).getName().startsWith("update");
      }
      return false;
    }
  };
  doThrow(intentionalErr)
      .when(spyfs).rename(argThat(updateTmpMatcher), isA(Path.class));

  conf.set(JHAdminConfig.MR_HS_FS_STATE_STORE_URI,
      testDir.getAbsoluteFile().toURI().toString());
  HistoryServerStateStoreService store =
      new HistoryServerFileSystemStateStoreService() {
        @Override
        FileSystem createFileSystem() throws IOException {
          return spyfs;
        }
  };
  store.init(conf);
  store.start();

  final MRDelegationTokenIdentifier token1 =
      new MRDelegationTokenIdentifier(new Text("tokenOwner1"),
          new Text("tokenRenewer1"), new Text("tokenUser1"));
  token1.setSequenceNumber(1);
  final Long tokenDate1 = 1L;
  store.storeToken(token1, tokenDate1);
  final Long newTokenDate1 = 975318642L;
  try {
    store.updateToken(token1, newTokenDate1);
    fail("intentional error not thrown");
  } catch (IOException e) {
    assertEquals(intentionalErr, e);
  }
  store.close();

  // verify the update file is seen and parsed upon recovery when
  // original token file is missing
  store = createAndStartStore();
  HistoryServerState state = store.loadState();
  assertEquals("incorrect loaded token count", 1, state.tokenState.size());
  assertTrue("missing token 1", state.tokenState.containsKey(token1));
  assertEquals("incorrect token 1 date", newTokenDate1,
      state.tokenState.get(token1));
  store.close();
}
项目:big-c    文件:TestHistoryServerFileSystemStateStoreService.java   
@Test
public void testUpdatedTokenRecovery() throws IOException {
  IOException intentionalErr = new IOException("intentional error");
  FileSystem fs = FileSystem.getLocal(conf);
  final FileSystem spyfs = spy(fs);
  // make the update token process fail halfway through where we're left
  // with just the temporary update file and no token file
  ArgumentMatcher<Path> updateTmpMatcher = new ArgumentMatcher<Path>() {
    @Override
    public boolean matches(Object argument) {
      if (argument instanceof Path) {
        return ((Path) argument).getName().startsWith("update");
      }
      return false;
    }
  };
  doThrow(intentionalErr)
      .when(spyfs).rename(argThat(updateTmpMatcher), isA(Path.class));

  conf.set(JHAdminConfig.MR_HS_FS_STATE_STORE_URI,
      testDir.getAbsoluteFile().toURI().toString());
  HistoryServerStateStoreService store =
      new HistoryServerFileSystemStateStoreService() {
        @Override
        FileSystem createFileSystem() throws IOException {
          return spyfs;
        }
  };
  store.init(conf);
  store.start();

  final MRDelegationTokenIdentifier token1 =
      new MRDelegationTokenIdentifier(new Text("tokenOwner1"),
          new Text("tokenRenewer1"), new Text("tokenUser1"));
  token1.setSequenceNumber(1);
  final Long tokenDate1 = 1L;
  store.storeToken(token1, tokenDate1);
  final Long newTokenDate1 = 975318642L;
  try {
    store.updateToken(token1, newTokenDate1);
    fail("intentional error not thrown");
  } catch (IOException e) {
    assertEquals(intentionalErr, e);
  }
  store.close();

  // verify the update file is seen and parsed upon recovery when
  // original token file is missing
  store = createAndStartStore();
  HistoryServerState state = store.loadState();
  assertEquals("incorrect loaded token count", 1, state.tokenState.size());
  assertTrue("missing token 1", state.tokenState.containsKey(token1));
  assertEquals("incorrect token 1 date", newTokenDate1,
      state.tokenState.get(token1));
  store.close();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestHistoryServerFileSystemStateStoreService.java   
@Test
public void testUpdatedTokenRecovery() throws IOException {
  IOException intentionalErr = new IOException("intentional error");
  FileSystem fs = FileSystem.getLocal(conf);
  final FileSystem spyfs = spy(fs);
  // make the update token process fail halfway through where we're left
  // with just the temporary update file and no token file
  ArgumentMatcher<Path> updateTmpMatcher = new ArgumentMatcher<Path>() {
    @Override
    public boolean matches(Object argument) {
      if (argument instanceof Path) {
        return ((Path) argument).getName().startsWith("update");
      }
      return false;
    }
  };
  doThrow(intentionalErr)
      .when(spyfs).rename(argThat(updateTmpMatcher), isA(Path.class));

  conf.set(JHAdminConfig.MR_HS_FS_STATE_STORE_URI,
      testDir.getAbsoluteFile().toURI().toString());
  HistoryServerStateStoreService store =
      new HistoryServerFileSystemStateStoreService() {
        @Override
        FileSystem createFileSystem() throws IOException {
          return spyfs;
        }
  };
  store.init(conf);
  store.start();

  final MRDelegationTokenIdentifier token1 =
      new MRDelegationTokenIdentifier(new Text("tokenOwner1"),
          new Text("tokenRenewer1"), new Text("tokenUser1"));
  token1.setSequenceNumber(1);
  final Long tokenDate1 = 1L;
  store.storeToken(token1, tokenDate1);
  final Long newTokenDate1 = 975318642L;
  try {
    store.updateToken(token1, newTokenDate1);
    fail("intentional error not thrown");
  } catch (IOException e) {
    assertEquals(intentionalErr, e);
  }
  store.close();

  // verify the update file is seen and parsed upon recovery when
  // original token file is missing
  store = createAndStartStore();
  HistoryServerState state = store.loadState();
  assertEquals("incorrect loaded token count", 1, state.tokenState.size());
  assertTrue("missing token 1", state.tokenState.containsKey(token1));
  assertEquals("incorrect token 1 date", newTokenDate1,
      state.tokenState.get(token1));
  store.close();
}
项目:FlexMap    文件:TestHistoryServerFileSystemStateStoreService.java   
@Test
public void testUpdatedTokenRecovery() throws IOException {
  IOException intentionalErr = new IOException("intentional error");
  FileSystem fs = FileSystem.getLocal(conf);
  final FileSystem spyfs = spy(fs);
  // make the update token process fail halfway through where we're left
  // with just the temporary update file and no token file
  ArgumentMatcher<Path> updateTmpMatcher = new ArgumentMatcher<Path>() {
    @Override
    public boolean matches(Object argument) {
      if (argument instanceof Path) {
        return ((Path) argument).getName().startsWith("update");
      }
      return false;
    }
  };
  doThrow(intentionalErr)
      .when(spyfs).rename(argThat(updateTmpMatcher), isA(Path.class));

  conf.set(JHAdminConfig.MR_HS_FS_STATE_STORE_URI,
      testDir.getAbsoluteFile().toURI().toString());
  HistoryServerStateStoreService store =
      new HistoryServerFileSystemStateStoreService() {
        @Override
        FileSystem createFileSystem() throws IOException {
          return spyfs;
        }
  };
  store.init(conf);
  store.start();

  final MRDelegationTokenIdentifier token1 =
      new MRDelegationTokenIdentifier(new Text("tokenOwner1"),
          new Text("tokenRenewer1"), new Text("tokenUser1"));
  token1.setSequenceNumber(1);
  final Long tokenDate1 = 1L;
  store.storeToken(token1, tokenDate1);
  final Long newTokenDate1 = 975318642L;
  try {
    store.updateToken(token1, newTokenDate1);
    fail("intentional error not thrown");
  } catch (IOException e) {
    assertEquals(intentionalErr, e);
  }
  store.close();

  // verify the update file is seen and parsed upon recovery when
  // original token file is missing
  store = createAndStartStore();
  HistoryServerState state = store.loadState();
  assertEquals("incorrect loaded token count", 1, state.tokenState.size());
  assertTrue("missing token 1", state.tokenState.containsKey(token1));
  assertEquals("incorrect token 1 date", newTokenDate1,
      state.tokenState.get(token1));
  store.close();
}
项目:hops    文件:TestHistoryServerFileSystemStateStoreService.java   
@Test
public void testUpdatedTokenRecovery() throws IOException {
  IOException intentionalErr = new IOException("intentional error");
  FileSystem fs = FileSystem.getLocal(conf);
  final FileSystem spyfs = spy(fs);
  // make the update token process fail halfway through where we're left
  // with just the temporary update file and no token file
  ArgumentMatcher<Path> updateTmpMatcher = new ArgumentMatcher<Path>() {
    @Override
    public boolean matches(Object argument) {
      if (argument instanceof Path) {
        return ((Path) argument).getName().startsWith("update");
      }
      return false;
    }
  };
  doThrow(intentionalErr)
      .when(spyfs).rename(argThat(updateTmpMatcher), isA(Path.class));

  conf.set(JHAdminConfig.MR_HS_FS_STATE_STORE_URI,
      testDir.getAbsoluteFile().toURI().toString());
  HistoryServerStateStoreService store =
      new HistoryServerFileSystemStateStoreService() {
        @Override
        FileSystem createFileSystem() throws IOException {
          return spyfs;
        }
  };
  store.init(conf);
  store.start();

  final MRDelegationTokenIdentifier token1 =
      new MRDelegationTokenIdentifier(new Text("tokenOwner1"),
          new Text("tokenRenewer1"), new Text("tokenUser1"));
  token1.setSequenceNumber(1);
  final Long tokenDate1 = 1L;
  store.storeToken(token1, tokenDate1);
  final Long newTokenDate1 = 975318642L;
  try {
    store.updateToken(token1, newTokenDate1);
    fail("intentional error not thrown");
  } catch (IOException e) {
    assertEquals(intentionalErr, e);
  }
  store.close();

  // verify the update file is seen and parsed upon recovery when
  // original token file is missing
  store = createAndStartStore();
  HistoryServerState state = store.loadState();
  assertEquals("incorrect loaded token count", 1, state.tokenState.size());
  assertTrue("missing token 1", state.tokenState.containsKey(token1));
  assertEquals("incorrect token 1 date", newTokenDate1,
      state.tokenState.get(token1));
  store.close();
}