@Test public void test1() throws Exception { TServers tservers = new TServers(); TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers); RootTabletLocator rtl = new TestRootTabletLocator(); TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(MetadataTable.ID, rtl, ttlo, new YesLockChecker()); TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(TableId.of("tab1"), rootTabletCache, ttlo, new YesLockChecker()); locateTabletTest(tab1TabletCache, "r1", null, null); KeyExtent tab1e = nke("tab1", null, null); setLocation(tservers, "tserver1", RTE, MTE, "tserver2"); setLocation(tservers, "tserver2", MTE, tab1e, "tserver3"); locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3"); locateTabletTest(tab1TabletCache, "r2", tab1e, "tserver3"); KeyExtent tab1e1 = nke("tab1", "g", null); KeyExtent tab1e2 = nke("tab1", null, "g"); setLocation(tservers, "tserver2", MTE, tab1e1, "tserver4"); setLocation(tservers, "tserver2", MTE, tab1e2, "tserver5"); locateTabletTest(tab1TabletCache, "r1", tab1e, "tserver3"); tab1TabletCache.invalidateCache(tab1e); locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4"); locateTabletTest(tab1TabletCache, "a", true, tab1e1, "tserver4"); locateTabletTest(tab1TabletCache, "g", tab1e1, "tserver4"); locateTabletTest(tab1TabletCache, "g", true, tab1e2, "tserver5"); KeyExtent tab1e22 = nke("tab1", null, "m"); setLocation(tservers, "tserver2", MTE, tab1e22, "tserver6"); locateTabletTest(tab1TabletCache, "r1", tab1e2, "tserver5"); tab1TabletCache.invalidateCache(tab1e2); locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6"); locateTabletTest(tab1TabletCache, "h", null, null); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4"); KeyExtent tab1e21 = nke("tab1", "m", "g"); setLocation(tservers, "tserver2", MTE, tab1e21, "tserver7"); locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver7"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4"); setLocation(tservers, "tserver2", MTE, tab1e21, "tserver8"); tab1TabletCache.invalidateCache(tab1e21); locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4"); setLocation(tservers, "tserver2", MTE, tab1e21, "tserver9"); tab1TabletCache.invalidateCache(context, "tserver8"); locateTabletTest(tab1TabletCache, "r1", tab1e22, "tserver6"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver9"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver4"); deleteServer(tservers, "tserver1"); deleteServer(tservers, "tserver2"); tab1TabletCache.invalidateCache(context, "tserver4"); tab1TabletCache.invalidateCache(context, "tserver6"); tab1TabletCache.invalidateCache(context, "tserver9"); locateTabletTest(tab1TabletCache, "r1", null, null); locateTabletTest(tab1TabletCache, "h", null, null); locateTabletTest(tab1TabletCache, "a", null, null); EasyMock.verify(context); context = EasyMock.createMock(ClientContext.class); EasyMock.expect(context.getInstanceID()).andReturn("instance1").anyTimes(); EasyMock.expect(context.getRootTabletLocation()).andReturn("tserver4").anyTimes(); replay(context); setLocation(tservers, "tserver4", RTE, MTE, "tserver5"); setLocation(tservers, "tserver5", MTE, tab1e1, "tserver1"); setLocation(tservers, "tserver5", MTE, tab1e21, "tserver2"); setLocation(tservers, "tserver5", MTE, tab1e22, "tserver3"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver1"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver2"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver3"); KeyExtent mte1 = new KeyExtent(MetadataTable.ID, tab1e21.toMetaRow(), RTE.endRow()); KeyExtent mte2 = new KeyExtent(MetadataTable.ID, null, tab1e21.toMetaRow()); setLocation(tservers, "tserver4", RTE, mte1, "tserver5"); setLocation(tservers, "tserver4", RTE, mte2, "tserver6"); deleteServer(tservers, "tserver5"); setLocation(tservers, "tserver5", mte1, tab1e1, "tserver7"); setLocation(tservers, "tserver5", mte1, tab1e21, "tserver8"); setLocation(tservers, "tserver6", mte2, tab1e22, "tserver9"); tab1TabletCache.invalidateCache(tab1e1); tab1TabletCache.invalidateCache(tab1e21); tab1TabletCache.invalidateCache(tab1e22); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); deleteServer(tservers, "tserver5"); tab1TabletCache.invalidateCache(context, "tserver7"); locateTabletTest(tab1TabletCache, "a", null, null); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); setLocation(tservers, "tserver4", RTE, mte1, "tserver10"); setLocation(tservers, "tserver10", mte1, tab1e1, "tserver7"); setLocation(tservers, "tserver10", mte1, tab1e21, "tserver8"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver7"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); tab1TabletCache.invalidateCache(context, "tserver7"); setLocation(tservers, "tserver10", mte1, tab1e1, "tserver2"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver2"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver8"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); KeyExtent mte11 = new KeyExtent(MetadataTable.ID, tab1e1.toMetaRow(), RTE.endRow()); KeyExtent mte12 = new KeyExtent(MetadataTable.ID, tab1e21.toMetaRow(), tab1e1.toMetaRow()); deleteServer(tservers, "tserver10"); setLocation(tservers, "tserver4", RTE, mte12, "tserver10"); setLocation(tservers, "tserver10", mte12, tab1e21, "tserver12"); tab1TabletCache.invalidateCache(tab1e1); tab1TabletCache.invalidateCache(tab1e21); locateTabletTest(tab1TabletCache, "a", null, null); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); setLocation(tservers, "tserver4", RTE, mte11, "tserver5"); setLocation(tservers, "tserver5", mte11, tab1e1, "tserver13"); locateTabletTest(tab1TabletCache, "a", tab1e1, "tserver13"); locateTabletTest(tab1TabletCache, "h", tab1e21, "tserver12"); locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); }
@Override public void invalidateCache(KeyExtent failedExtent) { wLock.lock(); try { badExtents.add(failedExtent); } finally { wLock.unlock(); } if (log.isTraceEnabled()) log.trace("Invalidated extent={}", failedExtent); }
TabletLocatorImpl extends TabletLocator { @Override public void invalidateCache(KeyExtent failedExtent) { wLock.lock(); try { badExtents.add(failedExtent); } finally { wLock.unlock(); } if (log.isTraceEnabled()) log.trace("Invalidated extent={}", failedExtent); } }
TabletLocatorImpl extends TabletLocator { @Override public void invalidateCache(KeyExtent failedExtent) { wLock.lock(); try { badExtents.add(failedExtent); } finally { wLock.unlock(); } if (log.isTraceEnabled()) log.trace("Invalidated extent={}", failedExtent); } TabletLocatorImpl(TableId tableId, TabletLocator parent, TabletLocationObtainer tlo,
      TabletServerLockChecker tslc); }
TabletLocatorImpl extends TabletLocator { @Override public void invalidateCache(KeyExtent failedExtent) { wLock.lock(); try { badExtents.add(failedExtent); } finally { wLock.unlock(); } if (log.isTraceEnabled()) log.trace("Invalidated extent={}", failedExtent); } TabletLocatorImpl(TableId tableId, TabletLocator parent, TabletLocationObtainer tlo,
      TabletServerLockChecker tslc); @Override void binMutations(ClientContext context, List<T> mutations,
      Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures); @Override List<Range> binRanges(ClientContext context, List<Range> ranges,
      Map<String,Map<KeyExtent,List<Range>>> binnedRanges); @Override void invalidateCache(KeyExtent failedExtent); @Override void invalidateCache(Collection<KeyExtent> keySet); @Override void invalidateCache(ClientContext context, String server); @Override void invalidateCache(); @Override TabletLocation locateTablet(ClientContext context, Text row, boolean skipRow,
      boolean retry); }
TabletLocatorImpl extends TabletLocator { @Override public void invalidateCache(KeyExtent failedExtent) { wLock.lock(); try { badExtents.add(failedExtent); } finally { wLock.unlock(); } if (log.isTraceEnabled()) log.trace("Invalidated extent={}", failedExtent); } TabletLocatorImpl(TableId tableId, TabletLocator parent, TabletLocationObtainer tlo,
      TabletServerLockChecker tslc); @Override void binMutations(ClientContext context, List<T> mutations,
      Map<String,TabletServerMutations<T>> binnedMutations, List<T> failures); @Override List<Range> binRanges(ClientContext context, List<Range> ranges,
      Map<String,Map<KeyExtent,List<Range>>> binnedRanges); @Override void invalidateCache(KeyExtent failedExtent); @Override void invalidateCache(Collection<KeyExtent> keySet); @Override void invalidateCache(ClientContext context, String server); @Override void invalidateCache(); @Override TabletLocation locateTablet(ClientContext context, Text row, boolean skipRow,
      boolean retry);  }