当前位置: 首页>>代码示例>>Java>>正文


Java ManualEnvironmentEdge类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.ManualEnvironmentEdge的典型用法代码示例。如果您正苦于以下问题:Java ManualEnvironmentEdge类的具体用法?Java ManualEnvironmentEdge怎么用?Java ManualEnvironmentEdge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ManualEnvironmentEdge类属于org.apache.hadoop.hbase.util包,在下文中一共展示了ManualEnvironmentEdge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSortExtract

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testSortExtract(){
  ManualEnvironmentEdge mee = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(mee);
  mee.setValue(1);

  DeadServer d = new DeadServer();


  d.add(hostname123);
  mee.incValue(1);
  d.add(hostname1234);
  mee.incValue(1);
  d.add(hostname12345);

  List<Pair<ServerName, Long>> copy = d.copyDeadServersSince(2L);
  Assert.assertEquals(2, copy.size());

  Assert.assertEquals(hostname1234, copy.get(0).getFirst());
  Assert.assertEquals(new Long(2L), copy.get(0).getSecond());

  Assert.assertEquals(hostname12345, copy.get(1).getFirst());
  Assert.assertEquals(new Long(3L), copy.get(1).getSecond());

  EnvironmentEdgeManager.reset();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:TestDeadServer.java

示例2: setUpBeforeClass

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.getConfiguration().setBoolean(QuotaUtil.QUOTA_CONF_KEY, true);
  TEST_UTIL.getConfiguration().setInt(QuotaCache.REFRESH_CONF_KEY, REFRESH_TIME);
  TEST_UTIL.getConfiguration().setInt("hbase.hstore.compactionThreshold", 10);
  TEST_UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 100);
  TEST_UTIL.getConfiguration().setInt("hbase.client.pause", 250);
  TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6);
  TEST_UTIL.getConfiguration().setBoolean("hbase.master.enabletable.roundrobin", true);
  TEST_UTIL.startMiniCluster(1);
  TEST_UTIL.waitTableAvailable(QuotaTableUtil.QUOTA_TABLE_NAME);
  QuotaCache.TEST_FORCE_REFRESH = true;

  tables = new Table[TABLE_NAMES.length];
  for (int i = 0; i < TABLE_NAMES.length; ++i) {
    tables[i] = TEST_UTIL.createTable(TABLE_NAMES[i], FAMILY);
  }

  envEdge = new ManualEnvironmentEdge();
  envEdge.setValue(EnvironmentEdgeManager.currentTime());
  EnvironmentEdgeManagerTestHelper.injectEdge(envEdge);
}
 
开发者ID:apache,项目名称:hbase,代码行数:23,代码来源:TestQuotaThrottle.java

示例3: testIncrementTimestampsAreMonotonic

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testIncrementTimestampsAreMonotonic() throws IOException {
  HRegion region = initHRegion(tableName, method, CONF, fam1);
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);

  edge.setValue(10);
  Increment inc = new Increment(row);
  inc.setDurability(Durability.SKIP_WAL);
  inc.addColumn(fam1, qual1, 1L);
  region.increment(inc);

  Result result = region.get(new Get(row));
  Cell c = result.getColumnLatestCell(fam1, qual1);
  assertNotNull(c);
  assertEquals(10L, c.getTimestamp());

  edge.setValue(1); // clock goes back
  region.increment(inc);
  result = region.get(new Get(row));
  c = result.getColumnLatestCell(fam1, qual1);
  assertEquals(11L, c.getTimestamp());
  assertEquals(2L, Bytes.toLong(c.getValueArray(), c.getValueOffset(), c.getValueLength()));
}
 
开发者ID:apache,项目名称:hbase,代码行数:25,代码来源:TestHRegion.java

示例4: sfCreate

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
protected ArrayList<HStoreFile> sfCreate(long[] minTimestamps, long[] maxTimestamps, long[] sizes)
    throws IOException {
  ManualEnvironmentEdge timeMachine = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(timeMachine);
  // Has to be > 0 and < now.
  timeMachine.setValue(1);
  ArrayList<Long> ageInDisk = new ArrayList<>();
  for (int i = 0; i < sizes.length; i++) {
    ageInDisk.add(0L);
  }

  ArrayList<HStoreFile> ret = Lists.newArrayList();
  for (int i = 0; i < sizes.length; i++) {
    MockHStoreFile msf =
        new MockHStoreFile(TEST_UTIL, TEST_FILE, sizes[i], ageInDisk.get(i), false, i);
    msf.setTimeRangeTracker(TimeRangeTracker.create(TimeRangeTracker.Type.SYNC, minTimestamps[i], maxTimestamps[i]));
    ret.add(msf);
  }
  return ret;
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:AbstractTestDateTieredCompactionPolicy.java

示例5: compactEquals

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
protected void compactEquals(long now, ArrayList<HStoreFile> candidates, long[] expectedFileSizes,
    long[] expectedBoundaries, boolean isMajor, boolean toCompact) throws IOException {
  ManualEnvironmentEdge timeMachine = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(timeMachine);
  timeMachine.setValue(now);
  DateTieredCompactionRequest request;
  DateTieredCompactionPolicy policy =
      (DateTieredCompactionPolicy) store.storeEngine.getCompactionPolicy();
  if (isMajor) {
    for (HStoreFile file : candidates) {
      ((MockHStoreFile) file).setIsMajor(true);
    }
    assertEquals(toCompact, policy.shouldPerformMajorCompaction(candidates));
    request = (DateTieredCompactionRequest) policy.selectMajorCompaction(candidates);
  } else {
    assertEquals(toCompact, policy.needsCompaction(candidates, ImmutableList.of()));
    request =
        (DateTieredCompactionRequest) policy.selectMinorCompaction(candidates, false, false);
  }
  List<HStoreFile> actual = Lists.newArrayList(request.getFiles());
  assertEquals(Arrays.toString(expectedFileSizes), Arrays.toString(getSizes(actual)));
  assertEquals(Arrays.toString(expectedBoundaries),
    Arrays.toString(request.getBoundaries().toArray()));
}
 
开发者ID:apache,项目名称:hbase,代码行数:25,代码来源:AbstractTestDateTieredCompactionPolicy.java

示例6: testAppendTimestampsAreMonotonic

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testAppendTimestampsAreMonotonic() throws IOException {
  HRegion region = initHRegion(tableName, name.getMethodName(), CONF, fam1);
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);

  edge.setValue(10);
  Append a = new Append(row);
  a.setDurability(Durability.SKIP_WAL);
  a.add(fam1, qual1, qual1);
  region.append(a);

  Result result = region.get(new Get(row));
  Cell c = result.getColumnLatestCell(fam1, qual1);
  assertNotNull(c);
  assertEquals(c.getTimestamp(), 10L);

  edge.setValue(1); // clock goes back
  region.append(a);
  result = region.get(new Get(row));
  c = result.getColumnLatestCell(fam1, qual1);
  assertEquals(c.getTimestamp(), 10L);

  byte[] expected = new byte[qual1.length*2];
  System.arraycopy(qual1, 0, expected, 0, qual1.length);
  System.arraycopy(qual1, 0, expected, qual1.length, qual1.length);

  assertTrue(Bytes.equals(c.getValueArray(), c.getValueOffset(), c.getValueLength(),
    expected, 0, expected.length));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:TestHRegion.java

示例7: testMergeExpiredFiles

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testMergeExpiredFiles() throws Exception {
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  long now = defaultTtl + 2;
  edge.setValue(now);
  EnvironmentEdgeManager.injectEdge(edge);
  try {
    StoreFile expiredFile = createFile(), notExpiredFile = createFile();
    when(expiredFile.getReader().getMaxTimestamp()).thenReturn(now - defaultTtl - 1);
    when(notExpiredFile.getReader().getMaxTimestamp()).thenReturn(now - defaultTtl + 1);
    List<StoreFile> expired = Lists.newArrayList(expiredFile, expiredFile);
    List<StoreFile> notExpired = Lists.newArrayList(notExpiredFile, notExpiredFile);
    List<StoreFile> mixed = Lists.newArrayList(expiredFile, notExpiredFile);

    StripeCompactionPolicy policy = createPolicy(HBaseConfiguration.create(),
        defaultSplitSize, defaultSplitCount, defaultInitialCount, true);
    // Merge expired if there are eligible stripes.
    StripeCompactionPolicy.StripeInformationProvider si =
        createStripesWithFiles(expired, expired, expired);
    verifyWholeStripesCompaction(policy, si, 0, 2, null, 1, Long.MAX_VALUE, false);
    // Don't merge if nothing expired.
    si = createStripesWithFiles(notExpired, notExpired, notExpired);
    assertNull(policy.selectCompaction(si, al(), false));
    // Merge one expired stripe with next.
    si = createStripesWithFiles(notExpired, expired, notExpired);
    verifyWholeStripesCompaction(policy, si, 1, 2, null, 1, Long.MAX_VALUE, false);
    // Merge the biggest run out of multiple options.
    // Merge one expired stripe with next.
    si = createStripesWithFiles(notExpired, expired, notExpired, expired, expired, notExpired);
    verifyWholeStripesCompaction(policy, si, 3, 4, null, 1, Long.MAX_VALUE, false);
    // Stripe with a subset of expired files is not merged.
    si = createStripesWithFiles(expired, expired, notExpired, expired, mixed);
    verifyWholeStripesCompaction(policy, si, 0, 1, null, 1, Long.MAX_VALUE, false);
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:TestStripeCompactionPolicy.java

示例8: testMergeExpiredStripes

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testMergeExpiredStripes() throws Exception {
  // HBASE-11397
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  long now = defaultTtl + 2;
  edge.setValue(now);
  EnvironmentEdgeManager.injectEdge(edge);
  try {
    StoreFile expiredFile = createFile(), notExpiredFile = createFile();
    when(expiredFile.getReader().getMaxTimestamp()).thenReturn(now - defaultTtl - 1);
    when(notExpiredFile.getReader().getMaxTimestamp()).thenReturn(now - defaultTtl + 1);
    List<StoreFile> expired = Lists.newArrayList(expiredFile, expiredFile);
    List<StoreFile> notExpired = Lists.newArrayList(notExpiredFile, notExpiredFile);

    StripeCompactionPolicy policy =
        createPolicy(HBaseConfiguration.create(), defaultSplitSize, defaultSplitCount,
          defaultInitialCount, true);

    // Merge all three expired stripes into one.
    StripeCompactionPolicy.StripeInformationProvider si =
        createStripesWithFiles(expired, expired, expired);
    verifyMergeCompatcion(policy, si, 0, 2);

    // Merge two adjacent expired stripes into one.
    si = createStripesWithFiles(notExpired, expired, notExpired, expired, expired, notExpired);
    verifyMergeCompatcion(policy, si, 3, 4);
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:TestStripeCompactionPolicy.java

示例9: testCleanup

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testCleanup() throws Exception {
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);
  try {
    ServerNonceManager nm = createManager(6);
    ScheduledChore cleanup = nm.createCleanupScheduledChore(Mockito.mock(Stoppable.class));
    edge.setValue(1);
    assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
    assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
    assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
    edge.setValue(2);
    nm.endOperation(NO_NONCE, 1, true);
    edge.setValue(4);
    nm.endOperation(NO_NONCE, 2, true);
    edge.setValue(9);
    cleanup.choreForTesting();
    // Nonce 1 has been cleaned up.
    assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
    // Nonce 2 has not been cleaned up.
    assertFalse(nm.startOperation(NO_NONCE, 2, createStoppable()));
    // Nonce 3 was active and active ops should never be cleaned up; try to end and start.
    nm.endOperation(NO_NONCE, 3, false);
    assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
    edge.setValue(11);
    cleanup.choreForTesting();
    // Now, nonce 2 has been cleaned up.
    assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:TestServerNonceManager.java

示例10: testWalNonces

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testWalNonces() throws Exception {
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);
  try {
    ServerNonceManager nm = createManager(6);
    ScheduledChore cleanup = nm.createCleanupScheduledChore(Mockito.mock(Stoppable.class));
    // Add nonces from WAL, including dups.
    edge.setValue(12);
    nm.reportOperationFromWal(NO_NONCE, 1, 8);
    nm.reportOperationFromWal(NO_NONCE, 2, 2);
    nm.reportOperationFromWal(NO_NONCE, 3, 5);
    nm.reportOperationFromWal(NO_NONCE, 3, 6);
    // WAL nonces should prevent cross-server conflicts.
    assertFalse(nm.startOperation(NO_NONCE, 1, createStoppable()));
    // Make sure we ignore very old nonces, but not borderline old nonces.
    assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
    assertFalse(nm.startOperation(NO_NONCE, 3, createStoppable()));
    // Make sure grace period is counted from recovery time.
    edge.setValue(17);
    cleanup.choreForTesting();
    assertFalse(nm.startOperation(NO_NONCE, 1, createStoppable()));
    assertFalse(nm.startOperation(NO_NONCE, 3, createStoppable()));
    edge.setValue(19);
    cleanup.choreForTesting();
    assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
    assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:32,代码来源:TestServerNonceManager.java

示例11: testRenameAndSetModifyTime

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testRenameAndSetModifyTime() throws Exception {
  assertTrue(FSUtils.isHDFS(conf));

  FileSystem fs = FileSystem.get(conf);
  Path testDir = TEST_UTIL.getDataTestDir("testArchiveFile");

  String file = UUID.randomUUID().toString();
  Path p = new Path(testDir, file);

  FSDataOutputStream out = fs.create(p);
  out.close();
  assertTrue("The created file should be present", FSUtils.isExists(fs, p));

  long expect = System.currentTimeMillis() + 1000;
  assertFalse(expect == fs.getFileStatus(p).getModificationTime());

  ManualEnvironmentEdge mockEnv = new ManualEnvironmentEdge();
  mockEnv.setValue(expect);
  EnvironmentEdgeManager.injectEdge(mockEnv);

  String dstFile = UUID.randomUUID().toString();
  Path dst = new Path(testDir , dstFile);

  assertTrue(HBaseFileSystem.renameAndSetModifyTime(fs, p, dst));
  assertFalse("The moved file should not be present", FSUtils.isExists(fs,
                                                                       p));
  assertTrue("The dst file should be present", FSUtils.isExists(fs, dst));

  assertEquals(expect, fs.getFileStatus(dst).getModificationTime());
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:32,代码来源:TestHBaseFileSystem.java

示例12: testIncrementColumnValue_BumpSnapshot

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
public void testIncrementColumnValue_BumpSnapshot() throws IOException {
  ManualEnvironmentEdge mee = new ManualEnvironmentEdge();
  EnvironmentEdgeManagerTestHelper.injectEdge(mee);
  this.region = initHRegion(tableName, getName(), conf, fam1);
  try {
    long value = 42L;
    long incr = 44L;

    // first put something in kvset, then snapshot it.
    Put put = new Put(row);
    put.add(fam1, qual1, Bytes.toBytes(value));
    region.put(put);

    // get the store in question:
    Store s = region.getStore(fam1);
    s.snapshot(); //bam

    // now increment:
    long newVal = region.incrementColumnValue(row, fam1, qual1,
        incr, false);

    assertEquals(value+incr, newVal);

    // get both versions:
    Get get = new Get(row);
    get.setMaxVersions();
    get.addColumn(fam1,qual1);

    Result r = region.get(get, null);
    assertEquals(2, r.size());
    KeyValue first = r.raw()[0];
    KeyValue second = r.raw()[1];

    assertTrue("ICV failed to upgrade timestamp",
        first.getTimestamp() != second.getTimestamp());
  } finally {
    HRegion.closeHRegion(this.region);
    this.region = null;
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:41,代码来源:TestHRegion.java

示例13: testCleanup

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testCleanup() throws Exception {
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);
  try {
    ServerNonceManager nm = createManager(6);
    Chore cleanup = nm.createCleanupChore(Mockito.mock(Stoppable.class));
    edge.setValue(1);
    assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
    assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
    assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
    edge.setValue(2);
    nm.endOperation(NO_NONCE, 1, true);
    edge.setValue(4);
    nm.endOperation(NO_NONCE, 2, true);
    edge.setValue(9);
    cleanup.choreForTesting();
    // Nonce 1 has been cleaned up.
    assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
    // Nonce 2 has not been cleaned up.
    assertFalse(nm.startOperation(NO_NONCE, 2, createStoppable()));
    // Nonce 3 was active and active ops should never be cleaned up; try to end and start.
    nm.endOperation(NO_NONCE, 3, false);
    assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
    edge.setValue(11);
    cleanup.choreForTesting();
    // Now, nonce 2 has been cleaned up.
    assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:33,代码来源:TestServerNonceManager.java

示例14: testWalNonces

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testWalNonces() throws Exception {
  ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(edge);
  try {
    ServerNonceManager nm = createManager(6);
    Chore cleanup = nm.createCleanupChore(Mockito.mock(Stoppable.class));
    // Add nonces from WAL, including dups.
    edge.setValue(12);
    nm.reportOperationFromWal(NO_NONCE, 1, 8);
    nm.reportOperationFromWal(NO_NONCE, 2, 2);
    nm.reportOperationFromWal(NO_NONCE, 3, 5);
    nm.reportOperationFromWal(NO_NONCE, 3, 6);
    // WAL nonces should prevent cross-server conflicts.
    assertFalse(nm.startOperation(NO_NONCE, 1, createStoppable()));
    // Make sure we ignore very old nonces, but not borderline old nonces.
    assertTrue(nm.startOperation(NO_NONCE, 2, createStoppable()));
    assertFalse(nm.startOperation(NO_NONCE, 3, createStoppable()));
    // Make sure grace period is counted from recovery time.
    edge.setValue(17);
    cleanup.choreForTesting();
    assertFalse(nm.startOperation(NO_NONCE, 1, createStoppable()));
    assertFalse(nm.startOperation(NO_NONCE, 3, createStoppable()));
    edge.setValue(19);
    cleanup.choreForTesting();
    assertTrue(nm.startOperation(NO_NONCE, 1, createStoppable()));
    assertTrue(nm.startOperation(NO_NONCE, 3, createStoppable()));
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:32,代码来源:TestServerNonceManager.java

示例15: testErrorBackoffTimeCalculation

import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; //导入依赖的package包/类
@Test
public void testErrorBackoffTimeCalculation() throws Exception {
  // TODO: This test would seem to presume hardcoded RETRY_BACKOFF which it should not.
  final long ANY_PAUSE = 100;
  ServerName location = ServerName.valueOf("127.0.0.1", 1, 0);
  ServerName diffLocation = ServerName.valueOf("127.0.0.1", 2, 0);

  ManualEnvironmentEdge timeMachine = new ManualEnvironmentEdge();
  EnvironmentEdgeManager.injectEdge(timeMachine);
  try {
    long largeAmountOfTime = ANY_PAUSE * 1000;
    ConnectionImplementation.ServerErrorTracker tracker =
        new ConnectionImplementation.ServerErrorTracker(largeAmountOfTime, 100);

    // The default backoff is 0.
    assertEquals(0, tracker.calculateBackoffTime(location, ANY_PAUSE));

    // Check some backoff values from HConstants sequence.
    tracker.reportServerError(location);
    assertEqualsWithJitter(ANY_PAUSE * HConstants.RETRY_BACKOFF[0],
      tracker.calculateBackoffTime(location, ANY_PAUSE));
    tracker.reportServerError(location);
    tracker.reportServerError(location);
    tracker.reportServerError(location);
    assertEqualsWithJitter(ANY_PAUSE * HConstants.RETRY_BACKOFF[3],
      tracker.calculateBackoffTime(location, ANY_PAUSE));

    // All of this shouldn't affect backoff for different location.
    assertEquals(0, tracker.calculateBackoffTime(diffLocation, ANY_PAUSE));
    tracker.reportServerError(diffLocation);
    assertEqualsWithJitter(ANY_PAUSE * HConstants.RETRY_BACKOFF[0],
      tracker.calculateBackoffTime(diffLocation, ANY_PAUSE));

    // Check with different base.
    assertEqualsWithJitter(ANY_PAUSE * 2 * HConstants.RETRY_BACKOFF[3],
        tracker.calculateBackoffTime(location, ANY_PAUSE * 2));
  } finally {
    EnvironmentEdgeManager.reset();
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:41,代码来源:TestConnectionImplementation.java


注:本文中的org.apache.hadoop.hbase.util.ManualEnvironmentEdge类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。