Java 类org.apache.hadoop.hdfs.qjournal.client.LoggerTooFarBehindException 实例源码

项目:hadoop    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {
  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:aliyun-oss-hadoop-fs    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {
  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:big-c    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {
  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {
  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:hadoop-EAR    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {

  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<JournalRequestInfo>any());

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:hadoop-plus    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {

  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:FlexMap    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {
  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:hadoop-TCP    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {

  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:hardfs    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {

  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}
项目:hadoop-on-lustre2    文件:TestIPCLoggerChannel.java   
/**
 * Test that, once the queue eclipses the configure size limit,
 * calls to journal more data are rejected.
 */
@Test
public void testQueueLimiting() throws Exception {
  // Block the underlying fake proxy from actually completing any calls.
  DelayAnswer delayer = new DelayAnswer(LOG);
  Mockito.doAnswer(delayer).when(mockProxy).journal(
      Mockito.<RequestInfo>any(),
      Mockito.eq(1L), Mockito.eq(1L),
      Mockito.eq(1), Mockito.same(FAKE_DATA));

  // Queue up the maximum number of calls.
  int numToQueue = LIMIT_QUEUE_SIZE_BYTES / FAKE_DATA.length;
  for (int i = 1; i <= numToQueue; i++) {
    ch.sendEdits(1L, (long)i, 1, FAKE_DATA);
  }

  // The accounting should show the correct total number queued.
  assertEquals(LIMIT_QUEUE_SIZE_BYTES, ch.getQueuedEditsSize());

  // Trying to queue any more should fail.
  try {
    ch.sendEdits(1L, numToQueue + 1, 1, FAKE_DATA).get(1, TimeUnit.SECONDS);
    fail("Did not fail to queue more calls after queue was full");
  } catch (ExecutionException ee) {
    if (!(ee.getCause() instanceof LoggerTooFarBehindException)) {
      throw ee;
    }
  }

  delayer.proceed();

  // After we allow it to proceeed, it should chug through the original queue
  GenericTestUtils.waitFor(new Supplier<Boolean>() {
    @Override
    public Boolean get() {
      return ch.getQueuedEditsSize() == 0;
    }
  }, 10, 1000);
}